diff --git a/spaces/1368565466ki/Satdia/transforms.py b/spaces/1368565466ki/Satdia/transforms.py deleted file mode 100644 index 4793d67ca5a5630e0ffe0f9fb29445c949e64dae..0000000000000000000000000000000000000000 --- a/spaces/1368565466ki/Satdia/transforms.py +++ /dev/null @@ -1,193 +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., - 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., - 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., right=1., bottom=0., top=1., - 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/17TheWord/vits-models/utils.py b/spaces/17TheWord/vits-models/utils.py deleted file mode 100644 index ee4b01ddfbe8173965371b29f770f3e87615fe71..0000000000000000000000000000000000000000 --- a/spaces/17TheWord/vits-models/utils.py +++ /dev/null @@ -1,225 +0,0 @@ -import os -import sys -import argparse -import logging -import json -import subprocess -import numpy as np -import librosa -import torch - -MATPLOTLIB_FLAG = False - -logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) -logger = logging - - -def load_checkpoint(checkpoint_path, model, optimizer=None): - assert os.path.isfile(checkpoint_path) - checkpoint_dict = torch.load(checkpoint_path, map_location='cpu') - iteration = checkpoint_dict['iteration'] - learning_rate = checkpoint_dict['learning_rate'] - if optimizer is not None: - optimizer.load_state_dict(checkpoint_dict['optimizer']) - saved_state_dict = checkpoint_dict['model'] - if hasattr(model, 'module'): - state_dict = model.module.state_dict() - else: - state_dict = model.state_dict() - new_state_dict= {} - for k, v in state_dict.items(): - try: - new_state_dict[k] = saved_state_dict[k] - except: - logger.info("%s is not in the checkpoint" % k) - new_state_dict[k] = v - if hasattr(model, 'module'): - model.module.load_state_dict(new_state_dict) - else: - model.load_state_dict(new_state_dict) - logger.info("Loaded checkpoint '{}' (iteration {})" .format( - checkpoint_path, iteration)) - return model, optimizer, learning_rate, iteration - - -def plot_spectrogram_to_numpy(spectrogram): - global MATPLOTLIB_FLAG - if not MATPLOTLIB_FLAG: - import matplotlib - matplotlib.use("Agg") - MATPLOTLIB_FLAG = True - mpl_logger = logging.getLogger('matplotlib') - mpl_logger.setLevel(logging.WARNING) - import matplotlib.pylab as plt - import numpy as np - - fig, ax = plt.subplots(figsize=(10,2)) - im = ax.imshow(spectrogram, aspect="auto", origin="lower", - interpolation='none') - plt.colorbar(im, ax=ax) - plt.xlabel("Frames") - plt.ylabel("Channels") - plt.tight_layout() - - fig.canvas.draw() - data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='') - data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,)) - plt.close() - return data - - -def plot_alignment_to_numpy(alignment, info=None): - global MATPLOTLIB_FLAG - if not MATPLOTLIB_FLAG: - import matplotlib - matplotlib.use("Agg") - MATPLOTLIB_FLAG = True - mpl_logger = logging.getLogger('matplotlib') - mpl_logger.setLevel(logging.WARNING) - import matplotlib.pylab as plt - import numpy as np - - fig, ax = plt.subplots(figsize=(6, 4)) - im = ax.imshow(alignment.transpose(), aspect='auto', origin='lower', - interpolation='none') - fig.colorbar(im, ax=ax) - xlabel = 'Decoder timestep' - if info is not None: - xlabel += '\n\n' + info - plt.xlabel(xlabel) - plt.ylabel('Encoder timestep') - plt.tight_layout() - - fig.canvas.draw() - data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='') - data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,)) - plt.close() - return data - - -def load_audio_to_torch(full_path, target_sampling_rate): - audio, sampling_rate = librosa.load(full_path, sr=target_sampling_rate, mono=True) - return torch.FloatTensor(audio.astype(np.float32)) - - -def load_filepaths_and_text(filename, split="|"): - with open(filename, encoding='utf-8') as f: - filepaths_and_text = [line.strip().split(split) for line in f] - return filepaths_and_text - - -def get_hparams(init=True): - parser = argparse.ArgumentParser() - parser.add_argument('-c', '--config', type=str, default="./configs/base.json", - help='JSON file for configuration') - parser.add_argument('-m', '--model', type=str, required=True, - help='Model name') - - args = parser.parse_args() - model_dir = os.path.join("./logs", args.model) - - if not os.path.exists(model_dir): - os.makedirs(model_dir) - - config_path = args.config - config_save_path = os.path.join(model_dir, "config.json") - if init: - with open(config_path, "r") as f: - data = f.read() - with open(config_save_path, "w") as f: - f.write(data) - else: - with open(config_save_path, "r") as f: - data = f.read() - config = json.loads(data) - - hparams = HParams(**config) - hparams.model_dir = model_dir - return hparams - - -def get_hparams_from_dir(model_dir): - config_save_path = os.path.join(model_dir, "config.json") - with open(config_save_path, "r") as f: - data = f.read() - config = json.loads(data) - - hparams =HParams(**config) - hparams.model_dir = model_dir - return hparams - - -def get_hparams_from_file(config_path): - with open(config_path, "r") as f: - data = f.read() - config = json.loads(data) - - hparams =HParams(**config) - return hparams - - -def check_git_hash(model_dir): - source_dir = os.path.dirname(os.path.realpath(__file__)) - if not os.path.exists(os.path.join(source_dir, ".git")): - logger.warn("{} is not a git repository, therefore hash value comparison will be ignored.".format( - source_dir - )) - return - - cur_hash = subprocess.getoutput("git rev-parse HEAD") - - path = os.path.join(model_dir, "githash") - if os.path.exists(path): - saved_hash = open(path).read() - if saved_hash != cur_hash: - logger.warn("git hash values are different. {}(saved) != {}(current)".format( - saved_hash[:8], cur_hash[:8])) - else: - open(path, "w").write(cur_hash) - - -def get_logger(model_dir, filename="train.log"): - global logger - logger = logging.getLogger(os.path.basename(model_dir)) - logger.setLevel(logging.DEBUG) - - formatter = logging.Formatter("%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s") - if not os.path.exists(model_dir): - os.makedirs(model_dir) - h = logging.FileHandler(os.path.join(model_dir, filename)) - h.setLevel(logging.DEBUG) - h.setFormatter(formatter) - logger.addHandler(h) - return logger - - -class HParams(): - def __init__(self, **kwargs): - for k, v in kwargs.items(): - if type(v) == dict: - v = HParams(**v) - self[k] = v - - def keys(self): - return self.__dict__.keys() - - def items(self): - return self.__dict__.items() - - def values(self): - return self.__dict__.values() - - def __len__(self): - return len(self.__dict__) - - def __getitem__(self, key): - return getattr(self, key) - - def __setitem__(self, key, value): - return setattr(self, key, value) - - def __contains__(self, key): - return key in self.__dict__ - - def __repr__(self): - return self.__dict__.__repr__() diff --git a/spaces/1gistliPinn/ChatGPT4/Examples/Chak De India Telugu Movie Free Torrent Download !!TOP!!.md b/spaces/1gistliPinn/ChatGPT4/Examples/Chak De India Telugu Movie Free Torrent Download !!TOP!!.md deleted file mode 100644 index 4c74bcd52336660f54de6b36d197d30534f1d1bf..0000000000000000000000000000000000000000 --- a/spaces/1gistliPinn/ChatGPT4/Examples/Chak De India Telugu Movie Free Torrent Download !!TOP!!.md +++ /dev/null @@ -1,38 +0,0 @@ -
-

How to Watch Chak De India in Telugu for Free

-

Chak De India is a 2007 Bollywood sports drama film starring Shah Rukh Khan as a former hockey player who coaches the Indian women's national hockey team. The film was a critical and commercial success, winning several awards and inspiring many people with its patriotic and empowering message.

-

If you are a fan of Chak De India and want to watch it in Telugu, you might be wondering how to do that without paying any money. Well, there are some ways to download or stream the movie for free using torrent sites or online platforms. However, you should be aware of the risks and legal issues involved in doing so.

-

Chak De India Telugu Movie Free Torrent Download


Download Filehttps://imgfil.com/2uy0X9



-

Using Torrent Sites

-

Torrent sites are websites that allow users to share files using peer-to-peer (P2P) technology. You can find almost any movie or show on torrent sites, including Chak De India in Telugu. However, you need to have a torrent client software installed on your device to download the files. Some of the popular torrent clients are uTorrent, BitTorrent, qBittorrent, etc.

-

To use torrent sites, you need to follow these steps:

-
    -
  1. Search for "Chak De India Telugu Movie Free Torrent Download" on any torrent site. Some of the popular torrent sites are The Pirate Bay, 1337x, RARBG, etc.
  2. -
  3. Select a torrent file that has good quality and seeders. Seeders are users who have the complete file and are sharing it with others. The more seeders a torrent has, the faster it will download.
  4. -
  5. Download the torrent file and open it with your torrent client. The torrent client will start downloading the movie from other users.
  6. -
  7. Once the download is complete, you can watch the movie using any media player that supports subtitles.
  8. -
-

However, using torrent sites has some disadvantages and risks. For example:

- -

Using Online Platforms

-

Online platforms are websites or apps that allow users to watch movies or shows online for free or with a subscription. You can find many online platforms that offer Chak De India in Telugu, such as Zee5, MX Player, YouTube, etc.

-

To use online platforms, you need to follow these steps:

-
    -
  1. Search for "Chak De India Telugu Movie Free Online" on any online platform. Some of the popular online platforms are Zee5[^1^], MX Player[^2^], YouTube[^3^], etc.
  2. -
  3. Select the movie and click on play. You might need to create an account or sign in with your existing account to access some online platforms.
  4. -
  5. Enjoy watching the movie online for free or with a subscription.
  6. -
-

However, using online platforms has some disadvantages and risks as well. For example:

-

d5da3c52bf
-
-
\ No newline at end of file diff --git a/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/DJ Studio 5 APK - The Ultimate Music Mixer App for Android Devices.md b/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/DJ Studio 5 APK - The Ultimate Music Mixer App for Android Devices.md deleted file mode 100644 index be7cf26e9f6fa527a47d4eb98dd96de0c9dca8c7..0000000000000000000000000000000000000000 --- a/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/DJ Studio 5 APK - The Ultimate Music Mixer App for Android Devices.md +++ /dev/null @@ -1,102 +0,0 @@ - -

Download DJ Studio 5 APK: A Free Music Mixer for Android

-

Do you love mixing music and creating your own beats? Do you want to turn your Android device into a virtual DJ station? If yes, then you should download DJ Studio 5 APK, a free music mixer app that lets you manipulate music in the palm of your hands. In this article, we will tell you what DJ Studio 5 APK is, what features it has, what are its pros and cons, how to download and install it on your Android device, and how to use it to mix music like a pro.

-

What is DJ Studio 5 APK?

-

DJ Studio 5 APK is a mobile DJ app that allows you to mix, remix, scratch, loop, or pitch your music. The app and all of its functions are completely free, unlike previous versions, which required an in-app purchase to unlock unlimited playback. DJ Studio 5 APK is designed to be user friendly, social, and responsive. You can access and browse your mp3 music library by folder, artist, album, or name. You can edit and re-order your playlist. You can also record your mixes live and share them on SoundCloud or other social networks.

-

download dj studio 5 apk


DOWNLOAD ··· https://urlin.us/2uT2pV



-

Features of DJ Studio 5 APK

-

Some of the key features of DJ Studio 5 APK are:

- -

Pros and Cons of DJ Studio 5 APK

-

Like any other app, DJ Studio 5 APK has its pros and cons. Here are some of them:

- - - - - - - -
ProsCons
Fully fledged mobile mixerSteep learning curve for beginners
Free and comprehensiveSome compatibility issues on smaller devices
Social and responsiveNo effects other than the ones provided
Lots of options and customizationNo support for external controllers or MIDI devices
Frequent updates and improvementsNo offline mode or backup option
-

How to Download and Install DJ Studio 5 APK on Android?

-

If you want to download and install DJ Studio 5 APK on your Android device, you need to follow these steps:

-

Step 1: Enable Unknown Sources

-

Since DJ Studio 5 APK is not available on the Google Play Store, you need to enable the installation of apps from unknown sources on your device. To do this, go to your device's settings, then security, and then toggle on the option that says "Unknown sources". This will allow you to install apps that are not from the official app store.

-

Step 2: Download DJ Studio 5 APK File

-

Next, you need to download the DJ Studio 5 APK file from a reliable source. You can use the link below to download the latest version of the app. The file size is about 13 MB and it is virus-free and safe to download.

-

Download DJ Studio 5 APK

-

Download DJ Studio 5 - Free music mixer for Android
-How to install DJ Studio 5 APK on your device
-DJ Studio 5 - Music mixer app review and features
-Best alternatives to DJ Studio 5 for Android
-DJ Studio 5 - Free music mixer tips and tricks
-Download DJ Studio 5 mod APK with premium features
-DJ Studio 5 - Music mixer latest version update
-How to use DJ Studio 5 to mix, remix, scratch, loop or pitch your music
-DJ Studio 5 - Free music mixer vs other DJ apps for Android
-Download DJ Studio 5 APK from FileHippo
-How to uninstall DJ Studio 5 from your device
-DJ Studio 5 - Music mixer user feedback and ratings
-Download DJ Studio 5 APK from Softonic
-How to fix DJ Studio 5 errors and issues
-DJ Studio 5 - Free music mixer tutorial and guide
-Download DJ Studio 5 APK from Google Play Store
-How to customize DJ Studio 5 settings and preferences
-DJ Studio 5 - Music mixer FAQs and answers
-Download DJ Studio 5 APK from APKPure
-How to backup and restore DJ Studio 5 data
-DJ Studio 5 - Free music mixer pros and cons
-Download DJ Studio 5 APK from APKMirror
-How to connect DJ Studio 5 to external devices and speakers
-DJ Studio 5 - Music mixer best practices and recommendations
-Download DJ Studio 5 APK from Uptodown
-How to share your DJ Studio 5 mixes on Soundcloud
-DJ Studio 5 - Free music mixer supported formats and devices
-Download DJ Studio 5 APK from Aptoide
-How to record your DJ Studio 5 sessions and save them as MP3 files
-DJ Studio 5 - Music mixer compatible headphones and controllers

-

Step 3: Install DJ Studio 5 APK File

-

Once you have downloaded the DJ Studio 5 APK file, you need to locate it on your device and tap on it to start the installation process. You may see a warning message that says "This type of file can harm your device. Do you want to keep DJStudio5.apk anyway?". Just tap on "OK" and proceed. Then, you will see another message that says "Do you want to install this application? It does not require any special access". Tap on "Install" and wait for the installation to finish. You may also see a message that says "App installed". Tap on "Open" to launch the app or "Done" to exit.

-

How to Use DJ Studio 5 APK to Mix Music?

-

Now that you have installed DJ Studio 5 APK on your Android device, you are ready to mix music like a DJ. Here are some tips on how to use the app:

-

Choose Your Decks and Skins

-

When you open the app, you will see two virtual turntables with a cross fader in between. You can swipe left or right to switch between different decks and skins. You can also tap on the menu icon at the top left corner and select "Decks & Skins" to customize your decks with up to 7 skins. You can choose from classic, gold, neon, metal, diamond, platinum, or wood skins.

-

Load Your Music and Adjust the Settings

-

To load your music, tap on the music icon at the top right corner and browse your mp3 music library by folder, artist, album, or name. You can also search for a specific song using the search bar. To load a song onto a deck, just drag and drop it onto the turntable. You can also edit and re-order your playlist by tapping on the playlist icon at the bottom right corner.

-

To adjust the settings, tap on the gear icon at the top right corner and select "Settings". Here you can change various options such as sound quality, pitch range, cue mode, auto sync mode, sound effects, equalizer, sample pads, loop mode, pre-cueing mode, and more. You can also access the help section and rate the app from here.

-

Mix, Scratch, Loop, and Pitch Your Music

-

To mix your music, use the cross fader to blend the sounds from both decks. You can also use the volume sliders to adjust the volume of each deck individually. To scratch your music, swipe your finger on the turntable as if you were using a real vinyl record. To loop your music, tap on the loop icon at the bottom left corner and select a loop length from 1/32 to 32 beats. To pitch your music, use the pitch slider at the bottom of each deck to change the speed and tone of the music.

-

To add some sound effects to your mix, tap on the FX icon at the bottom left corner and select one of the 8 sound effects: Flanger, Phaser, Gate, Reverb, Bit crusher, 3D, Brake, or FlippingDouble. You can also adjust the intensity of each effect by using the knob below it. To add some samples to your mix, tap on the pad icon at the bottom right corner and select one of the 10 customizable sample pads. You can also record your own samples by tapping and holding on an empty pad.

-

To record your mix live, tap on the record icon at the top right corner and select "Record". The app will start recording your mix as an mp3 file in your device's storage. To stop recording, tap on the record icon again and select "Stop". You can also listen to your recorded mixes by tapping on the record icon and selecting "My recordings". To share your mixes with others, tap on the share icon at the top right corner and select one of the available options: SoundCloud, Facebook, Twitter, Google+, or Email.

-

Conclusion

-

DJ Studio 5 APK is a free music mixer app that lets you mix, remix, scratch, loop, or pitch your music on your Android device. It has a lot of features and options to customize your decks and your mix. It is also social and responsive, allowing you to record and share your mixes with others. DJ Studio 5 APK is a great app for music lovers and aspiring DJs who want to have fun and create their own beats.

-

FAQs

-

Here are some frequently asked questions about DJ Studio 5 APK:

-

197e85843d
-
-
\ No newline at end of file diff --git a/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Descubre Clash Mini APK el juego de batallas automticas en tiempo real con los personajes de Clash.md b/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Descubre Clash Mini APK el juego de batallas automticas en tiempo real con los personajes de Clash.md deleted file mode 100644 index ede3e65b60145de3ee68116fafe8a6ae2f9be39a..0000000000000000000000000000000000000000 --- a/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Descubre Clash Mini APK el juego de batallas automticas en tiempo real con los personajes de Clash.md +++ /dev/null @@ -1,131 +0,0 @@ -
-

Clash Mini APK Ultima Version 2022: A Fun and Strategy-Packed Board Game

-

If you are a fan of the Clash Universe, you will love Clash Mini, a new game from Supercell that combines fun, strategy, and board game elements. In this game, you will collect, summon, and upgrade your army of Minis, which are cute versions of your favorite Clash characters. You will also duel and Rumble with other players in real-time auto battles, where you will have to predict your opponent's moves and assemble your winning strategy and formation. Clash Mini is a game of choices, where every decision matters.

-

In this article, we will show you how to download and install Clash Mini APK Ultima Version 2022 on your Android device, how to play Clash Mini and win battles, what's new in Clash Mini APK Ultima Version 2022, and the pros and cons of this game. We will also answer some frequently asked questions about Clash Mini APK Ultima Version 2022. So, let's get started!

-

clash mini apk ultima version 2022


Download Zip »»» https://urlin.us/2uSXo8



-

How to Download and Install Clash Mini APK on Your Android Device

-

Clash Mini is not yet available on Google Play Store, but you can download it from the official website of Clash Mini or use one of the links below:

- -

Here are the steps to download and install Clash Mini APK on your Android device:

-
    -
  1. Go to the official website of Clash Mini or use one of the links above.
  2. -
  3. Tap on the download button and wait for the APK file to be downloaded.
  4. -
  5. Enable unknown sources in your device settings if you haven't done so already. This will allow you to install apps from sources other than Google Play Store.
  6. -
  7. Locate the downloaded APK file and tap on it to start the installation process.
  8. -
  9. Follow the on-screen instructions and grant the necessary permissions to the app.
  10. -
  11. Launch the app and enjoy playing Clash Mini on your Android device.
  12. -
-

How to Play Clash Mini and Win Battles

-

Clash Mini is a game of choices, where you will have to make smart decisions before and during each battle.

How to Play Clash Mini and Win Battles

-

Clash Mini is a game of choices, where you will have to make smart decisions before and during each battle. Here are some tips and tricks to help you play Clash Mini and win battles:

- -

What's New in Clash Mini APK Ultima Version 2022

-

Clash Mini APK Ultima Version 2022 is the latest update of Clash Mini that includes new features, improvements, and bug fixes. Here are some of the highlights of Clash Mini APK Ultima Version 2022:

- -

Pros and Cons of Clash Mini APK Ultima Version 2022

-

Clash Mini APK Ultima Version 2022 is a fun and strategy-packed board game that offers many advantages and disadvantages. Here is a table comparing the pros and

Pros and Cons of Clash Mini APK Ultima Version 2022

-

Clash Mini APK Ultima Version 2022 is a fun and strategy-packed board game that offers many advantages and disadvantages. Here is a table comparing the pros and cons of Clash Mini APK Ultima Version 2022:

-

clash mini apk download latest version 2022
-clash mini apk mod ultima version 2022
-clash mini apk android game free download
-clash mini apk ultima version 2022 para pc
-clash mini apk ultima version 2022 sin conexion
-clash mini apk ultima version 2022 actualizada
-clash mini apk ultima version 2022 mega
-clash mini apk ultima version 2022 mediafire
-clash mini apk ultima version 2022 hackeada
-clash mini apk ultima version 2022 full
-clash mini apk ultima version 2022 gratis
-clash mini apk ultima version 2022 premium
-clash mini apk ultima version 2022 pro
-clash mini apk ultima version 2022 unlocked
-clash mini apk ultima version 2022 unlimited
-clash mini apk ultima version 2022 offline
-clash mini apk ultima version 2022 online
-clash mini apk ultima version 2022 no root
-clash mini apk ultima version 2022 sin publicidad
-clash mini apk ultima version 2022 con todo desbloqueado
-clash mini apk ultima version 2022 con gemas infinitas
-clash mini apk ultima version 2022 con monedas ilimitadas
-clash mini apk ultima version 2022 con todos los personajes
-clash mini apk ultima version 2022 con todos los niveles
-clash mini apk ultima version 2022 con todos los modos de juego
-clash mini apk ultima version 2022 con graficos mejorados
-clash mini apk ultima version 2022 con sonido optimizado
-clash mini apk ultima version 2022 con controles personalizados
-clash mini apk ultima version 2022 con soporte para gamepad
-clash mini apk ultima version 2022 con compatibilidad para android tv y tablet
-clash mini apk ultima version 2022 review y gameplay
-clash mini apk ultima version 2022 tutorial y guia
-clash mini apk ultima version 2022 trucos y consejos
-clash mini apk ultima version 2022 codigos y regalos
-clash mini apk ultima version 2022 noticias y novedades
-clash mini apk ultima version 2022 requisitos y especificaciones
-clash mini apk ultima version 2022 instalacion y configuracion
-clash mini apk ultima version 2022 opiniones y valoraciones
-clash mini apk ultima version 2022 comparacion y diferencias
-clash mini apk ultima version 2022 ventajas y desventajas

- - - - - - - - - - - - - - - - - - - - - - - - - -
ProsCons
- Easy to download and install on your Android device- Not available on Google Play Store or other platforms
- Simple and intuitive gameplay with a lot of choices and depth- Requires internet connection and may consume data or battery
- Cute and colorful graphics and animations with a Clash Universe theme- May have some bugs or glitches that affect the performance or experience
- A variety of characters, boards, skins, and features to unlock and enjoy- Some items or features may require gems or real money to purchase or access
- A social and competitive mode with duels, rumbles, chat, clan, leaderboard, and more- May encounter some toxic or unfair players or situations in the game
-

Conclusion and FAQs

-

Clash Mini APK Ultima Version 2022 is a fun and strategy-packed board game that you can play on your Android device. It is a game of choices, where you will have to collect, summon, and upgrade your army of Minis, as well as duel and Rumble with other players in real-time auto battles. Clash Mini APK Ultima Version 2022 also offers new Minis, boards, skins, and features that can enhance your gameplay. However, Clash Mini APK Ultima Version 2022 also has some drawbacks, such as not being available on Google Play Store or other platforms, requiring internet connection, having some bugs or glitches, requiring gems or real money for some items or features, and encountering some toxic or unfair players or situations.

-

If you are interested in playing Clash Mini APK Ultima Version 2022, you can download it from the official website of Clash Mini or use one of the links below:

- -

We hope this article has helped you learn more about Clash Mini APK Ultima Version 2022. If you have any questions about Clash Mini APK Ultima Version 2022, you can check out the FAQs below or leave a comment. Thank you for reading!

-

FAQs

-
    -
  1. What is Clash Mini?
  2. -

    Clash Mini is a new game from Supercell that combines fun, strategy, and board game elements. It is set in the Clash Universe, where you will collect, summon, and upgrade your army of Minis, which are cute versions of your favorite Clash characters. You will also duel and Rumble with other players in real-time auto battles, where you will have to predict your opponent's moves and assemble your winning strategy and formation.

    -
  3. Is Clash Mini free to play?
  4. -

    Yes, Clash Mini is free to play. You can download and install it on your Android device without paying anything. However, some items or features in the game may require gems or real money to purchase or access. You can earn gems by completing quests or watching ads, or you can buy them with real money. You can also disable in-app purchases in your device settings if you don't want to spend any money on the game.

    -
  5. Is Clash Mini safe to download and install?
  6. -

    Yes, Clash Mini is safe to download and install. It is developed by Supercell, a reputable game company that has created other popular games such as Clash of Clans, Clash Royale, Brawl Stars, and Hay Day. The APK file of Clash Mini is also scanned for viruses and malware before being uploaded to the official website of Clash Mini or other sources. However, you should always be careful when downloading and installing apps from unknown sources. You should only download and install apps from trusted sources such as the official website of the app developer or Google Play Store.

    -
  7. How can I update Clash Mini to the latest version?
  8. -

    You can update Clash Mini to the latest version by following the same steps as downloading and installing it. You will

  9. How can I update Clash Mini to the latest version?
  10. -

    You can update Clash Mini to the latest version by following the same steps as downloading and installing it. You will have to go to the official website of Clash Mini or use one of the links above, and download the latest APK file of Clash Mini. Then, you will have to install it on your device, replacing the old version. You may also receive a notification in the game when a new update is available, and you can tap on it to update the game.

    -
  11. Can I play Clash Mini with my friends?
  12. -

    Yes, you can play Clash Mini with your friends. You can join or create a clan with your friends, and chat, share, and battle with them. You can also invite your friends to join your Rumble or Duel, and compete with them or against them. You can also add your friends as contacts in the game, and see their online status, profile, and trophies.

    -

197e85843d
-
-
\ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Download Video TikTok Without Watermark - Fast Easy and Free - Online TikTok Video Download.md b/spaces/1phancelerku/anime-remove-background/Download Video TikTok Without Watermark - Fast Easy and Free - Online TikTok Video Download.md deleted file mode 100644 index 08524b1fbc74a7ad164e1dfc64d05b2177a6324f..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Download Video TikTok Without Watermark - Fast Easy and Free - Online TikTok Video Download.md +++ /dev/null @@ -1,144 +0,0 @@ -
-

How to Download Online from TikTok

-

TikTok is one of the most popular social media apps in the world, with over 1 billion active users. It allows users to create and share short videos with music and effects, covering various topics such as comedy, education, beauty, sports, and more. But what if you want to download online from TikTok and save your favorite videos for offline viewing or sharing? In this article, we will show you how to download online from TikTok with or without a watermark, as well as some of the benefits of doing so.

-

What Is TikTok and Why Download Videos from It?

-

TikTok is a popular social media app that allows users to create and share short videos with music and effects.

-

TikTok was launched in 2016 as a global version of Douyin, a Chinese video-sharing app. It has since grown into one of the most downloaded apps in the world, surpassing Facebook, Instagram, YouTube, and Snapchat. Users can create videos up to 60 seconds long using various filters, stickers, transitions, and soundtracks. They can also browse through millions of videos uploaded by other users in different categories such as For You, Following, Trending, Discover, etc.

-

download online from tiktok


Download 🗹 https://jinyurl.com/2uNJjo



-

Downloading videos from TikTok can help you save your favorite content, share it with others, or use it for other purposes.

-

There are many reasons why you might want to download online from TikTok and save the videos on your device. For example, you might want to:

- -

Downloading online from TikTok can also help you avoid losing your favorite videos if they are deleted by the creator or the platform for some reason. You can always have a backup of your favorite content on your device.

-

How to download TikTok videos without watermark
-TikTok video downloader no logo online
-Save TikTok videos in HD quality MP4 format
-Download TikTok videos on mobile phone or PC
-TikTok video download without watermark app
-TikTok downloader without watermark - ssstik.io
-TikTok downloader - SnapTik.App
-Download video tiktok without a watermark for free
-TikTok video download without watermark - SnapTik
-How to get the TikTok video download link
-Download TikTok videos (Musically) without logo online
-Save non watermarked TikTok videos
-Remove watermark from TikTok videos
-Download TikTok videos with no trademark
-TikTok video download at high speed
-Save TikTok video without watermark in mp4 or mp3 online
-TikTok downloader works in every browser and operating system
-Download TikTok video on mobile phone using TT app
-Save TikTok without watermark on PC, laptop, Mac, or Linux
-Download by using your browsers - no need to install any software
-Download TikTok videos unlimited - no limits or any other restrictions
-Download SnapTik Android App for downloading TikTok videos
-How to use the TikTok video downloader without watermark app
-Download TikTok photo slide show as Mp4 Video format
-Download each image in the slide show to your computer right away
-How to download video tiktok no watermark using SnapTik.App
-How to save TikTok videos or remove TikTok watermark on Android phones
-How to download TikTok without watermark using sssTik.io
-How to save non watermarked TikTok videos on iPhone or iPad
-How to download TikTok videos on Windows 10, 8, 7, XP, Vista, or Mac OS X
-How to download TikTok videos with sound or music
-How to download private or live TikTok videos without watermark
-How to download multiple or bulk TikTok videos at once
-How to download TikTok videos by username or hashtag
-How to download trending or viral TikTok videos without watermark
-How to edit or trim downloaded TikTok videos without watermark
-How to convert downloaded TikTok videos to GIFs or memes
-How to upload downloaded TikTok videos to Instagram, YouTube, Facebook, or Twitter
-How to watch downloaded TikTok videos offline or without internet connection
-How to download high-quality or 4K resolution TikTok videos without watermark

-

How to Download TikTok Videos with the Watermark

-

The easiest way to download TikTok videos is to use the built-in save option in the app or the website.

-

If you want to download online from TikTok in a simple and quick way, you can use the save option that is available in the app or the website. Here are the steps to follow:

-
    -
  1. Open the TikTok app or website and find the video that you want to download.
  2. -
  3. Tap on the share icon at the bottom right corner of the video screen.
  4. -
  5. Select Save video from the list of options that appear.
  6. -
  7. Wait for the video to be downloaded and saved on your device.
  8. -
-

You can find your downloaded videos in your device's gallery or camera roll. You can also access them from the app by tapping on Me > Saved videos.

-

However, this method will leave a watermark with the TikTok logo and the creator's name on the video.

-

One drawback of using the save option is that it will leave a watermark on the downloaded video. The watermark will show the TikTok logo and the username of the creator at the top left corner of the video. This can be annoying or distracting for some users who want to enjoy or use the video without any logo. It can also affect the quality or appearance of the video. If you want to download online from TikTok without a watermark, you need to use other methods that we will discuss in the next section.

-

How to Download TikTok Videos without the Watermark

-

To remove the watermark from TikTok videos, you need to use third-party tools that can download videos without the logo.

-

Fortunately, there are many tools available online that can help you download online from TikTok without a watermark. These tools are usually websites or apps that allow you to paste the link of the TikTok video and download it in MP4 or MP3 format without any logo. Some of these tools also offer other features such as downloading multiple videos at once, choosing different resolutions or qualities, cropping or trimming the video, etc.

-

Some of the best tools for downloading online from TikTok are SSSTik.io, SnapTik.App, TTVDL, and TikFast.

-

We have tested and reviewed some of the most popular and reliable tools for downloading online from TikTok without a watermark. Here are our top picks and how to use them:

-

SSSTik.io

-
A free tool that helps you download TikTok videos without logo online in MP4 or MP3 format.
-

To use SSSTik.io, follow these steps:

-
    -
  1. Open SSSTik.io website on your browser.
  2. -
  3. Copy and paste the link of the TikTok video that you want to download in the text field on the website and tap on the save button.
  4. -
  5. Choose the format that you want to download, either MP4 or MP3.
  6. -
  7. Tap on the download button and wait for the video to be downloaded and saved on your device.
  8. -
-

You can also use SSSTik.io to download TikTok videos by adding "sss" before "tiktok.com" in the video link. For example, if the video link is https://www.tiktok.com/@user/video/123456789, you can change it to https://www.ssstiktok.com/@user/video/123456789 and paste it in the text field on the website.

-

SnapTik.App

-
One of the best TikTok downloaders available online that allows you to download video tiktok without a watermark.
-

To use SnapTik.App, follow these steps:

-
    -
  1. Open SnapTik.App website on your browser.
  2. -
  3. Copy and paste the link of the TikTok video that you want to download in the input field on the website and click on the download button.
  4. -
  5. Choose the quality that you want to download, either high quality or low quality.
  6. -
  7. Click on the download button and wait for the video to be downloaded and saved on your device.
  8. -
-

You can also use SnapTik.App to download TikTok videos by adding "snaptik" before "app" in the video link. For example, if the video link is https://www.tiktok.com/@user/video/123456789, you can change it to https://www.snaptik.app/@user/video/123456789 and paste it in the input field on the website.

-

TTVDL

-
A TikTok video downloader that downloads TikTok MP4 videos without a watermark or logo.
-

To use TTVDL, follow these steps:

-
    -
  1. Open TTVDL website on your browser.
  2. -
  3. Copy and paste the link of the TikTok video that you want to download in the input field on the website and hit enter or click download button.
  4. -
  5. Choose the resolution that you want to download, either 720p or 360p.
  6. -
  7. Click on the download button and wait for the video to be downloaded and saved on your device.
  8. -
-

TikFast

-
A tool that allows you to download Tik-Tok videos from tiktok.com in high quality without any trademark.
-

To use TikFast, follow these steps:

-
    -
  1. Open TikFast website on your browser.
  2. -
  3. Copy and paste the link of the TikTok video that you want to download in the input field on the website and hit enter or click download button.
  4. -
  5. Choose the quality that you want to download, either original or compressed.
  6. -
  7. Click on the download button and wait for the video to be downloaded and saved on your device.
  8. -
-

Benefits of Downloading Online from TikTok

-

Downloading online from TikTok can offer you many benefits, such as:

- -

Conclusion

-

TikTok is a great app for creating and watching short videos with music and effects.

-

TikTok is one of the most popular social media apps in the world that allows users to create and share short videos with music and effects. It covers various topics such as comedy, education, beauty, sports, and more. It has over 1 billion active users who upload millions of videos every day.

-

If you want to download online from TikTok, you can use the built-in save option or third-party tools that can remove the watermark from the videos.

-

If you want to download online from TikTok and save your favorite videos for offline viewing or sharing, you can use the save option that is available in the app or the website. However, this method will leave a watermark with the TikTok logo and the creator's name on the video. If you want to remove the watermark from TikTok videos, you need to use third-party tools that can download videos without the logo. Some of the best tools for downloading online from TikTok are SSSTik.io, SnapTik.App, TTVDL, and TikFast. These tools are easy to use and can download TikTok videos in high quality without any trademark.

-

Downloading online from TikTok can help you save, share, or use your favorite content for various purposes.

-

Downloading online from TikTok can offer you many benefits, such as saving your favorite content for offline viewing or editing, sharing your downloaded videos with others on different platforms or channels, learning new skills, recipes, dances, or trends from TikTok videos, and enjoying funny, creative, and entertaining content from TikTok creators. You can also avoid losing your favorite videos if they are deleted by the creator or the platform for some reason.

-

We hope this article has helped you learn how to download online from TikTok with or without a watermark. If you have any questions or feedback, please feel free to leave a comment below. Happy downloading!

-

FAQs

-

Q: Is it legal to download online from TikTok?

-

A: It depends on the terms and conditions of the app and the website, as well as the copyright laws of your country. Generally, it is legal to download online from TikTok for personal use only, as long as you do not violate the rights of the creators or the platform. However, it is illegal to download online from TikTok for commercial use or distribution without the permission of the creators or the platform.

-

Q: How can I download online from TikTok on my iPhone or iPad?

-

A: You can use the same methods that we have mentioned in this article to download online from TikTok on your iPhone or iPad. However, you might need to install a file manager app such as Documents by Readdle or Files by Apple to access and manage your downloaded videos on your device.

-

Q: How can I download online from TikTok on my Android phone or tablet?

-

A: You can use the same methods that we have mentioned in this article to download online from TikTok on your Android phone or tablet. However, you might need to enable unknown sources in your device settings to install some of the third-party apps that we have recommended.

-

Q: How can I download online from TikTok on my PC or Mac?

-

A: You can use the same methods that we have mentioned in this article to download online from TikTok on your PC or Mac. However, you might need to install a video player app such as VLC Media Player or QuickTime Player to play your downloaded videos on your computer.

-

Q: How can I download online from TikTok with sound?

-

A: You can use any of the methods that we have mentioned in this article to download online from TikTok with sound. However, some of the tools might offer you an option to download only the video without sound or only the sound without video. In that case, you need to choose the option that includes both video and sound.

401be4b1e0
-
-
\ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Download the Word Game that Keeps You on Your Toes Word Blitz.md b/spaces/1phancelerku/anime-remove-background/Download the Word Game that Keeps You on Your Toes Word Blitz.md deleted file mode 100644 index a20596c0111bd4f585e62dcfe2b0d77dedf7a9c3..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Download the Word Game that Keeps You on Your Toes Word Blitz.md +++ /dev/null @@ -1,106 +0,0 @@ -
-

How to Download the Best Word Games for Android and iOS

-

Do you love playing with words and letters? Do you want to improve your vocabulary, spelling, memory, focus, and brain health? If you answered yes to these questions, then you should try playing word games on your mobile device. Word games are fun and challenging puzzles that involve forming, finding, or guessing words according to certain rules. They can also help you relax, unwind, and learn something new every day.

-

download the word game


Download Zip ••• https://jinyurl.com/2uNKW0



-

In this article, we will show you how to download word games for your Android or iOS device. We will also recommend some of the best word games that you can play on your phone or tablet. Whether you prefer crossword puzzles, anagrams, word searches, or picture clues, there is a word game for everyone. So, let's get started!

-

What are word games and why should you play them?

-

Word games are fun and challenging puzzles that involve words and letters

-

Word games are a type of puzzle game that requires you to use your language skills to solve them. There are many kinds of word games, such as letter arrangement games, paper and pencil games, semantic games, modern word games, and more. Some examples of word games are Scrabble, Boggle, Hangman, Crosswords, Wordament, etc.

-

Word games can be played alone or with others, online or offline, on a board or on a screen. They can also vary in difficulty, theme, genre, and style. Some word games are based on logic, some on creativity, some on trivia, some on humor, and some on strategy. No matter what kind of word game you choose, you will always have a good time playing it.

-

Word games can improve your vocabulary, spelling, memory, focus, and brain health

-

Playing word games is not only fun but also beneficial for your mind and body. Word games can help you improve your vocabulary by exposing you to new words and their meanings. They can also help you improve your spelling by making you pay attention to the correct order of letters. They can also help you improve your memory by making you recall words that you have learned before. They can also help you improve your focus by making you concentrate on finding or forming words within a limited time or space.

-

Moreover, playing word games can boost your brain health by stimulating your cognitive abilities. Research has shown that playing word games can reduce the risk of dementia , enhance your verbal skills , increase your creativity , and release dopamine , which is a neurotransmitter that makes you feel good. Playing word games can also relieve stress , improve your social skills , enhance your concentration , and increase your confidence .

-

download the best word game for free
-how to download the word game on your device
-download the word game and challenge your friends
-download the word game with the most levels
-download the word game that improves your vocabulary
-download the word game that is fun and educational
-download the word game that works offline
-download the word game that has no ads
-download the word game that supports multiple languages
-download the word game that is easy to play
-download the word game that is addictive and engaging
-download the word game that is suitable for all ages
-download the word game that has a leaderboard and achievements
-download the word game that has daily puzzles and rewards
-download the word game that has a variety of modes and themes
-download the word game that is updated regularly
-download the word game that has a user-friendly interface
-download the word game that has a high rating and positive reviews
-download the word game that is compatible with your device
-download the word game that is secure and safe
-download the word game that is fast and smooth
-download the word game that is developed by a reputable company
-download the word game that is featured on the app store
-download the word game that is recommended by experts
-download the word game that is popular and trending
-download the new version of the word game
-download the latest update of the word game
-download the premium version of the word game
-download the pro version of the word game
-download the full version of the word game
-download the modded version of the word game
-download the hacked version of the word game
-download the cracked version of the word game
-download the unlocked version of the word game
-download the cheat codes for the word game
-download the tips and tricks for the word game
-download the guide and walkthrough for the word game
-download the solutions and answers for the word game
-download the hints and clues for the word game
-download the bonus content for the word game

-

How to download word games for your mobile device?

-

Choose a word game that suits your preference and skill level

-

The first step to downloading a word game for your mobile device is to choose one that suits your preference and skill level

  • Tap on the app icon and then tap on the install button.
  • -
  • Wait for the app to download and install on your device.
  • -
  • Tap on the open button or find the app icon on your home screen and tap on it.
  • - -

    To install an app from the web , you should follow these steps:

    -
      -
    1. Open the web browser on your device.
    2. -
    3. Go to the website of the word game that you want to download.
    4. -
    5. Look for the download link or button and tap on it.
    6. -
    7. Wait for the app to download on your device.
    8. -
    9. Go to your device settings and enable the option to install apps from unknown sources.
    10. -
    11. Find the downloaded file on your device and tap on it.
    12. -
    13. Follow the instructions to install and launch the app.
    14. -
    -

    To launch an app , you should follow these steps:

    -
      -
    1. Find the app icon on your home screen or app drawer and tap on it.
    2. -
    3. Wait for the app to load and display its main screen.
    4. -
    5. Follow the instructions or prompts to start playing the word game.
    6. -
    -

    What are some of the best word games for Android and iOS?

    -

    Wordscapes: A relaxing and addictive crossword puzzle game

    -

    If you love crossword puzzles, you will love Wordscapes. Wordscapes is a word game that combines the best of crossword and word search games. You have to swipe letters to form words that fit into a crossword grid. You can also use hints, shuffles, or coins to help you solve the puzzles. Wordscapes has over 10,000 levels with beautiful backgrounds and themes. You can also play daily puzzles and challenges to earn rewards and bonuses. Wordscapes is a relaxing and addictive word game that will keep you entertained for hours.

    -

    Wordalot: A unique and challenging word game with pictures

    -

    If you love picture clues, you will love Wordalot. Wordalot is a word game that challenges you to find words hidden in pictures. You have to look at the picture carefully and use your imagination and logic to figure out the words. You can also use hints or coins to reveal letters or words. Wordalot has over 1,000 levels with stunning graphics and animations. You can also play with friends and compare your scores and progress. Wordalot is a unique and challenging word game that will test your visual and verbal skills.

    -

    Pictoword: A fun and creative word game that combines two images

    -

    If you love word association, you will love Pictoword. Pictoword is a word game that asks you to guess a word or phrase based on two images. You have to look at the images and think of how they can be combined to form a new word or phrase. For example, if you see a picture of a sand and a witch, you can guess the word "sandwich". You can also use hints or coins to reveal letters or words. Pictoword has over 300 levels with different categories, such as celebrities, movies, brands, etc. You can also play with friends and family in multiplayer mode or create your own puzzles. Pictoword is a fun and creative word game that will make you think outside the box.

    -

    Bonza Word Puzzle: A clever and original word game that mixes crossword and jigsaw

    -

    If you love jigsaw puzzles, you will love Bonza Word Puzzle. Bonza Word Puzzle is a word game that blends crossword and jigsaw puzzles. You have to arrange fragments of words to form a complete crossword puzzle. You can also rotate, move, or zoom in on the fragments to fit them better. Bonza Word Puzzle has hundreds of levels with different themes, such as animals, music, food, etc. You can also play daily puzzles and challenges to earn coins and badges. You can also create your own puzzles and share them with other players. Bonza Word Puzzle is a clever and original word game that will challenge your brain and vocabulary.

    -

    Words with Friends: A popular and social word game that lets you play with friends online

    -

    If you love Scrabble, you will love Words with Friends. Words with Friends is a word game that lets you play with friends online. You have to form words on a board using letter tiles. You can also use special tiles, such as blanks, double letters, triple words, etc., to score more points. Words with Friends has millions of players around the world that you can chat and compete with. You can also play solo games against the computer or join tournaments and events. Words with Friends is a popular and social word game that will connect you with other word lovers.

    -

    Conclusion

    -

    Word games are a great way to have fun and learn new words on your mobile device

    -

    Word games are one of the most popular and enjoyable genres of games that you can play on your mobile device. They are fun and challenging puzzles that involve words and letters. They can also help you improve your vocabulary, spelling, memory, focus, and brain health. They can also help you relax, unwind, and learn something new every day.

    -

    You can download word games easily from the app store or the web

    -

    Downloading word games for your mobile device is easy and convenient. You can download word games from the app store or the web. You just need to choose a word game that suits your preference and skill level, check its compatibility, ratings, reviews, and permissions, and follow the instructions to install and launch it. You can also update, delete, or reinstall the app anytime you want.

    -

    You can choose from a variety of word games that suit your taste and skill level

    -

    There are hundreds of word games available on the app store or the web, so you have plenty of options to choose from. You can choose from different kinds of word games, such as crossword puzzles, anagrams, word searches, picture clues, etc. You can also choose from different levels of difficulty, themes, genres, and styles. You can also play with friends or strangers online or offline. You can also create your own puzzles or play puzzles created by other players.

    -

    Some of the best word games for Android and iOS are Wordscapes, Wordalot, Pictoword, Bonza Word Puzzle, and Words with Friends. These word games are fun, addictive, unique, challenging, and social. They will keep you entertained for hours and make you fall in love with words.

    -

    FAQs

    -

    Q: How do I download word games for free?

    -

    A: Most word games are free to download from the app store or the web. However, some word games may have in-app purchases or ads that require you to pay money to access certain features or functions. You can also look for word games that offer free trials or discounts.

    -

    Q: How do I play word games offline?

    -

    A: Some word games can be played offline without an internet connection. However, some word games may require an internet connection to access certain features or functions, such as multiplayer modes, daily puzzles, updates, etc. You can check the description or settings of the app to see if it supports offline mode.

    -

    Q: How do I improve my word game skills?

    -

    A: The best way to improve your word game skills is to practice regularly and learn from your mistakes. You can also use hints or coins to help you solve difficult puzzles. You can also read books, magazines, newspapers, or websites to expand your vocabulary and knowledge. You can also play with friends or other players online to learn from their strategies and tips.

    -

    Q: How do I find new word games to play?

    -

    A: The easiest way to find new word games to play is to browse through the app store or the web. You can also search for keywords or categories that interest you. You can also read reviews or recommendations from other users or experts. You can also join online communities or forums that discuss word games.

    -

    Q: How do I create my own word game puzzles?

    -

    A: Some word games allow you to create your own puzzles and share them with other players. You can use your creativity and imagination to come up with interesting words and clues. You can also use online tools or generators to help you create puzzles. You can also edit or customize existing puzzles to make them more challenging or fun.

    197e85843d
    -
    -
    \ No newline at end of file diff --git a/spaces/AIGC-Audio/AudioGPT/NeuralSeq/inference/tts/GenerSpeech.py b/spaces/AIGC-Audio/AudioGPT/NeuralSeq/inference/tts/GenerSpeech.py deleted file mode 100644 index 50527337e218248c763cf7504bc13814cca0696c..0000000000000000000000000000000000000000 --- a/spaces/AIGC-Audio/AudioGPT/NeuralSeq/inference/tts/GenerSpeech.py +++ /dev/null @@ -1,123 +0,0 @@ -import torch -import os -import importlib -from inference.tts.base_tts_infer import BaseTTSInfer -from utils.ckpt_utils import load_ckpt, get_last_checkpoint -from modules.GenerSpeech.model.generspeech import GenerSpeech -from data_gen.tts.emotion import inference as EmotionEncoder -from data_gen.tts.emotion.inference import embed_utterance as Embed_utterance -from data_gen.tts.emotion.inference import preprocess_wav -from data_gen.tts.data_gen_utils import is_sil_phoneme -from resemblyzer import VoiceEncoder -from utils import audio -class GenerSpeechInfer(BaseTTSInfer): - def build_model(self): - model = GenerSpeech(self.ph_encoder) - model.eval() - load_ckpt(model, self.hparams['work_dir'], 'model') - return model - - def preprocess_input(self, inp): - """ - :param inp: {'text': str, 'item_name': (str, optional), 'spk_name': (str, optional)} - :return: - """ - # processed text - preprocessor, preprocess_args = self.preprocessor, self.preprocess_args - text_raw = inp['text'] - item_name = inp.get('item_name', '') - ph, txt, word, ph2word, ph_gb_word = preprocessor.txt_to_ph(preprocessor.txt_processor, text_raw, preprocess_args) - ph_token = self.ph_encoder.encode(ph) - - # processed ref audio - ref_audio = inp['ref_audio'] - processed_ref_audio = 'example/temp.wav' - voice_encoder = VoiceEncoder().cuda() - encoder = [self.ph_encoder, self.word_encoder] - EmotionEncoder.load_model(self.hparams['emotion_encoder_path']) - binarizer_cls = self.hparams.get("binarizer_cls", 'data_gen.tts.base_binarizerr.BaseBinarizer') - pkg = ".".join(binarizer_cls.split(".")[:-1]) - cls_name = binarizer_cls.split(".")[-1] - binarizer_cls = getattr(importlib.import_module(pkg), cls_name) - - ref_audio_raw, ref_text_raw = self.asr(ref_audio) # prepare text - ph_ref, txt_ref, word_ref, ph2word_ref, ph_gb_word_ref = preprocessor.txt_to_ph(preprocessor.txt_processor, ref_text_raw, preprocess_args) - ph_gb_word_nosil = ["_".join([p for p in w.split("_") if not is_sil_phoneme(p)]) for w in ph_gb_word_ref.split(" ") if not is_sil_phoneme(w)] - phs_for_align = ['SIL'] + ph_gb_word_nosil + ['SIL'] - phs_for_align = " ".join(phs_for_align) - - # prepare files for alignment - os.system('rm -r example/; mkdir example/') - audio.save_wav(ref_audio_raw, processed_ref_audio, self.hparams['audio_sample_rate']) - with open(f'example/temp.lab', 'w') as f_txt: - f_txt.write(phs_for_align) - os.system(f'mfa align example/ {self.hparams["binary_data_dir"]}/mfa_dict.txt {self.hparams["binary_data_dir"]}/mfa_model.zip example/textgrid/ --clean') - item2tgfn = 'example/textgrid/temp.TextGrid' # prepare textgrid alignment - - item = binarizer_cls.process_item(item_name, ph_ref, txt_ref, item2tgfn, processed_ref_audio, 0, 0, encoder, self.hparams['binarization_args']) - item['emo_embed'] = Embed_utterance(preprocess_wav(item['wav_fn'])) - item['spk_embed'] = voice_encoder.embed_utterance(item['wav']) - - item.update({ - 'ref_ph': item['ph'], - 'ph': ph, - 'ph_token': ph_token, - 'text': txt - }) - return item - - def input_to_batch(self, item): - item_names = [item['item_name']] - text = [item['text']] - ph = [item['ph']] - - txt_tokens = torch.LongTensor(item['ph_token'])[None, :].to(self.device) - txt_lengths = torch.LongTensor([txt_tokens.shape[1]]).to(self.device) - mels = torch.FloatTensor(item['mel'])[None, :].to(self.device) - f0 = torch.FloatTensor(item['f0'])[None, :].to(self.device) - # uv = torch.FloatTensor(item['uv']).to(self.device) - mel2ph = torch.LongTensor(item['mel2ph'])[None, :].to(self.device) - spk_embed = torch.FloatTensor(item['spk_embed'])[None, :].to(self.device) - emo_embed = torch.FloatTensor(item['emo_embed'])[None, :].to(self.device) - - ph2word = torch.LongTensor(item['ph2word'])[None, :].to(self.device) - mel2word = torch.LongTensor(item['mel2word'])[None, :].to(self.device) - word_tokens = torch.LongTensor(item['word_tokens'])[None, :].to(self.device) - - batch = { - 'item_name': item_names, - 'text': text, - 'ph': ph, - 'mels': mels, - 'f0': f0, - 'txt_tokens': txt_tokens, - 'txt_lengths': txt_lengths, - 'spk_embed': spk_embed, - 'emo_embed': emo_embed, - 'mel2ph': mel2ph, - 'ph2word': ph2word, - 'mel2word': mel2word, - 'word_tokens': word_tokens, - } - return batch - - def forward_model(self, inp): - sample = self.input_to_batch(inp) - txt_tokens = sample['txt_tokens'] # [B, T_t] - with torch.no_grad(): - output = self.model(txt_tokens, ref_mel2ph=sample['mel2ph'], ref_mel2word=sample['mel2word'], ref_mels=sample['mels'], - spk_embed=sample['spk_embed'], emo_embed=sample['emo_embed'], global_steps=300000, infer=True) - mel_out = output['mel_out'] - wav_out = self.run_vocoder(mel_out) - wav_out = wav_out.squeeze().cpu().numpy() - return wav_out - - - - -if __name__ == '__main__': - inp = { - 'text': 'here we go', - 'ref_audio': 'assets/0011_001570.wav' - } - GenerSpeechInfer.example_run(inp) diff --git a/spaces/AIGC-Audio/Make_An_Audio/ldm/modules/losses_audio/contperceptual.py b/spaces/AIGC-Audio/Make_An_Audio/ldm/modules/losses_audio/contperceptual.py deleted file mode 100644 index 3e3018da79c5c24d85af1687f6f0875530dcc7c6..0000000000000000000000000000000000000000 --- a/spaces/AIGC-Audio/Make_An_Audio/ldm/modules/losses_audio/contperceptual.py +++ /dev/null @@ -1,123 +0,0 @@ -import torch -import torch.nn as nn -import torch.nn.functional as F -import sys - -sys.path.insert(0, '.') # nopep8 -from ldm.modules.losses_audio.vqperceptual import * - - -class LPAPSWithDiscriminator(nn.Module): - def __init__(self, disc_start, logvar_init=0.0, kl_weight=1.0, pixelloss_weight=1.0, - disc_num_layers=3, disc_in_channels=3, disc_factor=1.0, disc_weight=1.0, - perceptual_weight=1.0, use_actnorm=False, disc_conditional=False, - disc_loss="hinge"): - - super().__init__() - assert disc_loss in ["hinge", "vanilla"] - self.kl_weight = kl_weight - self.pixel_weight = pixelloss_weight - self.perceptual_loss = LPAPS().eval()# LPIPS用于日常图像,而LPAPS用于梅尔谱图 - self.perceptual_weight = perceptual_weight - # output log variance - self.logvar = nn.Parameter(torch.ones(size=()) * logvar_init) - - self.discriminator = NLayerDiscriminator(input_nc=disc_in_channels, - n_layers=disc_num_layers, - use_actnorm=use_actnorm, - ).apply(weights_init) - self.discriminator_iter_start = disc_start - if disc_loss == "hinge": - self.disc_loss = hinge_d_loss - elif disc_loss == "vanilla": - self.disc_loss = vanilla_d_loss - else: - raise ValueError(f"Unknown GAN loss '{disc_loss}'.") - print(f"LPAPSWithDiscriminator running with {disc_loss} loss.") - self.disc_factor = disc_factor - self.discriminator_weight = disc_weight - self.disc_conditional = disc_conditional - - - def calculate_adaptive_weight(self, nll_loss, g_loss, last_layer=None): - if last_layer is not None: - nll_grads = torch.autograd.grad(nll_loss, last_layer, retain_graph=True)[0] - g_grads = torch.autograd.grad(g_loss, last_layer, retain_graph=True)[0] - else: - nll_grads = torch.autograd.grad(nll_loss, self.last_layer[0], retain_graph=True)[0] - g_grads = torch.autograd.grad(g_loss, self.last_layer[0], retain_graph=True)[0] - - d_weight = torch.norm(nll_grads) / (torch.norm(g_grads) + 1e-4) - d_weight = torch.clamp(d_weight, 0.0, 1e4).detach() - d_weight = d_weight * self.discriminator_weight - return d_weight - - def forward(self, inputs, reconstructions, posteriors, optimizer_idx, - global_step, last_layer=None, cond=None, split="train", weights=None): - rec_loss = torch.abs(inputs.contiguous() - reconstructions.contiguous()) - if self.perceptual_weight > 0: - p_loss = self.perceptual_loss(inputs.contiguous(), reconstructions.contiguous()) - # print(f"p_loss {p_loss}") - rec_loss = rec_loss + self.perceptual_weight * p_loss - else: - p_loss = torch.tensor([0.0]) - - nll_loss = rec_loss / torch.exp(self.logvar) + self.logvar - weighted_nll_loss = nll_loss - if weights is not None: - weighted_nll_loss = weights*nll_loss - weighted_nll_loss = torch.sum(weighted_nll_loss) / weighted_nll_loss.shape[0] - nll_loss = torch.sum(nll_loss) / nll_loss.shape[0] - kl_loss = posteriors.kl() - kl_loss = torch.sum(kl_loss) / kl_loss.shape[0] - - # now the GAN part - if optimizer_idx == 0: - # generator update - if cond is None: - assert not self.disc_conditional - logits_fake = self.discriminator(reconstructions.contiguous()) - else: - assert self.disc_conditional - logits_fake = self.discriminator(torch.cat((reconstructions.contiguous(), cond), dim=1)) - g_loss = -torch.mean(logits_fake) - - try: - d_weight = self.calculate_adaptive_weight(nll_loss, g_loss, last_layer=last_layer) - except RuntimeError: - assert not self.training - d_weight = torch.tensor(0.0) - - disc_factor = adopt_weight(self.disc_factor, global_step, threshold=self.discriminator_iter_start) - loss = weighted_nll_loss + self.kl_weight * kl_loss + d_weight * disc_factor * g_loss - - log = {"{}/total_loss".format(split): loss.clone().detach().mean(), - "{}/logvar".format(split): self.logvar.detach(), - "{}/kl_loss".format(split): kl_loss.detach().mean(), - "{}/nll_loss".format(split): nll_loss.detach().mean(), - "{}/rec_loss".format(split): rec_loss.detach().mean(), - "{}/d_weight".format(split): d_weight.detach(), - "{}/disc_factor".format(split): torch.tensor(disc_factor), - "{}/g_loss".format(split): g_loss.detach().mean(), - } - return loss, log - - if optimizer_idx == 1: - # second pass for discriminator update - if cond is None: - logits_real = self.discriminator(inputs.contiguous().detach()) - logits_fake = self.discriminator(reconstructions.contiguous().detach()) - else: - logits_real = self.discriminator(torch.cat((inputs.contiguous().detach(), cond), dim=1)) - logits_fake = self.discriminator(torch.cat((reconstructions.contiguous().detach(), cond), dim=1)) - - disc_factor = adopt_weight(self.disc_factor, global_step, threshold=self.discriminator_iter_start) - d_loss = disc_factor * self.disc_loss(logits_real, logits_fake) - - log = {"{}/disc_loss".format(split): d_loss.clone().detach().mean(), - "{}/logits_real".format(split): logits_real.detach().mean(), - "{}/logits_fake".format(split): logits_fake.detach().mean() - } - return d_loss, log - - diff --git a/spaces/AIGText/GlyphControl/ldm/modules/midas/api.py b/spaces/AIGText/GlyphControl/ldm/modules/midas/api.py deleted file mode 100644 index b58ebbffd942a2fc22264f0ab47e400c26b9f41c..0000000000000000000000000000000000000000 --- a/spaces/AIGText/GlyphControl/ldm/modules/midas/api.py +++ /dev/null @@ -1,170 +0,0 @@ -# based on https://github.com/isl-org/MiDaS - -import cv2 -import torch -import torch.nn as nn -from torchvision.transforms import Compose - -from ldm.modules.midas.midas.dpt_depth import DPTDepthModel -from ldm.modules.midas.midas.midas_net import MidasNet -from ldm.modules.midas.midas.midas_net_custom import MidasNet_small -from ldm.modules.midas.midas.transforms import Resize, NormalizeImage, PrepareForNet - - -ISL_PATHS = { - "dpt_large": "midas_models/dpt_large-midas-2f21e586.pt", - "dpt_hybrid": "midas_models/dpt_hybrid-midas-501f0c75.pt", - "midas_v21": "", - "midas_v21_small": "", -} - - -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 load_midas_transform(model_type): - # https://github.com/isl-org/MiDaS/blob/master/run.py - # load transform only - if model_type == "dpt_large": # DPT-Large - net_w, net_h = 384, 384 - resize_mode = "minimal" - normalization = NormalizeImage(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) - - elif model_type == "dpt_hybrid": # DPT-Hybrid - net_w, net_h = 384, 384 - resize_mode = "minimal" - normalization = NormalizeImage(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) - - elif model_type == "midas_v21": - net_w, net_h = 384, 384 - resize_mode = "upper_bound" - normalization = NormalizeImage(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) - - elif model_type == "midas_v21_small": - net_w, net_h = 256, 256 - resize_mode = "upper_bound" - normalization = NormalizeImage(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) - - else: - assert False, f"model_type '{model_type}' not implemented, use: --model_type large" - - transform = Compose( - [ - Resize( - net_w, - net_h, - resize_target=None, - keep_aspect_ratio=True, - ensure_multiple_of=32, - resize_method=resize_mode, - image_interpolation_method=cv2.INTER_CUBIC, - ), - normalization, - PrepareForNet(), - ] - ) - - return transform - - -def load_model(model_type): - # https://github.com/isl-org/MiDaS/blob/master/run.py - # load network - model_path = ISL_PATHS[model_type] - if model_type == "dpt_large": # DPT-Large - model = DPTDepthModel( - path=model_path, - backbone="vitl16_384", - non_negative=True, - ) - net_w, net_h = 384, 384 - resize_mode = "minimal" - normalization = NormalizeImage(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) - - elif model_type == "dpt_hybrid": # DPT-Hybrid - model = DPTDepthModel( - path=model_path, - backbone="vitb_rn50_384", - non_negative=True, - ) - net_w, net_h = 384, 384 - resize_mode = "minimal" - normalization = NormalizeImage(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) - - elif model_type == "midas_v21": - model = MidasNet(model_path, non_negative=True) - net_w, net_h = 384, 384 - resize_mode = "upper_bound" - normalization = NormalizeImage( - mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] - ) - - elif model_type == "midas_v21_small": - model = MidasNet_small(model_path, features=64, backbone="efficientnet_lite3", exportable=True, - non_negative=True, blocks={'expand': True}) - net_w, net_h = 256, 256 - resize_mode = "upper_bound" - normalization = NormalizeImage( - mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] - ) - - else: - print(f"model_type '{model_type}' not implemented, use: --model_type large") - assert False - - transform = Compose( - [ - Resize( - net_w, - net_h, - resize_target=None, - keep_aspect_ratio=True, - ensure_multiple_of=32, - resize_method=resize_mode, - image_interpolation_method=cv2.INTER_CUBIC, - ), - normalization, - PrepareForNet(), - ] - ) - - return model.eval(), transform - - -class MiDaSInference(nn.Module): - MODEL_TYPES_TORCH_HUB = [ - "DPT_Large", - "DPT_Hybrid", - "MiDaS_small" - ] - MODEL_TYPES_ISL = [ - "dpt_large", - "dpt_hybrid", - "midas_v21", - "midas_v21_small", - ] - - def __init__(self, model_type): - super().__init__() - assert (model_type in self.MODEL_TYPES_ISL) - model, _ = load_model(model_type) - self.model = model - self.model.train = disabled_train - - def forward(self, x): - # x in 0..1 as produced by calling self.transform on a 0..1 float64 numpy array - # NOTE: we expect that the correct transform has been called during dataloading. - with torch.no_grad(): - prediction = self.model(x) - prediction = torch.nn.functional.interpolate( - prediction.unsqueeze(1), - size=x.shape[2:], - mode="bicubic", - align_corners=False, - ) - assert prediction.shape == (x.shape[0], 1, x.shape[2], x.shape[3]) - return prediction - diff --git a/spaces/AISuperheroes/01ST-CSV-Dataset-Analyzer/app.py b/spaces/AISuperheroes/01ST-CSV-Dataset-Analyzer/app.py deleted file mode 100644 index 7fb051bb590ac3a937ee7ea3a2938d71820c23f1..0000000000000000000000000000000000000000 --- a/spaces/AISuperheroes/01ST-CSV-Dataset-Analyzer/app.py +++ /dev/null @@ -1,83 +0,0 @@ -import streamlit as st -import pandas as pd -import traceback -import sys - -from st_aggrid import AgGrid -from st_aggrid.grid_options_builder import GridOptionsBuilder -from st_aggrid.shared import JsCode -from download import download_button -from st_aggrid import GridUpdateMode, DataReturnMode - -# Page config is set once with icon title and display style. Wide mode since we want screen real estate for wide CSV files -st.set_page_config(page_icon="📝", page_title="📝CSV Data Analyzer📊", layout="wide") - -# Style -def _max_width_(): - max_width_str = f"max-width: 1800px;" - st.markdown( - f""" - - """, - unsafe_allow_html=True, - ) - -# Title Bar with Images and Icons -col1, col2, col3 = st.columns([1,6,1]) -with col1: - st.image("https://cdnb.artstation.com/p/assets/images/images/054/910/875/large/aaron-wacker-cyberpunk-computer-brain-design.jpg?1665656558",width=128,) -with col2: - st.title("📝 CSV Data Analyzer 📊") -with col3: - st.image("https://cdna.artstation.com/p/assets/images/images/054/910/878/large/aaron-wacker-cyberpunk-computer-devices-iot.jpg?1665656564",width=128,) - -# Upload -c29, c30, c31 = st.columns([1, 6, 1]) -with c30: - uploaded_file = st.file_uploader("", key="1", help="To activate 'wide mode', go to the menu > Settings > turn on 'wide mode'",) - if uploaded_file is not None: - file_container = st.expander("Check your uploaded .csv") - #try: - shows = pd.read_csv(uploaded_file) - #except: - # print(sys.exc_info()[2]) - - uploaded_file.seek(0) - file_container.write(shows) - else: - st.info(f"""⬆️Upload a 📝.CSV file. Examples: [Chatbot](https://huggingface.co/datasets/awacke1/Carddata.csv) [Mindfulness](https://huggingface.co/datasets/awacke1/MindfulStory.csv) [Wikipedia](https://huggingface.co/datasets/awacke1/WikipediaSearch)""") - st.stop() - -# DisplayGrid -gb = GridOptionsBuilder.from_dataframe(shows) -gb.configure_default_column(enablePivot=True, enableValue=True, enableRowGroup=True) -gb.configure_selection(selection_mode="multiple", use_checkbox=True) -gb.configure_side_bar() -gridOptions = gb.build() -st.success(f"""💡 Tip! Hold shift key when selecting rows to select multiple rows at once.""") -response = AgGrid( - shows, - gridOptions=gridOptions, - enable_enterprise_modules=True, - update_mode=GridUpdateMode.MODEL_CHANGED, - data_return_mode=DataReturnMode.FILTERED_AND_SORTED, - fit_columns_on_grid_load=False, -) - -# Filters -df = pd.DataFrame(response["selected_rows"]) -st.subheader("Filtered data will appear below 📊 ") -st.text("") -st.table(df) -st.text("") - -# Download -c29, c30, c31 = st.columns([1, 1, 2]) -with c29: - CSVButton = download_button(df,"Dataset.csv","Download CSV file",) -with c30: - CSVButton = download_button(df,"Dataset.txt","Download TXT file",) \ No newline at end of file diff --git a/spaces/AIZero2HeroBootcamp/Memory/README.md b/spaces/AIZero2HeroBootcamp/Memory/README.md deleted file mode 100644 index 7c27175f50e0bf2114a1296a27d87371bd76e7f5..0000000000000000000000000000000000000000 --- a/spaces/AIZero2HeroBootcamp/Memory/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Memory -emoji: 📚 -colorFrom: pink -colorTo: indigo -sdk: streamlit -sdk_version: 1.21.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/Acapellas/vocalinstrumentalremover/app.py b/spaces/Acapellas/vocalinstrumentalremover/app.py deleted file mode 100644 index 84f0f0b817b0b756f873ae82f56ac5e8e9f18a4d..0000000000000000000000000000000000000000 --- a/spaces/Acapellas/vocalinstrumentalremover/app.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -import gradio as gr -from scipy.io.wavfile import write - - -def inference(audio): - os.makedirs("out", exist_ok=True) - write('test.wav', audio[0], audio[1]) - os.system("python3 -m demucs.separate -n htdemucs --two-stems=vocals -d cpu test.wav -o out") - return "./out/htdemucs/test/vocals.wav","./out/htdemucs/test/no_vocals.wav" - -title = "" -description = "" -article = "" - -examples=[['test.mp3']] -gr.Interface( - inference, - gr.Audio(type="numpy", label="Input"), - [gr.Audio(type="filepath", label="Vocals"),gr.Audio(type="filepath", label="No Vocals / Instrumental")], - title=title, - description=description, - article=article, - examples=examples - ).launch(enable_queue=True,debug=True) \ No newline at end of file diff --git a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridtable/input/TapCell.js b/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridtable/input/TapCell.js deleted file mode 100644 index dd9f63fb44c3350e5e7af506a9677d3b447a6ea8..0000000000000000000000000000000000000000 --- a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridtable/input/TapCell.js +++ /dev/null @@ -1,20 +0,0 @@ -import Tap from '../../tap/Tap.js'; -import EmitCellEvent from './EmitCellEvent.js'; - -const GetValue = Phaser.Utils.Objects.GetValue; - -var TapCell = function (table, tableConfig) { - var tapConfig = GetValue(tableConfig, 'tap', undefined); - if (tapConfig === false) { - return; - } - - table._tap = new Tap(table, tapConfig); - table._tap - .on('tap', function (tap, gameObject, lastPointer) { - var eventName = `cell.${tap.tapsCount}tap` - EmitCellEvent(this.eventEmitter, eventName, tap.gameObject, tap.worldX, tap.worldY, lastPointer); - }, this) -}; - -export default TapCell; \ No newline at end of file diff --git a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/menu/Menu.d.ts b/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/menu/Menu.d.ts deleted file mode 100644 index 5a662544ac3e9b47c29e781eff9d495ebb725345..0000000000000000000000000000000000000000 --- a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/menu/Menu.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -// import * as Phaser from 'phaser'; -import Buttons from '../buttons/Buttons'; - - -export default Menu; - -declare namespace Menu { - - type EaseConfigTypes = number | - { - duration?: number, - orientation?: 0 | 1 | 'x' | 'y' | 'h' | 'v', - ease?: string - } - - type ExpandEventTypes = 'button.click' | 'button.over'; - - type SubMenuSideTypes = 0 | 1 | 2 | 3 | 'right' | 'down' | 'left' | 'up'; - - interface IConfig extends Buttons.IConfig { - items: any[], - - createBackgroundCallback?: (items: any[]) => Phaser.GameObjects.GameObject, - - createBackgroundCallbackScope?: object, - - createButtonCallback?: (item: any, index: number, items: any[]) => Phaser.GameObjects.GameObject, - - createButtonCallbackScope?: object, - - easeIn?: EaseConfigTypes, - easeOut?: EaseConfigTypes, - - expandEvent?: ExpandEventTypes, - - subMenuSide?: SubMenuSideTypes, - } -} - -declare class Menu extends Buttons { - constructor( - scene: Phaser.Scene, - config?: Menu.IConfig - ); - - collapse(): this; - - collapseSubMenu(): this; -} \ No newline at end of file diff --git "a/spaces/Ameaou/academic-chatgpt3.1/crazy_functions/\344\273\243\347\240\201\351\207\215\345\206\231\344\270\272\345\205\250\350\213\261\346\226\207_\345\244\232\347\272\277\347\250\213.py" "b/spaces/Ameaou/academic-chatgpt3.1/crazy_functions/\344\273\243\347\240\201\351\207\215\345\206\231\344\270\272\345\205\250\350\213\261\346\226\207_\345\244\232\347\272\277\347\250\213.py" deleted file mode 100644 index e57f80f1d45bd3ec23837253848f7b32a5ccd751..0000000000000000000000000000000000000000 --- "a/spaces/Ameaou/academic-chatgpt3.1/crazy_functions/\344\273\243\347\240\201\351\207\215\345\206\231\344\270\272\345\205\250\350\213\261\346\226\207_\345\244\232\347\272\277\347\250\213.py" +++ /dev/null @@ -1,138 +0,0 @@ -import threading -from request_llm.bridge_all import predict_no_ui_long_connection -from toolbox import update_ui -from toolbox import CatchException, write_results_to_file, report_execption -from .crazy_utils import breakdown_txt_to_satisfy_token_limit - -def extract_code_block_carefully(txt): - splitted = txt.split('```') - n_code_block_seg = len(splitted) - 1 - if n_code_block_seg <= 1: return txt - # 剩下的情况都开头除去 ``` 结尾除去一次 ``` - txt_out = '```'.join(splitted[1:-1]) - return txt_out - - - -def break_txt_into_half_at_some_linebreak(txt): - lines = txt.split('\n') - n_lines = len(lines) - pre = lines[:(n_lines//2)] - post = lines[(n_lines//2):] - return "\n".join(pre), "\n".join(post) - - -@CatchException -def 全项目切换英文(txt, llm_kwargs, plugin_kwargs, chatbot, history, sys_prompt, web_port): - # 第1步:清空历史,以免输入溢出 - history = [] - - # 第2步:尝试导入依赖,如果缺少依赖,则给出安装建议 - try: - import tiktoken - except: - report_execption(chatbot, history, - a = f"解析项目: {txt}", - b = f"导入软件依赖失败。使用该模块需要额外依赖,安装方法```pip install --upgrade tiktoken```。") - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - return - - # 第3步:集合文件 - import time, glob, os, shutil, re - os.makedirs('gpt_log/generated_english_version', exist_ok=True) - os.makedirs('gpt_log/generated_english_version/crazy_functions', exist_ok=True) - file_manifest = [f for f in glob.glob('./*.py') if ('test_project' not in f) and ('gpt_log' not in f)] + \ - [f for f in glob.glob('./crazy_functions/*.py') if ('test_project' not in f) and ('gpt_log' not in f)] - # file_manifest = ['./toolbox.py'] - i_say_show_user_buffer = [] - - # 第4步:随便显示点什么防止卡顿的感觉 - for index, fp in enumerate(file_manifest): - # if 'test_project' in fp: continue - with open(fp, 'r', encoding='utf-8', errors='replace') as f: - file_content = f.read() - i_say_show_user =f'[{index}/{len(file_manifest)}] 接下来请将以下代码中包含的所有中文转化为英文,只输出转化后的英文代码,请用代码块输出代码: {os.path.abspath(fp)}' - i_say_show_user_buffer.append(i_say_show_user) - chatbot.append((i_say_show_user, "[Local Message] 等待多线程操作,中间过程不予显示.")) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - - - # 第5步:Token限制下的截断与处理 - MAX_TOKEN = 3000 - from request_llm.bridge_all import model_info - enc = model_info["gpt-3.5-turbo"]['tokenizer'] - def get_token_fn(txt): return len(enc.encode(txt, disallowed_special=())) - - - # 第6步:任务函数 - mutable_return = [None for _ in file_manifest] - observe_window = [[""] for _ in file_manifest] - def thread_worker(fp,index): - if index > 10: - time.sleep(60) - print('Openai 限制免费用户每分钟20次请求,降低请求频率中。') - with open(fp, 'r', encoding='utf-8', errors='replace') as f: - file_content = f.read() - i_say_template = lambda fp, file_content: f'接下来请将以下代码中包含的所有中文转化为英文,只输出代码,文件名是{fp},文件代码是 ```{file_content}```' - try: - gpt_say = "" - # 分解代码文件 - file_content_breakdown = breakdown_txt_to_satisfy_token_limit(file_content, get_token_fn, MAX_TOKEN) - for file_content_partial in file_content_breakdown: - i_say = i_say_template(fp, file_content_partial) - # # ** gpt request ** - gpt_say_partial = predict_no_ui_long_connection(inputs=i_say, llm_kwargs=llm_kwargs, history=[], sys_prompt=sys_prompt, observe_window=observe_window[index]) - gpt_say_partial = extract_code_block_carefully(gpt_say_partial) - gpt_say += gpt_say_partial - mutable_return[index] = gpt_say - except ConnectionAbortedError as token_exceed_err: - print('至少一个线程任务Token溢出而失败', e) - except Exception as e: - print('至少一个线程任务意外失败', e) - - # 第7步:所有线程同时开始执行任务函数 - handles = [threading.Thread(target=thread_worker, args=(fp,index)) for index, fp in enumerate(file_manifest)] - for h in handles: - h.daemon = True - h.start() - chatbot.append(('开始了吗?', f'多线程操作已经开始')) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - - # 第8步:循环轮询各个线程是否执行完毕 - cnt = 0 - while True: - cnt += 1 - time.sleep(0.2) - th_alive = [h.is_alive() for h in handles] - if not any(th_alive): break - # 更好的UI视觉效果 - observe_win = [] - for thread_index, alive in enumerate(th_alive): - observe_win.append("[ ..."+observe_window[thread_index][0][-60:].replace('\n','').replace('```','...').replace(' ','.').replace('
    ','.....').replace('$','.')+"... ]") - stat = [f'执行中: {obs}\n\n' if alive else '已完成\n\n' for alive, obs in zip(th_alive, observe_win)] - stat_str = ''.join(stat) - chatbot[-1] = (chatbot[-1][0], f'多线程操作已经开始,完成情况: \n\n{stat_str}' + ''.join(['.']*(cnt%10+1))) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - - # 第9步:把结果写入文件 - for index, h in enumerate(handles): - h.join() # 这里其实不需要join了,肯定已经都结束了 - fp = file_manifest[index] - gpt_say = mutable_return[index] - i_say_show_user = i_say_show_user_buffer[index] - - where_to_relocate = f'gpt_log/generated_english_version/{fp}' - if gpt_say is not None: - with open(where_to_relocate, 'w+', encoding='utf-8') as f: - f.write(gpt_say) - else: # 失败 - shutil.copyfile(file_manifest[index], where_to_relocate) - chatbot.append((i_say_show_user, f'[Local Message] 已完成{os.path.abspath(fp)}的转化,\n\n存入{os.path.abspath(where_to_relocate)}')) - history.append(i_say_show_user); history.append(gpt_say) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - time.sleep(1) - - # 第10步:备份一个文件 - res = write_results_to_file(history) - chatbot.append(("生成一份任务执行报告", res)) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 diff --git a/spaces/Amrrs/DragGan-Inversion/PTI/models/e4e/encoders/model_irse.py b/spaces/Amrrs/DragGan-Inversion/PTI/models/e4e/encoders/model_irse.py deleted file mode 100644 index 976ce2c61104efdc6b0015d895830346dd01bc10..0000000000000000000000000000000000000000 --- a/spaces/Amrrs/DragGan-Inversion/PTI/models/e4e/encoders/model_irse.py +++ /dev/null @@ -1,84 +0,0 @@ -from torch.nn import Linear, Conv2d, BatchNorm1d, BatchNorm2d, PReLU, Dropout, Sequential, Module -from encoder4editing.models.encoders.helpers import get_blocks, Flatten, bottleneck_IR, bottleneck_IR_SE, l2_norm - -""" -Modified Backbone implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch) -""" - - -class Backbone(Module): - def __init__(self, input_size, num_layers, mode='ir', drop_ratio=0.4, affine=True): - super(Backbone, self).__init__() - assert input_size in [112, 224], "input_size should be 112 or 224" - assert num_layers in [50, 100, 152], "num_layers should be 50, 100 or 152" - assert mode in ['ir', 'ir_se'], "mode should be ir or ir_se" - blocks = get_blocks(num_layers) - if mode == 'ir': - unit_module = bottleneck_IR - elif mode == 'ir_se': - unit_module = bottleneck_IR_SE - self.input_layer = Sequential(Conv2d(3, 64, (3, 3), 1, 1, bias=False), - BatchNorm2d(64), - PReLU(64)) - if input_size == 112: - self.output_layer = Sequential(BatchNorm2d(512), - Dropout(drop_ratio), - Flatten(), - Linear(512 * 7 * 7, 512), - BatchNorm1d(512, affine=affine)) - else: - self.output_layer = Sequential(BatchNorm2d(512), - Dropout(drop_ratio), - Flatten(), - Linear(512 * 14 * 14, 512), - BatchNorm1d(512, affine=affine)) - - modules = [] - for block in blocks: - for bottleneck in block: - modules.append(unit_module(bottleneck.in_channel, - bottleneck.depth, - bottleneck.stride)) - self.body = Sequential(*modules) - - def forward(self, x): - x = self.input_layer(x) - x = self.body(x) - x = self.output_layer(x) - return l2_norm(x) - - -def IR_50(input_size): - """Constructs a ir-50 model.""" - model = Backbone(input_size, num_layers=50, mode='ir', drop_ratio=0.4, affine=False) - return model - - -def IR_101(input_size): - """Constructs a ir-101 model.""" - model = Backbone(input_size, num_layers=100, mode='ir', drop_ratio=0.4, affine=False) - return model - - -def IR_152(input_size): - """Constructs a ir-152 model.""" - model = Backbone(input_size, num_layers=152, mode='ir', drop_ratio=0.4, affine=False) - return model - - -def IR_SE_50(input_size): - """Constructs a ir_se-50 model.""" - model = Backbone(input_size, num_layers=50, mode='ir_se', drop_ratio=0.4, affine=False) - return model - - -def IR_SE_101(input_size): - """Constructs a ir_se-101 model.""" - model = Backbone(input_size, num_layers=100, mode='ir_se', drop_ratio=0.4, affine=False) - return model - - -def IR_SE_152(input_size): - """Constructs a ir_se-152 model.""" - model = Backbone(input_size, num_layers=152, mode='ir_se', drop_ratio=0.4, affine=False) - return model diff --git a/spaces/Amrrs/DragGan-Inversion/stylegan_human/pti/pti_configs/hyperparameters.py b/spaces/Amrrs/DragGan-Inversion/stylegan_human/pti/pti_configs/hyperparameters.py deleted file mode 100644 index ca3a22302a7c5b31a6aa15492a860aa367776e4b..0000000000000000000000000000000000000000 --- a/spaces/Amrrs/DragGan-Inversion/stylegan_human/pti/pti_configs/hyperparameters.py +++ /dev/null @@ -1,28 +0,0 @@ -# Architechture -lpips_type = 'alex' -first_inv_type = 'w+' # 'w+' -optim_type = 'adam' - -# Locality regularization -latent_ball_num_of_samples = 1 -locality_regularization_interval = 1 -use_locality_regularization = False -regulizer_l2_lambda = 0.1 -regulizer_lpips_lambda = 0.1 -regulizer_alpha = 30 - -# Loss -pt_l2_lambda = 1 -pt_lpips_lambda = 1 - -# Steps -LPIPS_value_threshold = 0.04 -max_pti_steps = 350 -first_inv_steps = 450 -max_images_to_invert = 30 - -# Optimization -pti_learning_rate = 5e-4 -first_inv_lr = 8e-3 -train_batch_size = 1 -use_last_w_pivots = False diff --git a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py b/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py deleted file mode 100644 index e1688426e6365b2194c90dce7b2c1e00945fe04a..0000000000000000000000000000000000000000 --- a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py +++ /dev/null @@ -1,473 +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. - -import warnings -from functools import partial -from typing import Dict, List, Optional, Union - -import jax -import jax.numpy as jnp -import numpy as np -from flax.core.frozen_dict import FrozenDict -from flax.jax_utils import unreplicate -from flax.training.common_utils import shard -from packaging import version -from PIL import Image -from transformers import CLIPImageProcessor, CLIPTokenizer, FlaxCLIPTextModel - -from ...models import FlaxAutoencoderKL, FlaxUNet2DConditionModel -from ...schedulers import ( - FlaxDDIMScheduler, - FlaxDPMSolverMultistepScheduler, - FlaxLMSDiscreteScheduler, - FlaxPNDMScheduler, -) -from ...utils import deprecate, logging, replace_example_docstring -from ..pipeline_flax_utils import FlaxDiffusionPipeline -from . import FlaxStableDiffusionPipelineOutput -from .safety_checker_flax import FlaxStableDiffusionSafetyChecker - - -logger = logging.get_logger(__name__) # pylint: disable=invalid-name - -# Set to True to use python for loop instead of jax.fori_loop for easier debugging -DEBUG = False - -EXAMPLE_DOC_STRING = """ - Examples: - ```py - >>> import jax - >>> import numpy as np - >>> from flax.jax_utils import replicate - >>> from flax.training.common_utils import shard - - >>> from diffusers import FlaxStableDiffusionPipeline - - >>> pipeline, params = FlaxStableDiffusionPipeline.from_pretrained( - ... "runwayml/stable-diffusion-v1-5", revision="bf16", dtype=jax.numpy.bfloat16 - ... ) - - >>> prompt = "a photo of an astronaut riding a horse on mars" - - >>> prng_seed = jax.random.PRNGKey(0) - >>> num_inference_steps = 50 - - >>> num_samples = jax.device_count() - >>> prompt = num_samples * [prompt] - >>> prompt_ids = pipeline.prepare_inputs(prompt) - # shard inputs and rng - - >>> params = replicate(params) - >>> prng_seed = jax.random.split(prng_seed, jax.device_count()) - >>> prompt_ids = shard(prompt_ids) - - >>> images = pipeline(prompt_ids, params, prng_seed, num_inference_steps, jit=True).images - >>> images = pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) + images.shape[-3:]))) - ``` -""" - - -class FlaxStableDiffusionPipeline(FlaxDiffusionPipeline): - r""" - Flax-based pipeline for text-to-image generation using Stable Diffusion. - - This model inherits from [`FlaxDiffusionPipeline`]. Check the superclass documentation for the generic methods - implemented for all pipelines (downloading, saving, running on a particular device, etc.). - - Args: - vae ([`FlaxAutoencoderKL`]): - Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. - text_encoder ([`~transformers.FlaxCLIPTextModel`]): - Frozen text-encoder ([clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14)). - tokenizer ([`~transformers.CLIPTokenizer`]): - A `CLIPTokenizer` to tokenize text. - unet ([`FlaxUNet2DConditionModel`]): - A `FlaxUNet2DConditionModel` to denoise the encoded image latents. - scheduler ([`SchedulerMixin`]): - A scheduler to be used in combination with `unet` to denoise the encoded image latents. Can be one of - [`FlaxDDIMScheduler`], [`FlaxLMSDiscreteScheduler`], [`FlaxPNDMScheduler`], or - [`FlaxDPMSolverMultistepScheduler`]. - safety_checker ([`FlaxStableDiffusionSafetyChecker`]): - 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 ([`~transformers.CLIPImageProcessor`]): - A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`. - """ - - def __init__( - self, - vae: FlaxAutoencoderKL, - text_encoder: FlaxCLIPTextModel, - tokenizer: CLIPTokenizer, - unet: FlaxUNet2DConditionModel, - scheduler: Union[ - FlaxDDIMScheduler, FlaxPNDMScheduler, FlaxLMSDiscreteScheduler, FlaxDPMSolverMultistepScheduler - ], - safety_checker: FlaxStableDiffusionSafetyChecker, - feature_extractor: CLIPImageProcessor, - dtype: jnp.dtype = jnp.float32, - ): - super().__init__() - self.dtype = dtype - - if safety_checker is None: - 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 ." - ) - - 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, - ) - self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) - - def prepare_inputs(self, prompt: Union[str, List[str]]): - if not isinstance(prompt, (str, list)): - raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}") - - text_input = self.tokenizer( - prompt, - padding="max_length", - max_length=self.tokenizer.model_max_length, - truncation=True, - return_tensors="np", - ) - return text_input.input_ids - - def _get_has_nsfw_concepts(self, features, params): - has_nsfw_concepts = self.safety_checker(features, params) - return has_nsfw_concepts - - def _run_safety_checker(self, images, safety_model_params, jit=False): - # safety_model_params should already be replicated when jit is True - pil_images = [Image.fromarray(image) for image in images] - features = self.feature_extractor(pil_images, return_tensors="np").pixel_values - - if jit: - features = shard(features) - has_nsfw_concepts = _p_get_has_nsfw_concepts(self, features, safety_model_params) - has_nsfw_concepts = unshard(has_nsfw_concepts) - safety_model_params = unreplicate(safety_model_params) - else: - has_nsfw_concepts = self._get_has_nsfw_concepts(features, safety_model_params) - - images_was_copied = False - for idx, has_nsfw_concept in enumerate(has_nsfw_concepts): - if has_nsfw_concept: - if not images_was_copied: - images_was_copied = True - images = images.copy() - - images[idx] = np.zeros(images[idx].shape, dtype=np.uint8) # black image - - if any(has_nsfw_concepts): - warnings.warn( - "Potential NSFW content was detected in one or more images. A black image will be returned" - " instead. Try again with a different prompt and/or seed." - ) - - return images, has_nsfw_concepts - - def _generate( - self, - prompt_ids: jnp.array, - params: Union[Dict, FrozenDict], - prng_seed: jax.random.KeyArray, - num_inference_steps: int, - height: int, - width: int, - guidance_scale: float, - latents: Optional[jnp.array] = None, - neg_prompt_ids: Optional[jnp.array] = None, - ): - 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}.") - - # get prompt text embeddings - prompt_embeds = self.text_encoder(prompt_ids, params=params["text_encoder"])[0] - - # TODO: currently it is assumed `do_classifier_free_guidance = guidance_scale > 1.0` - # implement this conditional `do_classifier_free_guidance = guidance_scale > 1.0` - batch_size = prompt_ids.shape[0] - - max_length = prompt_ids.shape[-1] - - if neg_prompt_ids is None: - uncond_input = self.tokenizer( - [""] * batch_size, padding="max_length", max_length=max_length, return_tensors="np" - ).input_ids - else: - uncond_input = neg_prompt_ids - negative_prompt_embeds = self.text_encoder(uncond_input, params=params["text_encoder"])[0] - context = jnp.concatenate([negative_prompt_embeds, prompt_embeds]) - - # Ensure model output will be `float32` before going into the scheduler - guidance_scale = jnp.array([guidance_scale], dtype=jnp.float32) - - latents_shape = ( - batch_size, - self.unet.config.in_channels, - height // self.vae_scale_factor, - width // self.vae_scale_factor, - ) - if latents is None: - latents = jax.random.normal(prng_seed, shape=latents_shape, dtype=jnp.float32) - else: - if latents.shape != latents_shape: - raise ValueError(f"Unexpected latents shape, got {latents.shape}, expected {latents_shape}") - - def loop_body(step, args): - latents, scheduler_state = args - # 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 - latents_input = jnp.concatenate([latents] * 2) - - t = jnp.array(scheduler_state.timesteps, dtype=jnp.int32)[step] - timestep = jnp.broadcast_to(t, latents_input.shape[0]) - - latents_input = self.scheduler.scale_model_input(scheduler_state, latents_input, t) - - # predict the noise residual - noise_pred = self.unet.apply( - {"params": params["unet"]}, - jnp.array(latents_input), - jnp.array(timestep, dtype=jnp.int32), - encoder_hidden_states=context, - ).sample - # perform guidance - noise_pred_uncond, noise_prediction_text = jnp.split(noise_pred, 2, axis=0) - noise_pred = noise_pred_uncond + guidance_scale * (noise_prediction_text - noise_pred_uncond) - - # compute the previous noisy sample x_t -> x_t-1 - latents, scheduler_state = self.scheduler.step(scheduler_state, noise_pred, t, latents).to_tuple() - return latents, scheduler_state - - scheduler_state = self.scheduler.set_timesteps( - params["scheduler"], num_inference_steps=num_inference_steps, shape=latents.shape - ) - - # scale the initial noise by the standard deviation required by the scheduler - latents = latents * params["scheduler"].init_noise_sigma - - if DEBUG: - # run with python for loop - for i in range(num_inference_steps): - latents, scheduler_state = loop_body(i, (latents, scheduler_state)) - else: - latents, _ = jax.lax.fori_loop(0, num_inference_steps, loop_body, (latents, scheduler_state)) - - # scale and decode the image latents with vae - latents = 1 / self.vae.config.scaling_factor * latents - image = self.vae.apply({"params": params["vae"]}, latents, method=self.vae.decode).sample - - image = (image / 2 + 0.5).clip(0, 1).transpose(0, 2, 3, 1) - return image - - @replace_example_docstring(EXAMPLE_DOC_STRING) - def __call__( - self, - prompt_ids: jnp.array, - params: Union[Dict, FrozenDict], - prng_seed: jax.random.KeyArray, - num_inference_steps: int = 50, - height: Optional[int] = None, - width: Optional[int] = None, - guidance_scale: Union[float, jnp.array] = 7.5, - latents: jnp.array = None, - neg_prompt_ids: jnp.array = None, - return_dict: bool = True, - jit: bool = False, - ): - r""" - The call function to the pipeline for generation. - - Args: - prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide image generation. - 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 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`. - latents (`jnp.array`, *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 - array is generated by sampling using the supplied random `generator`. - jit (`bool`, defaults to `False`): - Whether to run `pmap` versions of the generation and safety scoring functions. - - - - This argument exists because `__call__` is not yet end-to-end pmap-able. It will be removed in a - future release. - - - - return_dict (`bool`, *optional*, defaults to `True`): - Whether or not to return a [`~pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput`] instead of - a plain tuple. - - Examples: - - Returns: - [`~pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput`] or `tuple`: - If `return_dict` is `True`, [`~pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput`] 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. - """ - # 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 isinstance(guidance_scale, float): - # Convert to a tensor so each device gets a copy. Follow the prompt_ids for - # shape information, as they may be sharded (when `jit` is `True`), or not. - guidance_scale = jnp.array([guidance_scale] * prompt_ids.shape[0]) - if len(prompt_ids.shape) > 2: - # Assume sharded - guidance_scale = guidance_scale[:, None] - - if jit: - images = _p_generate( - self, - prompt_ids, - params, - prng_seed, - num_inference_steps, - height, - width, - guidance_scale, - latents, - neg_prompt_ids, - ) - else: - images = self._generate( - prompt_ids, - params, - prng_seed, - num_inference_steps, - height, - width, - guidance_scale, - latents, - neg_prompt_ids, - ) - - if self.safety_checker is not None: - safety_params = params["safety_checker"] - images_uint8_casted = (images * 255).round().astype("uint8") - num_devices, batch_size = images.shape[:2] - - images_uint8_casted = np.asarray(images_uint8_casted).reshape(num_devices * batch_size, height, width, 3) - images_uint8_casted, has_nsfw_concept = self._run_safety_checker(images_uint8_casted, safety_params, jit) - images = np.asarray(images) - - # block images - if any(has_nsfw_concept): - for i, is_nsfw in enumerate(has_nsfw_concept): - if is_nsfw: - images[i] = np.asarray(images_uint8_casted[i]) - - images = images.reshape(num_devices, batch_size, height, width, 3) - else: - images = np.asarray(images) - has_nsfw_concept = False - - if not return_dict: - return (images, has_nsfw_concept) - - return FlaxStableDiffusionPipelineOutput(images=images, nsfw_content_detected=has_nsfw_concept) - - -# Static argnums are pipe, num_inference_steps, height, width. A change would trigger recompilation. -# Non-static args are (sharded) input tensors mapped over their first dimension (hence, `0`). -@partial( - jax.pmap, - in_axes=(None, 0, 0, 0, None, None, None, 0, 0, 0), - static_broadcasted_argnums=(0, 4, 5, 6), -) -def _p_generate( - pipe, - prompt_ids, - params, - prng_seed, - num_inference_steps, - height, - width, - guidance_scale, - latents, - neg_prompt_ids, -): - return pipe._generate( - prompt_ids, - params, - prng_seed, - num_inference_steps, - height, - width, - guidance_scale, - latents, - neg_prompt_ids, - ) - - -@partial(jax.pmap, static_broadcasted_argnums=(0,)) -def _p_get_has_nsfw_concepts(pipe, features, params): - return pipe._get_has_nsfw_concepts(features, params) - - -def unshard(x: jnp.ndarray): - # einops.rearrange(x, 'd b ... -> (d b) ...') - num_devices, batch_size = x.shape[:2] - rest = x.shape[2:] - return x.reshape(num_devices * batch_size, *rest) diff --git a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/unidiffuser/__init__.py b/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/unidiffuser/__init__.py deleted file mode 100644 index a774e3274030153d20618024b8c2bc6385ef367a..0000000000000000000000000000000000000000 --- a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/unidiffuser/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from ...utils import ( - OptionalDependencyNotAvailable, - is_torch_available, - is_transformers_available, - is_transformers_version, -) - - -try: - if not (is_transformers_available() and is_torch_available()): - raise OptionalDependencyNotAvailable() -except OptionalDependencyNotAvailable: - from ...utils.dummy_torch_and_transformers_objects import ( - ImageTextPipelineOutput, - UniDiffuserPipeline, - ) -else: - from .modeling_text_decoder import UniDiffuserTextDecoder - from .modeling_uvit import UniDiffuserModel, UTransformer2DModel - from .pipeline_unidiffuser import ImageTextPipelineOutput, UniDiffuserPipeline diff --git a/spaces/Andy1621/uniformer_image_detection/configs/atss/README.md b/spaces/Andy1621/uniformer_image_detection/configs/atss/README.md deleted file mode 100644 index 4ba915002576080f1fc1b2e007420d88aeb94187..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/configs/atss/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Bridging the Gap Between Anchor-based and Anchor-free Detection via Adaptive Training Sample Selection - -## Introduction - -[ALGORITHM] - -```latex -@article{zhang2019bridging, - title = {Bridging the Gap Between Anchor-based and Anchor-free Detection via Adaptive Training Sample Selection}, - author = {Zhang, Shifeng and Chi, Cheng and Yao, Yongqiang and Lei, Zhen and Li, Stan Z.}, - journal = {arXiv preprint arXiv:1912.02424}, - year = {2019} -} -``` - -## Results and Models - -| Backbone | Style | Lr schd | Mem (GB) | Inf time (fps) | box AP | Config | Download | -|:---------:|:-------:|:-------:|:--------:|:--------------:|:------:|:------:|:--------:| -| R-50 | pytorch | 1x | 3.7 | 19.7 | 39.4 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/atss/atss_r50_fpn_1x_coco.py) | [model](http://download.openmmlab.com/mmdetection/v2.0/atss/atss_r50_fpn_1x_coco/atss_r50_fpn_1x_coco_20200209-985f7bd0.pth) | [log](http://download.openmmlab.com/mmdetection/v2.0/atss/atss_r50_fpn_1x_coco/atss_r50_fpn_1x_coco_20200209_102539.log.json) | -| R-101 | pytorch | 1x | 5.6 | 12.3 | 41.5 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/atss/atss_r101_fpn_1x_coco.py) | [model](http://download.openmmlab.com/mmdetection/v2.0/atss/atss_r101_fpn_1x_coco/atss_r101_fpn_1x_20200825-dfcadd6f.pth) | [log](http://download.openmmlab.com/mmdetection/v2.0/atss/atss_r101_fpn_1x_coco/atss_r101_fpn_1x_20200825-dfcadd6f.log.json) | diff --git a/spaces/Andy1621/uniformer_image_detection/mmdet/core/post_processing/__init__.py b/spaces/Andy1621/uniformer_image_detection/mmdet/core/post_processing/__init__.py deleted file mode 100644 index 880b3f06609b050aae163b2e38088c1ee4aa0998..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/mmdet/core/post_processing/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -from .bbox_nms import fast_nms, multiclass_nms -from .merge_augs import (merge_aug_bboxes, merge_aug_masks, - merge_aug_proposals, merge_aug_scores) - -__all__ = [ - 'multiclass_nms', 'merge_aug_proposals', 'merge_aug_bboxes', - 'merge_aug_scores', 'merge_aug_masks', 'fast_nms' -] diff --git a/spaces/Andy1621/uniformer_image_detection/mmdet/models/roi_heads/dynamic_roi_head.py b/spaces/Andy1621/uniformer_image_detection/mmdet/models/roi_heads/dynamic_roi_head.py deleted file mode 100644 index 89427a931f45f5a920c0e66fd88058bf9fa05f5c..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/mmdet/models/roi_heads/dynamic_roi_head.py +++ /dev/null @@ -1,154 +0,0 @@ -import numpy as np -import torch - -from mmdet.core import bbox2roi -from mmdet.models.losses import SmoothL1Loss -from ..builder import HEADS -from .standard_roi_head import StandardRoIHead - -EPS = 1e-15 - - -@HEADS.register_module() -class DynamicRoIHead(StandardRoIHead): - """RoI head for `Dynamic R-CNN `_.""" - - def __init__(self, **kwargs): - super(DynamicRoIHead, self).__init__(**kwargs) - assert isinstance(self.bbox_head.loss_bbox, SmoothL1Loss) - # the IoU history of the past `update_iter_interval` iterations - self.iou_history = [] - # the beta history of the past `update_iter_interval` iterations - self.beta_history = [] - - def forward_train(self, - x, - img_metas, - proposal_list, - gt_bboxes, - gt_labels, - gt_bboxes_ignore=None, - gt_masks=None): - """Forward function for training. - - Args: - x (list[Tensor]): list of multi-level img features. - - img_metas (list[dict]): 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 - `mmdet/datasets/pipelines/formatting.py:Collect`. - - proposals (list[Tensors]): list of region proposals. - - 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. - - gt_masks (None | Tensor) : true segmentation masks for each box - used if the architecture supports a segmentation task. - - Returns: - dict[str, Tensor]: a dictionary of loss components - """ - # assign gts and sample proposals - if self.with_bbox or self.with_mask: - num_imgs = len(img_metas) - if gt_bboxes_ignore is None: - gt_bboxes_ignore = [None for _ in range(num_imgs)] - sampling_results = [] - cur_iou = [] - for i in range(num_imgs): - assign_result = self.bbox_assigner.assign( - proposal_list[i], gt_bboxes[i], gt_bboxes_ignore[i], - gt_labels[i]) - sampling_result = self.bbox_sampler.sample( - assign_result, - proposal_list[i], - gt_bboxes[i], - gt_labels[i], - feats=[lvl_feat[i][None] for lvl_feat in x]) - # record the `iou_topk`-th largest IoU in an image - iou_topk = min(self.train_cfg.dynamic_rcnn.iou_topk, - len(assign_result.max_overlaps)) - ious, _ = torch.topk(assign_result.max_overlaps, iou_topk) - cur_iou.append(ious[-1].item()) - sampling_results.append(sampling_result) - # average the current IoUs over images - cur_iou = np.mean(cur_iou) - self.iou_history.append(cur_iou) - - losses = dict() - # bbox head forward and loss - if self.with_bbox: - bbox_results = self._bbox_forward_train(x, sampling_results, - gt_bboxes, gt_labels, - img_metas) - losses.update(bbox_results['loss_bbox']) - - # mask head forward and loss - if self.with_mask: - mask_results = self._mask_forward_train(x, sampling_results, - bbox_results['bbox_feats'], - gt_masks, img_metas) - losses.update(mask_results['loss_mask']) - - # update IoU threshold and SmoothL1 beta - update_iter_interval = self.train_cfg.dynamic_rcnn.update_iter_interval - if len(self.iou_history) % update_iter_interval == 0: - new_iou_thr, new_beta = self.update_hyperparameters() - - return losses - - def _bbox_forward_train(self, x, sampling_results, gt_bboxes, gt_labels, - img_metas): - num_imgs = len(img_metas) - rois = bbox2roi([res.bboxes for res in sampling_results]) - bbox_results = self._bbox_forward(x, rois) - - bbox_targets = self.bbox_head.get_targets(sampling_results, gt_bboxes, - gt_labels, self.train_cfg) - # record the `beta_topk`-th smallest target - # `bbox_targets[2]` and `bbox_targets[3]` stand for bbox_targets - # and bbox_weights, respectively - pos_inds = bbox_targets[3][:, 0].nonzero().squeeze(1) - num_pos = len(pos_inds) - cur_target = bbox_targets[2][pos_inds, :2].abs().mean(dim=1) - beta_topk = min(self.train_cfg.dynamic_rcnn.beta_topk * num_imgs, - num_pos) - cur_target = torch.kthvalue(cur_target, beta_topk)[0].item() - self.beta_history.append(cur_target) - loss_bbox = self.bbox_head.loss(bbox_results['cls_score'], - bbox_results['bbox_pred'], rois, - *bbox_targets) - - bbox_results.update(loss_bbox=loss_bbox) - return bbox_results - - def update_hyperparameters(self): - """Update hyperparameters like IoU thresholds for assigner and beta for - SmoothL1 loss based on the training statistics. - - Returns: - tuple[float]: the updated ``iou_thr`` and ``beta``. - """ - new_iou_thr = max(self.train_cfg.dynamic_rcnn.initial_iou, - np.mean(self.iou_history)) - self.iou_history = [] - self.bbox_assigner.pos_iou_thr = new_iou_thr - self.bbox_assigner.neg_iou_thr = new_iou_thr - self.bbox_assigner.min_pos_iou = new_iou_thr - if (np.median(self.beta_history) < EPS): - # avoid 0 or too small value for new_beta - new_beta = self.bbox_head.loss_bbox.beta - else: - new_beta = min(self.train_cfg.dynamic_rcnn.initial_beta, - np.median(self.beta_history)) - self.beta_history = [] - self.bbox_head.loss_bbox.beta = new_beta - return new_iou_thr, new_beta diff --git a/spaces/Andy1621/uniformer_image_detection/mmdet/models/roi_heads/grid_roi_head.py b/spaces/Andy1621/uniformer_image_detection/mmdet/models/roi_heads/grid_roi_head.py deleted file mode 100644 index 4c52c79863ebaf17bd023382c7e5d4c237b4da77..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/mmdet/models/roi_heads/grid_roi_head.py +++ /dev/null @@ -1,176 +0,0 @@ -import torch - -from mmdet.core import bbox2result, bbox2roi -from ..builder import HEADS, build_head, build_roi_extractor -from .standard_roi_head import StandardRoIHead - - -@HEADS.register_module() -class GridRoIHead(StandardRoIHead): - """Grid roi head for Grid R-CNN. - - https://arxiv.org/abs/1811.12030 - """ - - def __init__(self, grid_roi_extractor, grid_head, **kwargs): - assert grid_head is not None - super(GridRoIHead, self).__init__(**kwargs) - if grid_roi_extractor is not None: - self.grid_roi_extractor = build_roi_extractor(grid_roi_extractor) - self.share_roi_extractor = False - else: - self.share_roi_extractor = True - self.grid_roi_extractor = self.bbox_roi_extractor - self.grid_head = build_head(grid_head) - - def init_weights(self, pretrained): - """Initialize the weights in head. - - Args: - pretrained (str, optional): Path to pre-trained weights. - Defaults to None. - """ - super(GridRoIHead, self).init_weights(pretrained) - self.grid_head.init_weights() - if not self.share_roi_extractor: - self.grid_roi_extractor.init_weights() - - def _random_jitter(self, sampling_results, img_metas, amplitude=0.15): - """Ramdom jitter positive proposals for training.""" - for sampling_result, img_meta in zip(sampling_results, img_metas): - bboxes = sampling_result.pos_bboxes - random_offsets = bboxes.new_empty(bboxes.shape[0], 4).uniform_( - -amplitude, amplitude) - # before jittering - cxcy = (bboxes[:, 2:4] + bboxes[:, :2]) / 2 - wh = (bboxes[:, 2:4] - bboxes[:, :2]).abs() - # after jittering - new_cxcy = cxcy + wh * random_offsets[:, :2] - new_wh = wh * (1 + random_offsets[:, 2:]) - # xywh to xyxy - new_x1y1 = (new_cxcy - new_wh / 2) - new_x2y2 = (new_cxcy + new_wh / 2) - new_bboxes = torch.cat([new_x1y1, new_x2y2], dim=1) - # clip bboxes - max_shape = img_meta['img_shape'] - if max_shape is not None: - new_bboxes[:, 0::2].clamp_(min=0, max=max_shape[1] - 1) - new_bboxes[:, 1::2].clamp_(min=0, max=max_shape[0] - 1) - - sampling_result.pos_bboxes = new_bboxes - return sampling_results - - def forward_dummy(self, x, proposals): - """Dummy forward function.""" - # bbox head - outs = () - rois = bbox2roi([proposals]) - if self.with_bbox: - bbox_results = self._bbox_forward(x, rois) - outs = outs + (bbox_results['cls_score'], - bbox_results['bbox_pred']) - - # grid head - grid_rois = rois[:100] - grid_feats = self.grid_roi_extractor( - x[:self.grid_roi_extractor.num_inputs], grid_rois) - if self.with_shared_head: - grid_feats = self.shared_head(grid_feats) - grid_pred = self.grid_head(grid_feats) - outs = outs + (grid_pred, ) - - # mask head - if self.with_mask: - mask_rois = rois[:100] - mask_results = self._mask_forward(x, mask_rois) - outs = outs + (mask_results['mask_pred'], ) - return outs - - def _bbox_forward_train(self, x, sampling_results, gt_bboxes, gt_labels, - img_metas): - """Run forward function and calculate loss for box head in training.""" - bbox_results = super(GridRoIHead, - self)._bbox_forward_train(x, sampling_results, - gt_bboxes, gt_labels, - img_metas) - - # Grid head forward and loss - sampling_results = self._random_jitter(sampling_results, img_metas) - pos_rois = bbox2roi([res.pos_bboxes for res in sampling_results]) - - # GN in head does not support zero shape input - if pos_rois.shape[0] == 0: - return bbox_results - - grid_feats = self.grid_roi_extractor( - x[:self.grid_roi_extractor.num_inputs], pos_rois) - if self.with_shared_head: - grid_feats = self.shared_head(grid_feats) - # Accelerate training - max_sample_num_grid = self.train_cfg.get('max_num_grid', 192) - sample_idx = torch.randperm( - grid_feats.shape[0])[:min(grid_feats.shape[0], max_sample_num_grid - )] - grid_feats = grid_feats[sample_idx] - - grid_pred = self.grid_head(grid_feats) - - grid_targets = self.grid_head.get_targets(sampling_results, - self.train_cfg) - grid_targets = grid_targets[sample_idx] - - loss_grid = self.grid_head.loss(grid_pred, grid_targets) - - bbox_results['loss_bbox'].update(loss_grid) - return bbox_results - - def simple_test(self, - x, - proposal_list, - img_metas, - proposals=None, - rescale=False): - """Test without augmentation.""" - assert self.with_bbox, 'Bbox head must be implemented.' - - det_bboxes, det_labels = self.simple_test_bboxes( - x, img_metas, proposal_list, self.test_cfg, rescale=False) - # pack rois into bboxes - grid_rois = bbox2roi([det_bbox[:, :4] for det_bbox in det_bboxes]) - if grid_rois.shape[0] != 0: - grid_feats = self.grid_roi_extractor( - x[:len(self.grid_roi_extractor.featmap_strides)], grid_rois) - self.grid_head.test_mode = True - grid_pred = self.grid_head(grid_feats) - # split batch grid head prediction back to each image - num_roi_per_img = tuple(len(det_bbox) for det_bbox in det_bboxes) - grid_pred = { - k: v.split(num_roi_per_img, 0) - for k, v in grid_pred.items() - } - - # apply bbox post-processing to each image individually - bbox_results = [] - num_imgs = len(det_bboxes) - for i in range(num_imgs): - if det_bboxes[i].shape[0] == 0: - bbox_results.append(grid_rois.new_tensor([])) - else: - det_bbox = self.grid_head.get_bboxes( - det_bboxes[i], grid_pred['fused'][i], [img_metas[i]]) - if rescale: - det_bbox[:, :4] /= img_metas[i]['scale_factor'] - bbox_results.append( - bbox2result(det_bbox, det_labels[i], - self.bbox_head.num_classes)) - else: - bbox_results = [ - grid_rois.new_tensor([]) for _ in range(len(det_bboxes)) - ] - - if not self.with_mask: - return bbox_results - else: - segm_results = self.simple_test_mask( - x, img_metas, det_bboxes, det_labels, rescale=rescale) - return list(zip(bbox_results, segm_results)) diff --git a/spaces/Andy1621/uniformer_image_segmentation/configs/apcnet/apcnet_r101-d8_769x769_40k_cityscapes.py b/spaces/Andy1621/uniformer_image_segmentation/configs/apcnet/apcnet_r101-d8_769x769_40k_cityscapes.py deleted file mode 100644 index 5c44ebcaf36075e67208c5f033d1e5f9a78dda4e..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_segmentation/configs/apcnet/apcnet_r101-d8_769x769_40k_cityscapes.py +++ /dev/null @@ -1,2 +0,0 @@ -_base_ = './apcnet_r50-d8_769x769_40k_cityscapes.py' -model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101)) diff --git a/spaces/AnishKumbhar/ChatBot/text-generation-webui-main/extensions/superboogav2/chromadb.py b/spaces/AnishKumbhar/ChatBot/text-generation-webui-main/extensions/superboogav2/chromadb.py deleted file mode 100644 index 0da2d8f90c623b43ecd49b3dcf20919b8e2a1434..0000000000000000000000000000000000000000 --- a/spaces/AnishKumbhar/ChatBot/text-generation-webui-main/extensions/superboogav2/chromadb.py +++ /dev/null @@ -1,376 +0,0 @@ -import threading -import chromadb -import posthog -import torch -import math - -import numpy as np -import extensions.superboogav2.parameters as parameters - -from chromadb.config import Settings -from sentence_transformers import SentenceTransformer - -from modules.logging_colors import logger -from modules.text_generation import encode, decode - -logger.debug('Intercepting all calls to posthog.') -posthog.capture = lambda *args, **kwargs: None - - -class Collecter(): - def __init__(self): - pass - - def add(self, texts: list[str], texts_with_context: list[str], starting_indices: list[int]): - pass - - def get(self, search_strings: list[str], n_results: int) -> list[str]: - pass - - def clear(self): - pass - - -class Embedder(): - def __init__(self): - pass - - def embed(self, text: str) -> list[torch.Tensor]: - pass - -class Info: - def __init__(self, start_index, text_with_context, distance, id): - self.text_with_context = text_with_context - self.start_index = start_index - self.distance = distance - self.id = id - - def calculate_distance(self, other_info): - if parameters.get_new_dist_strategy() == parameters.DIST_MIN_STRATEGY: - # Min - return min(self.distance, other_info.distance) - elif parameters.get_new_dist_strategy() == parameters.DIST_HARMONIC_STRATEGY: - # Harmonic mean - return 2 * (self.distance * other_info.distance) / (self.distance + other_info.distance) - elif parameters.get_new_dist_strategy() == parameters.DIST_GEOMETRIC_STRATEGY: - # Geometric mean - return (self.distance * other_info.distance) ** 0.5 - elif parameters.get_new_dist_strategy() == parameters.DIST_ARITHMETIC_STRATEGY: - # Arithmetic mean - return (self.distance + other_info.distance) / 2 - else: # Min is default - return min(self.distance, other_info.distance) - - def merge_with(self, other_info): - s1 = self.text_with_context - s2 = other_info.text_with_context - s1_start = self.start_index - s2_start = other_info.start_index - - new_dist = self.calculate_distance(other_info) - - if self.should_merge(s1, s2, s1_start, s2_start): - if s1_start <= s2_start: - if s1_start + len(s1) >= s2_start + len(s2): # if s1 completely covers s2 - return Info(s1_start, s1, new_dist, self.id) - else: - overlap = max(0, s1_start + len(s1) - s2_start) - return Info(s1_start, s1 + s2[overlap:], new_dist, self.id) - else: - if s2_start + len(s2) >= s1_start + len(s1): # if s2 completely covers s1 - return Info(s2_start, s2, new_dist, other_info.id) - else: - overlap = max(0, s2_start + len(s2) - s1_start) - return Info(s2_start, s2 + s1[overlap:], new_dist, other_info.id) - - return None - - @staticmethod - def should_merge(s1, s2, s1_start, s2_start): - # Check if s1 and s2 are adjacent or overlapping - s1_end = s1_start + len(s1) - s2_end = s2_start + len(s2) - - return not (s1_end < s2_start or s2_end < s1_start) - -class ChromaCollector(Collecter): - def __init__(self, embedder: Embedder): - super().__init__() - self.chroma_client = chromadb.Client(Settings(anonymized_telemetry=False)) - self.embedder = embedder - self.collection = self.chroma_client.create_collection(name="context", embedding_function=self.embedder.embed) - self.ids = [] - self.id_to_info = {} - self.embeddings_cache = {} - self.lock = threading.Lock() # Locking so the server doesn't break. - - def add(self, texts: list[str], texts_with_context: list[str], starting_indices: list[int], metadatas: list[dict] = None): - with self.lock: - assert metadatas is None or len(metadatas) == len(texts), "metadatas must be None or have the same length as texts" - - if len(texts) == 0: - return - - new_ids = self._get_new_ids(len(texts)) - - (existing_texts, existing_embeddings, existing_ids, existing_metas), \ - (non_existing_texts, non_existing_ids, non_existing_metas) = self._split_texts_by_cache_hit(texts, new_ids, metadatas) - - # If there are any already existing texts, add them all at once. - if existing_texts: - logger.info(f'Adding {len(existing_embeddings)} cached embeddings.') - args = {'embeddings': existing_embeddings, 'documents': existing_texts, 'ids': existing_ids} - if metadatas is not None: - args['metadatas'] = existing_metas - self.collection.add(**args) - - # If there are any non-existing texts, compute their embeddings all at once. Each call to embed has significant overhead. - if non_existing_texts: - non_existing_embeddings = self.embedder.embed(non_existing_texts).tolist() - for text, embedding in zip(non_existing_texts, non_existing_embeddings): - self.embeddings_cache[text] = embedding - - logger.info(f'Adding {len(non_existing_embeddings)} new embeddings.') - args = {'embeddings': non_existing_embeddings, 'documents': non_existing_texts, 'ids': non_existing_ids} - if metadatas is not None: - args['metadatas'] = non_existing_metas - self.collection.add(**args) - - # Create a dictionary that maps each ID to its context and starting index - new_info = { - id_: {'text_with_context': context, 'start_index': start_index} - for id_, context, start_index in zip(new_ids, texts_with_context, starting_indices) - } - - self.id_to_info.update(new_info) - self.ids.extend(new_ids) - - - def _split_texts_by_cache_hit(self, texts: list[str], new_ids: list[str], metadatas: list[dict]): - existing_texts, non_existing_texts = [], [] - existing_embeddings = [] - existing_ids, non_existing_ids = [], [] - existing_metas, non_existing_metas = [], [] - - for i, text in enumerate(texts): - id_ = new_ids[i] - metadata = metadatas[i] if metadatas is not None else None - embedding = self.embeddings_cache.get(text) - if embedding: - existing_texts.append(text) - existing_embeddings.append(embedding) - existing_ids.append(id_) - existing_metas.append(metadata) - else: - non_existing_texts.append(text) - non_existing_ids.append(id_) - non_existing_metas.append(metadata) - - return (existing_texts, existing_embeddings, existing_ids, existing_metas), \ - (non_existing_texts, non_existing_ids, non_existing_metas) - - - def _get_new_ids(self, num_new_ids: int): - if self.ids: - max_existing_id = max(int(id_) for id_ in self.ids) - else: - max_existing_id = -1 - - return [str(i + max_existing_id + 1) for i in range(num_new_ids)] - - - def _find_min_max_start_index(self): - max_index, min_index = 0, float('inf') - for _, val in self.id_to_info.items(): - if val['start_index'] > max_index: - max_index = val['start_index'] - if val['start_index'] < min_index: - min_index = val['start_index'] - return min_index, max_index - - - # NB: Does not make sense to weigh excerpts from different documents. - # But let's say that's the user's problem. Perfect world scenario: - # Apply time weighing to different documents. For each document, then, add - # separate time weighing. - def _apply_sigmoid_time_weighing(self, infos: list[Info], document_len: int, time_steepness: float, time_power: float): - sigmoid = lambda x: 1 / (1 + np.exp(-x)) - - weights = sigmoid(time_steepness * np.linspace(-10, 10, document_len)) - - # Scale to [0,time_power] and shift it up to [1-time_power, 1] - weights = weights - min(weights) - weights = weights * (time_power / max(weights)) - weights = weights + (1 - time_power) - - # Reverse the weights - weights = weights[::-1] - - for info in infos: - index = info.start_index - info.distance *= weights[index] - - - def _filter_outliers_by_median_distance(self, infos: list[Info], significant_level: float): - # Ensure there are infos to filter - if not infos: - return [] - - # Find info with minimum distance - min_info = min(infos, key=lambda x: x.distance) - - # Calculate median distance among infos - median_distance = np.median([inf.distance for inf in infos]) - - # Filter out infos that have a distance significantly greater than the median - filtered_infos = [inf for inf in infos if inf.distance <= significant_level * median_distance] - - # Always include the info with minimum distance - if min_info not in filtered_infos: - filtered_infos.append(min_info) - - return filtered_infos - - - def _merge_infos(self, infos: list[Info]): - merged_infos = [] - current_info = infos[0] - - for next_info in infos[1:]: - merged = current_info.merge_with(next_info) - if merged is not None: - current_info = merged - else: - merged_infos.append(current_info) - current_info = next_info - - merged_infos.append(current_info) - return merged_infos - - - # Main function for retrieving chunks by distance. It performs merging, time weighing, and mean filtering. - def _get_documents_ids_distances(self, search_strings: list[str], n_results: int): - n_results = min(len(self.ids), n_results) - if n_results == 0: - return [], [], [] - - if isinstance(search_strings, str): - search_strings = [search_strings] - - infos = [] - min_start_index, max_start_index = self._find_min_max_start_index() - - for search_string in search_strings: - result = self.collection.query(query_texts=search_string, n_results=math.ceil(n_results / len(search_strings)), include=['distances']) - curr_infos = [Info(start_index=self.id_to_info[id]['start_index'], - text_with_context=self.id_to_info[id]['text_with_context'], - distance=distance, id=id) - for id, distance in zip(result['ids'][0], result['distances'][0])] - - self._apply_sigmoid_time_weighing(infos=curr_infos, document_len=max_start_index - min_start_index + 1, time_steepness=parameters.get_time_steepness(), time_power=parameters.get_time_power()) - curr_infos = self._filter_outliers_by_median_distance(curr_infos, parameters.get_significant_level()) - infos.extend(curr_infos) - - infos.sort(key=lambda x: x.start_index) - infos = self._merge_infos(infos) - - texts_with_context = [inf.text_with_context for inf in infos] - ids = [inf.id for inf in infos] - distances = [inf.distance for inf in infos] - - return texts_with_context, ids, distances - - - # Get chunks by similarity - def get(self, search_strings: list[str], n_results: int) -> list[str]: - with self.lock: - documents, _, _ = self._get_documents_ids_distances(search_strings, n_results) - return documents - - - # Get ids by similarity - def get_ids(self, search_strings: list[str], n_results: int) -> list[str]: - with self.lock: - _, ids, _ = self._get_documents_ids_distances(search_strings, n_results) - return ids - - - # Cutoff token count - def _get_documents_up_to_token_count(self, documents: list[str], max_token_count: int): - # TODO: Move to caller; We add delimiters there which might go over the limit. - current_token_count = 0 - return_documents = [] - - for doc in documents: - doc_tokens = encode(doc)[0] - doc_token_count = len(doc_tokens) - if current_token_count + doc_token_count > max_token_count: - # If adding this document would exceed the max token count, - # truncate the document to fit within the limit. - remaining_tokens = max_token_count - current_token_count - - truncated_doc = decode(doc_tokens[:remaining_tokens], skip_special_tokens=True) - return_documents.append(truncated_doc) - break - else: - return_documents.append(doc) - current_token_count += doc_token_count - - return return_documents - - - # Get chunks by similarity and then sort by ids - def get_sorted_by_ids(self, search_strings: list[str], n_results: int, max_token_count: int) -> list[str]: - with self.lock: - documents, ids, _ = self._get_documents_ids_distances(search_strings, n_results) - sorted_docs = [x for _, x in sorted(zip(ids, documents))] - - return self._get_documents_up_to_token_count(sorted_docs, max_token_count) - - - # Get chunks by similarity and then sort by distance (lowest distance is last). - def get_sorted_by_dist(self, search_strings: list[str], n_results: int, max_token_count: int) -> list[str]: - with self.lock: - documents, _, distances = self._get_documents_ids_distances(search_strings, n_results) - sorted_docs = [doc for doc, _ in sorted(zip(documents, distances), key=lambda x: x[1])] # sorted lowest -> highest - - # If a document is truncated or competely skipped, it would be with high distance. - return_documents = self._get_documents_up_to_token_count(sorted_docs, max_token_count) - return_documents.reverse() # highest -> lowest - - return return_documents - - - def delete(self, ids_to_delete: list[str], where: dict): - with self.lock: - ids_to_delete = self.collection.get(ids=ids_to_delete, where=where)['ids'] - self.collection.delete(ids=ids_to_delete, where=where) - - # Remove the deleted ids from self.ids and self.id_to_info - ids_set = set(ids_to_delete) - self.ids = [id_ for id_ in self.ids if id_ not in ids_set] - for id_ in ids_to_delete: - self.id_to_info.pop(id_, None) - - logger.info(f'Successfully deleted {len(ids_to_delete)} records from chromaDB.') - - - def clear(self): - with self.lock: - self.chroma_client.reset() - self.collection = self.chroma_client.create_collection("context", embedding_function=self.embedder.embed) - self.ids = [] - self.id_to_info = {} - - logger.info('Successfully cleared all records and reset chromaDB.') - - -class SentenceTransformerEmbedder(Embedder): - def __init__(self) -> None: - logger.debug('Creating Sentence Embedder...') - self.model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2") - self.embed = self.model.encode - - -def make_collector(): - return ChromaCollector(SentenceTransformerEmbedder()) \ No newline at end of file diff --git a/spaces/Anonymous-123/ImageNet-Editing/object_removal/TFill/model/stylegan_ops/__init__.py b/spaces/Anonymous-123/ImageNet-Editing/object_removal/TFill/model/stylegan_ops/__init__.py deleted file mode 100644 index d0918d92285955855be89f00096b888ee5597ce3..0000000000000000000000000000000000000000 --- a/spaces/Anonymous-123/ImageNet-Editing/object_removal/TFill/model/stylegan_ops/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .fused_act import FusedLeakyReLU, fused_leaky_relu -from .upfirdn2d import upfirdn2d diff --git a/spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/upfirdn2d.py b/spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/upfirdn2d.py deleted file mode 100644 index c8bb2c3c949eed38a6465ed369fa881538dca010..0000000000000000000000000000000000000000 --- a/spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/upfirdn2d.py +++ /dev/null @@ -1,330 +0,0 @@ -# modified from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py # noqa:E501 - -# Copyright (c) 2021, NVIDIA Corporation. All rights reserved. -# NVIDIA Source Code License for StyleGAN2 with Adaptive Discriminator -# Augmentation (ADA) -# ======================================================================= - -# 1. Definitions - -# "Licensor" means any person or entity that distributes its Work. - -# "Software" means the original work of authorship made available under -# this License. - -# "Work" means the Software and any additions to or derivative works of -# the Software that are made available under this License. - -# The terms "reproduce," "reproduction," "derivative works," and -# "distribution" have the meaning as provided under U.S. copyright law; -# provided, however, that for the purposes of this License, derivative -# works shall not include works that remain separable from, or merely -# link (or bind by name) to the interfaces of, the Work. - -# Works, including the Software, are "made available" under this License -# by including in or with the Work either (a) a copyright notice -# referencing the applicability of this License to the Work, or (b) a -# copy of this License. - -# 2. License Grants - -# 2.1 Copyright Grant. Subject to the terms and conditions of this -# License, each Licensor grants to you a perpetual, worldwide, -# non-exclusive, royalty-free, copyright license to reproduce, -# prepare derivative works of, publicly display, publicly perform, -# sublicense and distribute its Work and any resulting derivative -# works in any form. - -# 3. Limitations - -# 3.1 Redistribution. You may reproduce or distribute the Work only -# if (a) you do so under this License, (b) you include a complete -# copy of this License with your distribution, and (c) you retain -# without modification any copyright, patent, trademark, or -# attribution notices that are present in the Work. - -# 3.2 Derivative Works. You may specify that additional or different -# terms apply to the use, reproduction, and distribution of your -# derivative works of the Work ("Your Terms") only if (a) Your Terms -# provide that the use limitation in Section 3.3 applies to your -# derivative works, and (b) you identify the specific derivative -# works that are subject to Your Terms. Notwithstanding Your Terms, -# this License (including the redistribution requirements in Section -# 3.1) will continue to apply to the Work itself. - -# 3.3 Use Limitation. The Work and any derivative works thereof only -# may be used or intended for use non-commercially. Notwithstanding -# the foregoing, NVIDIA and its affiliates may use the Work and any -# derivative works commercially. As used herein, "non-commercially" -# means for research or evaluation purposes only. - -# 3.4 Patent Claims. If you bring or threaten to bring a patent claim -# against any Licensor (including any claim, cross-claim or -# counterclaim in a lawsuit) to enforce any patents that you allege -# are infringed by any Work, then your rights under this License from -# such Licensor (including the grant in Section 2.1) will terminate -# immediately. - -# 3.5 Trademarks. This License does not grant any rights to use any -# Licensor’s or its affiliates’ names, logos, or trademarks, except -# as necessary to reproduce the notices described in this License. - -# 3.6 Termination. If you violate any term of this License, then your -# rights under this License (including the grant in Section 2.1) will -# terminate immediately. - -# 4. Disclaimer of Warranty. - -# THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR -# NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER -# THIS LICENSE. - -# 5. Limitation of Liability. - -# EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL -# THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE -# SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, -# INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF -# OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK -# (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, -# LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER -# COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGES. - -# ======================================================================= - -import torch -from torch.autograd import Function -from torch.nn import functional as F - -from annotator.uniformer.mmcv.utils import to_2tuple -from ..utils import ext_loader - -upfirdn2d_ext = ext_loader.load_ext('_ext', ['upfirdn2d']) - - -class UpFirDn2dBackward(Function): - - @staticmethod - def forward(ctx, grad_output, kernel, grad_kernel, up, down, pad, g_pad, - in_size, out_size): - - up_x, up_y = up - down_x, down_y = down - g_pad_x0, g_pad_x1, g_pad_y0, g_pad_y1 = g_pad - - grad_output = grad_output.reshape(-1, out_size[0], out_size[1], 1) - - grad_input = upfirdn2d_ext.upfirdn2d( - grad_output, - grad_kernel, - up_x=down_x, - up_y=down_y, - down_x=up_x, - down_y=up_y, - pad_x0=g_pad_x0, - pad_x1=g_pad_x1, - pad_y0=g_pad_y0, - pad_y1=g_pad_y1) - grad_input = grad_input.view(in_size[0], in_size[1], in_size[2], - in_size[3]) - - ctx.save_for_backward(kernel) - - pad_x0, pad_x1, pad_y0, pad_y1 = pad - - ctx.up_x = up_x - ctx.up_y = up_y - ctx.down_x = down_x - ctx.down_y = down_y - ctx.pad_x0 = pad_x0 - ctx.pad_x1 = pad_x1 - ctx.pad_y0 = pad_y0 - ctx.pad_y1 = pad_y1 - ctx.in_size = in_size - ctx.out_size = out_size - - return grad_input - - @staticmethod - def backward(ctx, gradgrad_input): - kernel, = ctx.saved_tensors - - gradgrad_input = gradgrad_input.reshape(-1, ctx.in_size[2], - ctx.in_size[3], 1) - - gradgrad_out = upfirdn2d_ext.upfirdn2d( - gradgrad_input, - kernel, - up_x=ctx.up_x, - up_y=ctx.up_y, - down_x=ctx.down_x, - down_y=ctx.down_y, - pad_x0=ctx.pad_x0, - pad_x1=ctx.pad_x1, - pad_y0=ctx.pad_y0, - pad_y1=ctx.pad_y1) - # gradgrad_out = gradgrad_out.view(ctx.in_size[0], ctx.out_size[0], - # ctx.out_size[1], ctx.in_size[3]) - gradgrad_out = gradgrad_out.view(ctx.in_size[0], ctx.in_size[1], - ctx.out_size[0], ctx.out_size[1]) - - return gradgrad_out, None, None, None, None, None, None, None, None - - -class UpFirDn2d(Function): - - @staticmethod - def forward(ctx, input, kernel, up, down, pad): - up_x, up_y = up - down_x, down_y = down - pad_x0, pad_x1, pad_y0, pad_y1 = pad - - kernel_h, kernel_w = kernel.shape - batch, channel, in_h, in_w = input.shape - ctx.in_size = input.shape - - input = input.reshape(-1, in_h, in_w, 1) - - ctx.save_for_backward(kernel, torch.flip(kernel, [0, 1])) - - out_h = (in_h * up_y + pad_y0 + pad_y1 - kernel_h) // down_y + 1 - out_w = (in_w * up_x + pad_x0 + pad_x1 - kernel_w) // down_x + 1 - ctx.out_size = (out_h, out_w) - - ctx.up = (up_x, up_y) - ctx.down = (down_x, down_y) - ctx.pad = (pad_x0, pad_x1, pad_y0, pad_y1) - - g_pad_x0 = kernel_w - pad_x0 - 1 - g_pad_y0 = kernel_h - pad_y0 - 1 - g_pad_x1 = in_w * up_x - out_w * down_x + pad_x0 - up_x + 1 - g_pad_y1 = in_h * up_y - out_h * down_y + pad_y0 - up_y + 1 - - ctx.g_pad = (g_pad_x0, g_pad_x1, g_pad_y0, g_pad_y1) - - out = upfirdn2d_ext.upfirdn2d( - input, - kernel, - up_x=up_x, - up_y=up_y, - down_x=down_x, - down_y=down_y, - pad_x0=pad_x0, - pad_x1=pad_x1, - pad_y0=pad_y0, - pad_y1=pad_y1) - # out = out.view(major, out_h, out_w, minor) - out = out.view(-1, channel, out_h, out_w) - - return out - - @staticmethod - def backward(ctx, grad_output): - kernel, grad_kernel = ctx.saved_tensors - - grad_input = UpFirDn2dBackward.apply( - grad_output, - kernel, - grad_kernel, - ctx.up, - ctx.down, - ctx.pad, - ctx.g_pad, - ctx.in_size, - ctx.out_size, - ) - - return grad_input, None, None, None, None - - -def upfirdn2d(input, kernel, up=1, down=1, pad=(0, 0)): - """UpFRIDn for 2d features. - - UpFIRDn is short for upsample, apply FIR filter and downsample. More - details can be found in: - https://www.mathworks.com/help/signal/ref/upfirdn.html - - Args: - input (Tensor): Tensor with shape of (n, c, h, w). - kernel (Tensor): Filter kernel. - up (int | tuple[int], optional): Upsampling factor. If given a number, - we will use this factor for the both height and width side. - Defaults to 1. - down (int | tuple[int], optional): Downsampling factor. If given a - number, we will use this factor for the both height and width side. - Defaults to 1. - pad (tuple[int], optional): Padding for tensors, (x_pad, y_pad) or - (x_pad_0, x_pad_1, y_pad_0, y_pad_1). Defaults to (0, 0). - - Returns: - Tensor: Tensor after UpFIRDn. - """ - if input.device.type == 'cpu': - if len(pad) == 2: - pad = (pad[0], pad[1], pad[0], pad[1]) - - up = to_2tuple(up) - - down = to_2tuple(down) - - out = upfirdn2d_native(input, kernel, up[0], up[1], down[0], down[1], - pad[0], pad[1], pad[2], pad[3]) - else: - _up = to_2tuple(up) - - _down = to_2tuple(down) - - if len(pad) == 4: - _pad = pad - elif len(pad) == 2: - _pad = (pad[0], pad[1], pad[0], pad[1]) - - out = UpFirDn2d.apply(input, kernel, _up, _down, _pad) - - return out - - -def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0, pad_x1, - pad_y0, pad_y1): - _, channel, in_h, in_w = input.shape - input = input.reshape(-1, in_h, in_w, 1) - - _, in_h, in_w, minor = input.shape - kernel_h, kernel_w = kernel.shape - - out = input.view(-1, in_h, 1, in_w, 1, minor) - out = F.pad(out, [0, 0, 0, up_x - 1, 0, 0, 0, up_y - 1]) - out = out.view(-1, in_h * up_y, in_w * up_x, minor) - - out = F.pad( - out, - [0, 0, - max(pad_x0, 0), - max(pad_x1, 0), - max(pad_y0, 0), - max(pad_y1, 0)]) - out = out[:, - max(-pad_y0, 0):out.shape[1] - max(-pad_y1, 0), - max(-pad_x0, 0):out.shape[2] - max(-pad_x1, 0), :, ] - - out = out.permute(0, 3, 1, 2) - out = out.reshape( - [-1, 1, in_h * up_y + pad_y0 + pad_y1, in_w * up_x + pad_x0 + pad_x1]) - w = torch.flip(kernel, [0, 1]).view(1, 1, kernel_h, kernel_w) - out = F.conv2d(out, w) - out = out.reshape( - -1, - minor, - in_h * up_y + pad_y0 + pad_y1 - kernel_h + 1, - in_w * up_x + pad_x0 + pad_x1 - kernel_w + 1, - ) - out = out.permute(0, 2, 3, 1) - out = out[:, ::down_y, ::down_x, :] - - out_h = (in_h * up_y + pad_y0 + pad_y1 - kernel_h) // down_y + 1 - out_w = (in_w * up_x + pad_x0 + pad_x1 - kernel_w) // down_x + 1 - - return out.view(-1, channel, out_h, out_w) diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/utils/filetypes.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/utils/filetypes.py deleted file mode 100644 index 5948570178f3e6e79d1ff574241d09d4d8ed78de..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/utils/filetypes.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Filetype information. -""" - -from typing import Tuple - -from pip._internal.utils.misc import splitext - -WHEEL_EXTENSION = ".whl" -BZ2_EXTENSIONS: Tuple[str, ...] = (".tar.bz2", ".tbz") -XZ_EXTENSIONS: Tuple[str, ...] = ( - ".tar.xz", - ".txz", - ".tlz", - ".tar.lz", - ".tar.lzma", -) -ZIP_EXTENSIONS: Tuple[str, ...] = (".zip", WHEEL_EXTENSION) -TAR_EXTENSIONS: Tuple[str, ...] = (".tar.gz", ".tgz", ".tar") -ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS - - -def is_archive_file(name: str) -> bool: - """Return True if `name` is a considered as an archive file.""" - ext = splitext(name)[1].lower() - if ext in ARCHIVE_EXTENSIONS: - return True - return False diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_distutils/cygwinccompiler.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_distutils/cygwinccompiler.py deleted file mode 100644 index 2c4da5b57e5fda8b1510a61c2f14a61fac1c0916..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_distutils/cygwinccompiler.py +++ /dev/null @@ -1,364 +0,0 @@ -"""distutils.cygwinccompiler - -Provides the CygwinCCompiler class, a subclass of UnixCCompiler that -handles the Cygwin port of the GNU C compiler to Windows. It also contains -the Mingw32CCompiler class which handles the mingw32 port of GCC (same as -cygwin in no-cygwin mode). -""" - -import os -import sys -import copy -import shlex -import warnings -from subprocess import check_output - -from distutils.unixccompiler import UnixCCompiler -from distutils.file_util import write_file -from distutils.errors import ( - DistutilsExecError, - DistutilsPlatformError, - CCompilerError, - CompileError, -) -from distutils.version import LooseVersion, suppress_known_deprecation - - -def get_msvcr(): - """Include the appropriate MSVC runtime library if Python was built - with MSVC 7.0 or later. - """ - msc_pos = sys.version.find('MSC v.') - if msc_pos != -1: - msc_ver = sys.version[msc_pos + 6 : msc_pos + 10] - if msc_ver == '1300': - # MSVC 7.0 - return ['msvcr70'] - elif msc_ver == '1310': - # MSVC 7.1 - return ['msvcr71'] - elif msc_ver == '1400': - # VS2005 / MSVC 8.0 - return ['msvcr80'] - elif msc_ver == '1500': - # VS2008 / MSVC 9.0 - return ['msvcr90'] - elif msc_ver == '1600': - # VS2010 / MSVC 10.0 - return ['msvcr100'] - elif msc_ver == '1700': - # VS2012 / MSVC 11.0 - return ['msvcr110'] - elif msc_ver == '1800': - # VS2013 / MSVC 12.0 - return ['msvcr120'] - elif 1900 <= int(msc_ver) < 2000: - # VS2015 / MSVC 14.0 - return ['ucrt', 'vcruntime140'] - else: - raise ValueError("Unknown MS Compiler version %s " % msc_ver) - - -_runtime_library_dirs_msg = ( - "Unable to set runtime library search path on Windows, " - "usually indicated by `runtime_library_dirs` parameter to Extension" -) - - -class CygwinCCompiler(UnixCCompiler): - """Handles the Cygwin port of the GNU C compiler to Windows.""" - - compiler_type = 'cygwin' - obj_extension = ".o" - static_lib_extension = ".a" - shared_lib_extension = ".dll.a" - dylib_lib_extension = ".dll" - static_lib_format = "lib%s%s" - shared_lib_format = "lib%s%s" - dylib_lib_format = "cyg%s%s" - exe_extension = ".exe" - - def __init__(self, verbose=0, dry_run=0, force=0): - - super().__init__(verbose, dry_run, force) - - status, details = check_config_h() - self.debug_print( - "Python's GCC status: {} (details: {})".format(status, details) - ) - if status is not CONFIG_H_OK: - self.warn( - "Python's pyconfig.h doesn't seem to support your compiler. " - "Reason: %s. " - "Compiling may fail because of undefined preprocessor macros." % details - ) - - self.cc = os.environ.get('CC', 'gcc') - self.cxx = os.environ.get('CXX', 'g++') - - self.linker_dll = self.cc - shared_option = "-shared" - - self.set_executables( - compiler='%s -mcygwin -O -Wall' % self.cc, - compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc, - compiler_cxx='%s -mcygwin -O -Wall' % self.cxx, - linker_exe='%s -mcygwin' % self.cc, - linker_so=('{} -mcygwin {}'.format(self.linker_dll, shared_option)), - ) - - # Include the appropriate MSVC runtime library if Python was built - # with MSVC 7.0 or later. - self.dll_libraries = get_msvcr() - - @property - def gcc_version(self): - # Older numpy dependend on this existing to check for ancient - # gcc versions. This doesn't make much sense with clang etc so - # just hardcode to something recent. - # https://github.com/numpy/numpy/pull/20333 - warnings.warn( - "gcc_version attribute of CygwinCCompiler is deprecated. " - "Instead of returning actual gcc version a fixed value 11.2.0 is returned.", - DeprecationWarning, - stacklevel=2, - ) - with suppress_known_deprecation(): - return LooseVersion("11.2.0") - - def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): - """Compiles the source by spawning GCC and windres if needed.""" - if ext == '.rc' or ext == '.res': - # gcc needs '.res' and '.rc' compiled to object files !!! - try: - self.spawn(["windres", "-i", src, "-o", obj]) - except DistutilsExecError as msg: - raise CompileError(msg) - else: # for other files use the C-compiler - try: - self.spawn( - self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs - ) - except DistutilsExecError as msg: - raise CompileError(msg) - - def link( - self, - target_desc, - objects, - output_filename, - output_dir=None, - libraries=None, - library_dirs=None, - runtime_library_dirs=None, - export_symbols=None, - debug=0, - extra_preargs=None, - extra_postargs=None, - build_temp=None, - target_lang=None, - ): - """Link the objects.""" - # use separate copies, so we can modify the lists - extra_preargs = copy.copy(extra_preargs or []) - libraries = copy.copy(libraries or []) - objects = copy.copy(objects or []) - - if runtime_library_dirs: - self.warn(_runtime_library_dirs_msg) - - # Additional libraries - libraries.extend(self.dll_libraries) - - # handle export symbols by creating a def-file - # with executables this only works with gcc/ld as linker - if (export_symbols is not None) and ( - target_desc != self.EXECUTABLE or self.linker_dll == "gcc" - ): - # (The linker doesn't do anything if output is up-to-date. - # So it would probably better to check if we really need this, - # but for this we had to insert some unchanged parts of - # UnixCCompiler, and this is not what we want.) - - # we want to put some files in the same directory as the - # object files are, build_temp doesn't help much - # where are the object files - temp_dir = os.path.dirname(objects[0]) - # name of dll to give the helper files the same base name - (dll_name, dll_extension) = os.path.splitext( - os.path.basename(output_filename) - ) - - # generate the filenames for these files - def_file = os.path.join(temp_dir, dll_name + ".def") - - # Generate .def file - contents = ["LIBRARY %s" % os.path.basename(output_filename), "EXPORTS"] - for sym in export_symbols: - contents.append(sym) - self.execute(write_file, (def_file, contents), "writing %s" % def_file) - - # next add options for def-file - - # for gcc/ld the def-file is specified as any object files - objects.append(def_file) - - # end: if ((export_symbols is not None) and - # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): - - # who wants symbols and a many times larger output file - # should explicitly switch the debug mode on - # otherwise we let ld strip the output file - # (On my machine: 10KiB < stripped_file < ??100KiB - # unstripped_file = stripped_file + XXX KiB - # ( XXX=254 for a typical python extension)) - if not debug: - extra_preargs.append("-s") - - UnixCCompiler.link( - self, - target_desc, - objects, - output_filename, - output_dir, - libraries, - library_dirs, - runtime_library_dirs, - None, # export_symbols, we do this in our def-file - debug, - extra_preargs, - extra_postargs, - build_temp, - target_lang, - ) - - def runtime_library_dir_option(self, dir): - # cygwin doesn't support rpath. While in theory we could error - # out like MSVC does, code might expect it to work like on Unix, so - # just warn and hope for the best. - self.warn(_runtime_library_dirs_msg) - return [] - - # -- Miscellaneous methods ----------------------------------------- - - def _make_out_path(self, output_dir, strip_dir, src_name): - # use normcase to make sure '.rc' is really '.rc' and not '.RC' - norm_src_name = os.path.normcase(src_name) - return super()._make_out_path(output_dir, strip_dir, norm_src_name) - - @property - def out_extensions(self): - """ - Add support for rc and res files. - """ - return { - **super().out_extensions, - **{ext: ext + self.obj_extension for ext in ('.res', '.rc')}, - } - - -# the same as cygwin plus some additional parameters -class Mingw32CCompiler(CygwinCCompiler): - """Handles the Mingw32 port of the GNU C compiler to Windows.""" - - compiler_type = 'mingw32' - - def __init__(self, verbose=0, dry_run=0, force=0): - - super().__init__(verbose, dry_run, force) - - shared_option = "-shared" - - if is_cygwincc(self.cc): - raise CCompilerError('Cygwin gcc cannot be used with --compiler=mingw32') - - self.set_executables( - compiler='%s -O -Wall' % self.cc, - compiler_so='%s -mdll -O -Wall' % self.cc, - compiler_cxx='%s -O -Wall' % self.cxx, - linker_exe='%s' % self.cc, - linker_so='{} {}'.format(self.linker_dll, shared_option), - ) - - # Maybe we should also append -mthreads, but then the finished - # dlls need another dll (mingwm10.dll see Mingw32 docs) - # (-mthreads: Support thread-safe exception handling on `Mingw32') - - # no additional libraries needed - self.dll_libraries = [] - - # Include the appropriate MSVC runtime library if Python was built - # with MSVC 7.0 or later. - self.dll_libraries = get_msvcr() - - def runtime_library_dir_option(self, dir): - raise DistutilsPlatformError(_runtime_library_dirs_msg) - - -# Because these compilers aren't configured in Python's pyconfig.h file by -# default, we should at least warn the user if he is using an unmodified -# version. - -CONFIG_H_OK = "ok" -CONFIG_H_NOTOK = "not ok" -CONFIG_H_UNCERTAIN = "uncertain" - - -def check_config_h(): - """Check if the current Python installation appears amenable to building - extensions with GCC. - - Returns a tuple (status, details), where 'status' is one of the following - constants: - - - CONFIG_H_OK: all is well, go ahead and compile - - CONFIG_H_NOTOK: doesn't look good - - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h - - 'details' is a human-readable string explaining the situation. - - Note there are two ways to conclude "OK": either 'sys.version' contains - the string "GCC" (implying that this Python was built with GCC), or the - installed "pyconfig.h" contains the string "__GNUC__". - """ - - # XXX since this function also checks sys.version, it's not strictly a - # "pyconfig.h" check -- should probably be renamed... - - from distutils import sysconfig - - # if sys.version contains GCC then python was compiled with GCC, and the - # pyconfig.h file should be OK - if "GCC" in sys.version: - return CONFIG_H_OK, "sys.version mentions 'GCC'" - - # Clang would also work - if "Clang" in sys.version: - return CONFIG_H_OK, "sys.version mentions 'Clang'" - - # let's see if __GNUC__ is mentioned in python.h - fn = sysconfig.get_config_h_filename() - try: - config_h = open(fn) - try: - if "__GNUC__" in config_h.read(): - return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn - else: - return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn - finally: - config_h.close() - except OSError as exc: - return (CONFIG_H_UNCERTAIN, "couldn't read '{}': {}".format(fn, exc.strerror)) - - -def is_cygwincc(cc): - '''Try to determine if the compiler that would be used is from cygwin.''' - out_string = check_output(shlex.split(cc) + ['-dumpmachine']) - return out_string.strip().endswith(b'cygwin') - - -get_versions = None -""" -A stand-in for the previous get_versions() function to prevent failures -when monkeypatched. See pypa/setuptools#2969. -""" diff --git a/spaces/AyushP/PolicyCompareBot/README.md b/spaces/AyushP/PolicyCompareBot/README.md deleted file mode 100644 index 801b3a6599c76f4f6b1e6143c6619fde02724fcd..0000000000000000000000000000000000000000 --- a/spaces/AyushP/PolicyCompareBot/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: PolicyCompareBot -emoji: 🌖 -colorFrom: gray -colorTo: purple -sdk: streamlit -sdk_version: 1.17.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/Benson/text-generation/Examples/5 Documento De Pregunta Beca 2016 Pdf.md b/spaces/Benson/text-generation/Examples/5 Documento De Pregunta Beca 2016 Pdf.md deleted file mode 100644 index 95945a61ec24fc77d1eb40f8ca5928dcc91b9774..0000000000000000000000000000000000000000 --- a/spaces/Benson/text-generation/Examples/5 Documento De Pregunta Beca 2016 Pdf.md +++ /dev/null @@ -1,76 +0,0 @@ - -

    5th Scholarship Question Paper 2016 PDF Descargar

    -

    Si usted es un estudiante que aspira a obtener una beca para su educación superior, entonces usted podría estar interesado en tomar el quinto examen de beca. Se trata de un examen competitivo que llevan a cabo diversas autoridades de la India y Sri Lanka para estudiantes que están en su último año de primaria. El examen pone a prueba sus conocimientos, habilidades y aptitudes en diversas materias y le ayuda a obtener la admisión en escuelas y colegios de renombre.

    -

    5º documento de pregunta beca 2016 pdf


    Downloadhttps://bltlly.com/2v6MD1



    -

    Sin embargo, prepararse para este examen no es una tarea fácil. Es necesario tener una clara comprensión del programa de estudios, temas y patrones de preguntas. También es necesario practicar una gran cantidad de documentos del año anterior para familiarizarse con el nivel de dificultad y la gestión del tiempo. Una de las mejores maneras de hacer esto es descargar y utilizar el quinto documento de pregunta beca 2016 PDF.

    -

    En este artículo, le diremos cómo descargar el quinto documento de preguntas de becas 2016 PDF y cómo usarlo para su preparación. También compartiremos algunos consejos y trucos para resolver las preguntas y algunas preguntas de muestra y respuestas del documento. Al leer este artículo, podrás aumentar tu confianza y rendimiento en el examen.

    -

    Cómo descargar el quinto documento de preguntas de becas 2016 PDF

    -

    El primer paso para prepararse para el quinto examen de beca es descargar los documentos anteriores del examen. Los trabajos anteriores te ayudarán a entender el formato, el programa y el nivel de dificultad del examen. También le ayudarán a identificar sus fortalezas y debilidades y trabajar en consecuencia.

    -

    -

    El quinto documento de preguntas de becas 2016 PDF está disponible en línea en varios sitios web. Puedes descargarlo desde cualquiera de estos sitios web siguiendo estos sencillos pasos:

    -

    Paso 1: Visita el sitio web oficial de la autoridad examinadora

    - -

    Paso 2: Encuentre el enlace para los documentos anteriores y haga clic en él

    -

    El siguiente paso es encontrar el enlace para descargar los documentos anteriores del examen en el sitio web. Por lo general, este enlace estará bajo una sección llamada "Descargas", "Recursos" o "Documentos anteriores". Haga clic en este enlace para ir a una página donde puede ver todos los documentos anteriores disponibles para su descarga.

    -

    Paso 3: Seleccione el año 2016 y el medio de su elección

    -

    El tercer paso es seleccionar el año 2016 de la lista de artículos anteriores. Esto le mostrará el archivo PDF del quinto documento de preguntas de becas 2016 en el medio de su elección. El medio puede ser inglés, hindi, marathi, tamil, cingalés o cualquier otro idioma en el que se realice el examen. Haga clic en el archivo PDF para verlo en línea o descargarlo en su dispositivo.

    -

    Paso 4: Descargue el archivo PDF y guárdelo en su dispositivo

    -

    El paso final es descargar el archivo PDF del quinto documento de preguntas de la beca 2016 y guardarlo en su dispositivo. Puede hacer esto haciendo clic derecho en el archivo PDF y eligiendo la opción "Guardar como" o "Descargar". También puede utilizar un gestor de descargas o una extensión del navegador para descargar el archivo más rápido y fácil. Asegúrate de tener suficiente espacio en tu dispositivo y una buena conexión a Internet para descargar el archivo sin errores.

    -

    Cómo utilizar el quinto documento de preguntas de becas 2016 PDF para la preparación

    -

    Ahora que ha descargado el quinto documento de pregunta beca 2016 PDF, es posible que se pregunte cómo usarlo para su preparación. Bueno, hay muchas maneras de usar el trabajo anterior para mejorar tus conocimientos, habilidades y confianza para el examen. Estas son algunas de ellas:

    -

    Consejos y trucos para resolver las preguntas

    - -

    Algunos de los consejos y trucos que puedes aprender del trabajo anterior son:

    - -

    Temas y plan de estudios tratados en el documento

    -

    La segunda forma de utilizar el artículo anterior es revisar los temas y el programa de estudios cubiertos en el examen. El quinto examen de beca cubre varias materias como Matemáticas, Ciencias, Estudios Sociales, Inglés y Conocimientos Generales. Es necesario tener un conocimiento profundo de estos temas y sus conceptos para obtener una buena puntuación en el examen.

    -

    El artículo anterior te ayudará a identificar los temas y subtemas importantes que se piden con frecuencia en el examen. También te ayudará a revisar los conceptos que ya has aprendido y a llenar cualquier vacío en tu conocimiento. Puedes usar el artículo anterior como una guía para planificar tu horario de estudio y asignar tiempo para cada tema en consecuencia.

    -

    Ejemplos de preguntas y respuestas del artículo

    -

    La tercera forma de usar el artículo anterior es practicar algunas preguntas y respuestas de muestra del artículo. Esta es la mejor manera de probar sus conocimientos, habilidades y velocidad para el examen. Al resolver las preguntas de muestra, podrá evaluar su rendimiento y precisión. También podrás aprender de tus errores y mejorar tus áreas débiles.

    - -

    Aquí hay algunas preguntas de muestra y respuestas del quinto documento de preguntas de becas 2016 PDF:

    - - -Pregunta -Respuesta - - -¿Cuál de los siguientes es un número primo? -A) 15
    B) 17
    C) 21
    D) 25


    La respuesta correcta es B) 17. Un número primo es un número que tiene solo dos factores, 1 y sí mismo. 17 tiene solo dos factores, 1 y 17, por lo que es un número primo. Las otras opciones no son números primos porque tienen más de dos factores. - - -¿Cuál de las siguientes es la capital de Sri Lanka? -A) Colombo
    B) Kandy
    C) Jaffna
    D) Galle

    La respuesta correcta es A) Colombo. Colombo es la ciudad más grande y la capital comercial de Sri Lanka. Se encuentra en la costa oeste de la isla y tiene una población de alrededor de 5,6 millones de personas. Las otras opciones son otras ciudades en Sri Lanka, pero no son la capital. - - -¿Cuál de los siguientes es sinónimo de "feliz"? -A) Triste
    B) Enojado
    C) Contento
    D) Asustado

    La respuesta correcta es C) Contento. Un sinónimo es una palabra que tiene el mismo o similar significado que otra palabra. Alegre significa sentir placer, alegría o satisfacción, que es similar a feliz. Las otras opciones son antónimos de feliz, lo que significa que tienen significados opuestos. - -
    -

    Conclusión

    -

    En conclusión, el quinto examen de beca es una gran oportunidad para los estudiantes que quieren continuar su educación superior con apoyo financiero y excelencia académica. Para prepararse para este examen, es necesario descargar y utilizar el quinto documento de pregunta beca 2016 PDF como un recurso valioso. El artículo anterior te ayudará a entender el formato, el programa y el nivel de dificultad del examen. También le ayudará a aprender algunos consejos y trucos para resolver las preguntas y practicar algunas preguntas de muestra y respuestas del documento.

    - -

    Preguntas frecuentes

    -

    ¿Cuáles son los criterios de elegibilidad para el quinto examen de beca?

    -

    Los criterios de elegibilidad para el quinto examen de beca pueden variar dependiendo de la autoridad que lo lleve a cabo en su región. Sin embargo, generalmente necesitas ser un estudiante que esté en su último año de primaria (grado 5 o equivalente). También necesitas tener un buen expediente académico y alcanzar las calificaciones mínimas requeridas por la autoridad.

    -

    ¿Cuál es el formato y la duración del quinto examen de beca?

    -

    El formato y la duración del quinto examen de beca también puede variar dependiendo de la autoridad que lo realice en su región. Sin embargo, generalmente, el examen consiste en preguntas de opción múltiple (MCQs) que cubren varias materias como Matemáticas, Ciencias, Estudios Sociales, Inglés y Conocimientos Generales. El examen puede tener uno o dos documentos dependiendo del medio y la autoridad. La duración del examen puede variar de 1 a 2 horas dependiendo del número y tipo de preguntas.

    -

    ¿Cuáles son las recompensas y el reconocimiento para el quinto examen de beca?

    -

    Las recompensas y el reconocimiento para el quinto examen de beca también pueden variar dependiendo de la autoridad que lo lleva a cabo en su región. Sin embargo, generalmente, los estudiantes que califican el examen reciben becas que cubren sus cuotas de matrícula, libros y otros gastos para su educación superior. También reciben certificados, medallas y trofeos que reconocen sus logros académicos y méritos. También se les da preferencia y admisión en escuelas y universidades de renombre que ofrecen educación e instalaciones de calidad.

    -

    ¿Cómo solicitar el quinto examen de beca?

    - -

    ¿Dónde encontrar más recursos y orientación para el quinto examen de beca?

    -

    Si quieres encontrar más recursos y orientación para el quinto examen de beca, puedes visitar algunos de estos sitios web que proporcionan información útil, consejos, materiales de estudio, pruebas simuladas y entrenamiento en línea para el examen:

    -

    64aa2da5cf
    -
    -
    \ No newline at end of file diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distlib/util.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distlib/util.py deleted file mode 100644 index dd01849d997e5ae9dc9809295e29ceb871b14216..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distlib/util.py +++ /dev/null @@ -1,1932 +0,0 @@ -# -# Copyright (C) 2012-2021 The Python Software Foundation. -# See LICENSE.txt and CONTRIBUTORS.txt. -# -import codecs -from collections import deque -import contextlib -import csv -from glob import iglob as std_iglob -import io -import json -import logging -import os -import py_compile -import re -import socket -try: - import ssl -except ImportError: # pragma: no cover - ssl = None -import subprocess -import sys -import tarfile -import tempfile -import textwrap - -try: - import threading -except ImportError: # pragma: no cover - import dummy_threading as threading -import time - -from . import DistlibException -from .compat import (string_types, text_type, shutil, raw_input, StringIO, - cache_from_source, urlopen, urljoin, httplib, xmlrpclib, - splittype, HTTPHandler, BaseConfigurator, valid_ident, - Container, configparser, URLError, ZipFile, fsdecode, - unquote, urlparse) - -logger = logging.getLogger(__name__) - -# -# Requirement parsing code as per PEP 508 -# - -IDENTIFIER = re.compile(r'^([\w\.-]+)\s*') -VERSION_IDENTIFIER = re.compile(r'^([\w\.*+-]+)\s*') -COMPARE_OP = re.compile(r'^(<=?|>=?|={2,3}|[~!]=)\s*') -MARKER_OP = re.compile(r'^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*') -OR = re.compile(r'^or\b\s*') -AND = re.compile(r'^and\b\s*') -NON_SPACE = re.compile(r'(\S+)\s*') -STRING_CHUNK = re.compile(r'([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)') - - -def parse_marker(marker_string): - """ - Parse a marker string and return a dictionary containing a marker expression. - - The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in - the expression grammar, or strings. A string contained in quotes is to be - interpreted as a literal string, and a string not contained in quotes is a - variable (such as os_name). - """ - def marker_var(remaining): - # either identifier, or literal string - m = IDENTIFIER.match(remaining) - if m: - result = m.groups()[0] - remaining = remaining[m.end():] - elif not remaining: - raise SyntaxError('unexpected end of input') - else: - q = remaining[0] - if q not in '\'"': - raise SyntaxError('invalid expression: %s' % remaining) - oq = '\'"'.replace(q, '') - remaining = remaining[1:] - parts = [q] - while remaining: - # either a string chunk, or oq, or q to terminate - if remaining[0] == q: - break - elif remaining[0] == oq: - parts.append(oq) - remaining = remaining[1:] - else: - m = STRING_CHUNK.match(remaining) - if not m: - raise SyntaxError('error in string literal: %s' % remaining) - parts.append(m.groups()[0]) - remaining = remaining[m.end():] - else: - s = ''.join(parts) - raise SyntaxError('unterminated string: %s' % s) - parts.append(q) - result = ''.join(parts) - remaining = remaining[1:].lstrip() # skip past closing quote - return result, remaining - - def marker_expr(remaining): - if remaining and remaining[0] == '(': - result, remaining = marker(remaining[1:].lstrip()) - if remaining[0] != ')': - raise SyntaxError('unterminated parenthesis: %s' % remaining) - remaining = remaining[1:].lstrip() - else: - lhs, remaining = marker_var(remaining) - while remaining: - m = MARKER_OP.match(remaining) - if not m: - break - op = m.groups()[0] - remaining = remaining[m.end():] - rhs, remaining = marker_var(remaining) - lhs = {'op': op, 'lhs': lhs, 'rhs': rhs} - result = lhs - return result, remaining - - def marker_and(remaining): - lhs, remaining = marker_expr(remaining) - while remaining: - m = AND.match(remaining) - if not m: - break - remaining = remaining[m.end():] - rhs, remaining = marker_expr(remaining) - lhs = {'op': 'and', 'lhs': lhs, 'rhs': rhs} - return lhs, remaining - - def marker(remaining): - lhs, remaining = marker_and(remaining) - while remaining: - m = OR.match(remaining) - if not m: - break - remaining = remaining[m.end():] - rhs, remaining = marker_and(remaining) - lhs = {'op': 'or', 'lhs': lhs, 'rhs': rhs} - return lhs, remaining - - return marker(marker_string) - - -def parse_requirement(req): - """ - Parse a requirement passed in as a string. Return a Container - whose attributes contain the various parts of the requirement. - """ - remaining = req.strip() - if not remaining or remaining.startswith('#'): - return None - m = IDENTIFIER.match(remaining) - if not m: - raise SyntaxError('name expected: %s' % remaining) - distname = m.groups()[0] - remaining = remaining[m.end():] - extras = mark_expr = versions = uri = None - if remaining and remaining[0] == '[': - i = remaining.find(']', 1) - if i < 0: - raise SyntaxError('unterminated extra: %s' % remaining) - s = remaining[1:i] - remaining = remaining[i + 1:].lstrip() - extras = [] - while s: - m = IDENTIFIER.match(s) - if not m: - raise SyntaxError('malformed extra: %s' % s) - extras.append(m.groups()[0]) - s = s[m.end():] - if not s: - break - if s[0] != ',': - raise SyntaxError('comma expected in extras: %s' % s) - s = s[1:].lstrip() - if not extras: - extras = None - if remaining: - if remaining[0] == '@': - # it's a URI - remaining = remaining[1:].lstrip() - m = NON_SPACE.match(remaining) - if not m: - raise SyntaxError('invalid URI: %s' % remaining) - uri = m.groups()[0] - t = urlparse(uri) - # there are issues with Python and URL parsing, so this test - # is a bit crude. See bpo-20271, bpo-23505. Python doesn't - # always parse invalid URLs correctly - it should raise - # exceptions for malformed URLs - if not (t.scheme and t.netloc): - raise SyntaxError('Invalid URL: %s' % uri) - remaining = remaining[m.end():].lstrip() - else: - - def get_versions(ver_remaining): - """ - Return a list of operator, version tuples if any are - specified, else None. - """ - m = COMPARE_OP.match(ver_remaining) - versions = None - if m: - versions = [] - while True: - op = m.groups()[0] - ver_remaining = ver_remaining[m.end():] - m = VERSION_IDENTIFIER.match(ver_remaining) - if not m: - raise SyntaxError('invalid version: %s' % ver_remaining) - v = m.groups()[0] - versions.append((op, v)) - ver_remaining = ver_remaining[m.end():] - if not ver_remaining or ver_remaining[0] != ',': - break - ver_remaining = ver_remaining[1:].lstrip() - # Some packages have a trailing comma which would break things - # See issue #148 - if not ver_remaining: - break - m = COMPARE_OP.match(ver_remaining) - if not m: - raise SyntaxError('invalid constraint: %s' % ver_remaining) - if not versions: - versions = None - return versions, ver_remaining - - if remaining[0] != '(': - versions, remaining = get_versions(remaining) - else: - i = remaining.find(')', 1) - if i < 0: - raise SyntaxError('unterminated parenthesis: %s' % remaining) - s = remaining[1:i] - remaining = remaining[i + 1:].lstrip() - # As a special diversion from PEP 508, allow a version number - # a.b.c in parentheses as a synonym for ~= a.b.c (because this - # is allowed in earlier PEPs) - if COMPARE_OP.match(s): - versions, _ = get_versions(s) - else: - m = VERSION_IDENTIFIER.match(s) - if not m: - raise SyntaxError('invalid constraint: %s' % s) - v = m.groups()[0] - s = s[m.end():].lstrip() - if s: - raise SyntaxError('invalid constraint: %s' % s) - versions = [('~=', v)] - - if remaining: - if remaining[0] != ';': - raise SyntaxError('invalid requirement: %s' % remaining) - remaining = remaining[1:].lstrip() - - mark_expr, remaining = parse_marker(remaining) - - if remaining and remaining[0] != '#': - raise SyntaxError('unexpected trailing data: %s' % remaining) - - if not versions: - rs = distname - else: - rs = '%s %s' % (distname, ', '.join(['%s %s' % con for con in versions])) - return Container(name=distname, extras=extras, constraints=versions, - marker=mark_expr, url=uri, requirement=rs) - - -def get_resources_dests(resources_root, rules): - """Find destinations for resources files""" - - def get_rel_path(root, path): - # normalizes and returns a lstripped-/-separated path - root = root.replace(os.path.sep, '/') - path = path.replace(os.path.sep, '/') - assert path.startswith(root) - return path[len(root):].lstrip('/') - - destinations = {} - for base, suffix, dest in rules: - prefix = os.path.join(resources_root, base) - for abs_base in iglob(prefix): - abs_glob = os.path.join(abs_base, suffix) - for abs_path in iglob(abs_glob): - resource_file = get_rel_path(resources_root, abs_path) - if dest is None: # remove the entry if it was here - destinations.pop(resource_file, None) - else: - rel_path = get_rel_path(abs_base, abs_path) - rel_dest = dest.replace(os.path.sep, '/').rstrip('/') - destinations[resource_file] = rel_dest + '/' + rel_path - return destinations - - -def in_venv(): - if hasattr(sys, 'real_prefix'): - # virtualenv venvs - result = True - else: - # PEP 405 venvs - result = sys.prefix != getattr(sys, 'base_prefix', sys.prefix) - return result - - -def get_executable(): -# The __PYVENV_LAUNCHER__ dance is apparently no longer needed, as -# changes to the stub launcher mean that sys.executable always points -# to the stub on OS X -# if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__' -# in os.environ): -# result = os.environ['__PYVENV_LAUNCHER__'] -# else: -# result = sys.executable -# return result - # Avoid normcasing: see issue #143 - # result = os.path.normcase(sys.executable) - result = sys.executable - if not isinstance(result, text_type): - result = fsdecode(result) - return result - - -def proceed(prompt, allowed_chars, error_prompt=None, default=None): - p = prompt - while True: - s = raw_input(p) - p = prompt - if not s and default: - s = default - if s: - c = s[0].lower() - if c in allowed_chars: - break - if error_prompt: - p = '%c: %s\n%s' % (c, error_prompt, prompt) - return c - - -def extract_by_key(d, keys): - if isinstance(keys, string_types): - keys = keys.split() - result = {} - for key in keys: - if key in d: - result[key] = d[key] - return result - -def read_exports(stream): - if sys.version_info[0] >= 3: - # needs to be a text stream - stream = codecs.getreader('utf-8')(stream) - # Try to load as JSON, falling back on legacy format - data = stream.read() - stream = StringIO(data) - try: - jdata = json.load(stream) - result = jdata['extensions']['python.exports']['exports'] - for group, entries in result.items(): - for k, v in entries.items(): - s = '%s = %s' % (k, v) - entry = get_export_entry(s) - assert entry is not None - entries[k] = entry - return result - except Exception: - stream.seek(0, 0) - - def read_stream(cp, stream): - if hasattr(cp, 'read_file'): - cp.read_file(stream) - else: - cp.readfp(stream) - - cp = configparser.ConfigParser() - try: - read_stream(cp, stream) - except configparser.MissingSectionHeaderError: - stream.close() - data = textwrap.dedent(data) - stream = StringIO(data) - read_stream(cp, stream) - - result = {} - for key in cp.sections(): - result[key] = entries = {} - for name, value in cp.items(key): - s = '%s = %s' % (name, value) - entry = get_export_entry(s) - assert entry is not None - #entry.dist = self - entries[name] = entry - return result - - -def write_exports(exports, stream): - if sys.version_info[0] >= 3: - # needs to be a text stream - stream = codecs.getwriter('utf-8')(stream) - cp = configparser.ConfigParser() - for k, v in exports.items(): - # TODO check k, v for valid values - cp.add_section(k) - for entry in v.values(): - if entry.suffix is None: - s = entry.prefix - else: - s = '%s:%s' % (entry.prefix, entry.suffix) - if entry.flags: - s = '%s [%s]' % (s, ', '.join(entry.flags)) - cp.set(k, entry.name, s) - cp.write(stream) - - -@contextlib.contextmanager -def tempdir(): - td = tempfile.mkdtemp() - try: - yield td - finally: - shutil.rmtree(td) - -@contextlib.contextmanager -def chdir(d): - cwd = os.getcwd() - try: - os.chdir(d) - yield - finally: - os.chdir(cwd) - - -@contextlib.contextmanager -def socket_timeout(seconds=15): - cto = socket.getdefaulttimeout() - try: - socket.setdefaulttimeout(seconds) - yield - finally: - socket.setdefaulttimeout(cto) - - -class cached_property(object): - def __init__(self, func): - self.func = func - #for attr in ('__name__', '__module__', '__doc__'): - # setattr(self, attr, getattr(func, attr, None)) - - def __get__(self, obj, cls=None): - if obj is None: - return self - value = self.func(obj) - object.__setattr__(obj, self.func.__name__, value) - #obj.__dict__[self.func.__name__] = value = self.func(obj) - return value - -def convert_path(pathname): - """Return 'pathname' as a name that will work on the native filesystem. - - The path is split on '/' and put back together again using the current - directory separator. Needed because filenames in the setup script are - always supplied in Unix style, and have to be converted to the local - convention before we can actually use them in the filesystem. Raises - ValueError on non-Unix-ish systems if 'pathname' either starts or - ends with a slash. - """ - if os.sep == '/': - return pathname - if not pathname: - return pathname - if pathname[0] == '/': - raise ValueError("path '%s' cannot be absolute" % pathname) - if pathname[-1] == '/': - raise ValueError("path '%s' cannot end with '/'" % pathname) - - paths = pathname.split('/') - while os.curdir in paths: - paths.remove(os.curdir) - if not paths: - return os.curdir - return os.path.join(*paths) - - -class FileOperator(object): - def __init__(self, dry_run=False): - self.dry_run = dry_run - self.ensured = set() - self._init_record() - - def _init_record(self): - self.record = False - self.files_written = set() - self.dirs_created = set() - - def record_as_written(self, path): - if self.record: - self.files_written.add(path) - - def newer(self, source, target): - """Tell if the target is newer than the source. - - Returns true if 'source' exists and is more recently modified than - 'target', or if 'source' exists and 'target' doesn't. - - Returns false if both exist and 'target' is the same age or younger - than 'source'. Raise PackagingFileError if 'source' does not exist. - - Note that this test is not very accurate: files created in the same - second will have the same "age". - """ - if not os.path.exists(source): - raise DistlibException("file '%r' does not exist" % - os.path.abspath(source)) - if not os.path.exists(target): - return True - - return os.stat(source).st_mtime > os.stat(target).st_mtime - - def copy_file(self, infile, outfile, check=True): - """Copy a file respecting dry-run and force flags. - """ - self.ensure_dir(os.path.dirname(outfile)) - logger.info('Copying %s to %s', infile, outfile) - if not self.dry_run: - msg = None - if check: - if os.path.islink(outfile): - msg = '%s is a symlink' % outfile - elif os.path.exists(outfile) and not os.path.isfile(outfile): - msg = '%s is a non-regular file' % outfile - if msg: - raise ValueError(msg + ' which would be overwritten') - shutil.copyfile(infile, outfile) - self.record_as_written(outfile) - - def copy_stream(self, instream, outfile, encoding=None): - assert not os.path.isdir(outfile) - self.ensure_dir(os.path.dirname(outfile)) - logger.info('Copying stream %s to %s', instream, outfile) - if not self.dry_run: - if encoding is None: - outstream = open(outfile, 'wb') - else: - outstream = codecs.open(outfile, 'w', encoding=encoding) - try: - shutil.copyfileobj(instream, outstream) - finally: - outstream.close() - self.record_as_written(outfile) - - def write_binary_file(self, path, data): - self.ensure_dir(os.path.dirname(path)) - if not self.dry_run: - if os.path.exists(path): - os.remove(path) - with open(path, 'wb') as f: - f.write(data) - self.record_as_written(path) - - def write_text_file(self, path, data, encoding): - self.write_binary_file(path, data.encode(encoding)) - - def set_mode(self, bits, mask, files): - if os.name == 'posix' or (os.name == 'java' and os._name == 'posix'): - # Set the executable bits (owner, group, and world) on - # all the files specified. - for f in files: - if self.dry_run: - logger.info("changing mode of %s", f) - else: - mode = (os.stat(f).st_mode | bits) & mask - logger.info("changing mode of %s to %o", f, mode) - os.chmod(f, mode) - - set_executable_mode = lambda s, f: s.set_mode(0o555, 0o7777, f) - - def ensure_dir(self, path): - path = os.path.abspath(path) - if path not in self.ensured and not os.path.exists(path): - self.ensured.add(path) - d, f = os.path.split(path) - self.ensure_dir(d) - logger.info('Creating %s' % path) - if not self.dry_run: - os.mkdir(path) - if self.record: - self.dirs_created.add(path) - - def byte_compile(self, path, optimize=False, force=False, prefix=None, hashed_invalidation=False): - dpath = cache_from_source(path, not optimize) - logger.info('Byte-compiling %s to %s', path, dpath) - if not self.dry_run: - if force or self.newer(path, dpath): - if not prefix: - diagpath = None - else: - assert path.startswith(prefix) - diagpath = path[len(prefix):] - compile_kwargs = {} - if hashed_invalidation and hasattr(py_compile, 'PycInvalidationMode'): - compile_kwargs['invalidation_mode'] = py_compile.PycInvalidationMode.CHECKED_HASH - py_compile.compile(path, dpath, diagpath, True, **compile_kwargs) # raise error - self.record_as_written(dpath) - return dpath - - def ensure_removed(self, path): - if os.path.exists(path): - if os.path.isdir(path) and not os.path.islink(path): - logger.debug('Removing directory tree at %s', path) - if not self.dry_run: - shutil.rmtree(path) - if self.record: - if path in self.dirs_created: - self.dirs_created.remove(path) - else: - if os.path.islink(path): - s = 'link' - else: - s = 'file' - logger.debug('Removing %s %s', s, path) - if not self.dry_run: - os.remove(path) - if self.record: - if path in self.files_written: - self.files_written.remove(path) - - def is_writable(self, path): - result = False - while not result: - if os.path.exists(path): - result = os.access(path, os.W_OK) - break - parent = os.path.dirname(path) - if parent == path: - break - path = parent - return result - - def commit(self): - """ - Commit recorded changes, turn off recording, return - changes. - """ - assert self.record - result = self.files_written, self.dirs_created - self._init_record() - return result - - def rollback(self): - if not self.dry_run: - for f in list(self.files_written): - if os.path.exists(f): - os.remove(f) - # dirs should all be empty now, except perhaps for - # __pycache__ subdirs - # reverse so that subdirs appear before their parents - dirs = sorted(self.dirs_created, reverse=True) - for d in dirs: - flist = os.listdir(d) - if flist: - assert flist == ['__pycache__'] - sd = os.path.join(d, flist[0]) - os.rmdir(sd) - os.rmdir(d) # should fail if non-empty - self._init_record() - -def resolve(module_name, dotted_path): - if module_name in sys.modules: - mod = sys.modules[module_name] - else: - mod = __import__(module_name) - if dotted_path is None: - result = mod - else: - parts = dotted_path.split('.') - result = getattr(mod, parts.pop(0)) - for p in parts: - result = getattr(result, p) - return result - - -class ExportEntry(object): - def __init__(self, name, prefix, suffix, flags): - self.name = name - self.prefix = prefix - self.suffix = suffix - self.flags = flags - - @cached_property - def value(self): - return resolve(self.prefix, self.suffix) - - def __repr__(self): # pragma: no cover - return '' % (self.name, self.prefix, - self.suffix, self.flags) - - def __eq__(self, other): - if not isinstance(other, ExportEntry): - result = False - else: - result = (self.name == other.name and - self.prefix == other.prefix and - self.suffix == other.suffix and - self.flags == other.flags) - return result - - __hash__ = object.__hash__ - - -ENTRY_RE = re.compile(r'''(?P(\w|[-.+])+) - \s*=\s*(?P(\w+)([:\.]\w+)*) - \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? - ''', re.VERBOSE) - -def get_export_entry(specification): - m = ENTRY_RE.search(specification) - if not m: - result = None - if '[' in specification or ']' in specification: - raise DistlibException("Invalid specification " - "'%s'" % specification) - else: - d = m.groupdict() - name = d['name'] - path = d['callable'] - colons = path.count(':') - if colons == 0: - prefix, suffix = path, None - else: - if colons != 1: - raise DistlibException("Invalid specification " - "'%s'" % specification) - prefix, suffix = path.split(':') - flags = d['flags'] - if flags is None: - if '[' in specification or ']' in specification: - raise DistlibException("Invalid specification " - "'%s'" % specification) - flags = [] - else: - flags = [f.strip() for f in flags.split(',')] - result = ExportEntry(name, prefix, suffix, flags) - return result - - -def get_cache_base(suffix=None): - """ - Return the default base location for distlib caches. If the directory does - not exist, it is created. Use the suffix provided for the base directory, - and default to '.distlib' if it isn't provided. - - On Windows, if LOCALAPPDATA is defined in the environment, then it is - assumed to be a directory, and will be the parent directory of the result. - On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home - directory - using os.expanduser('~') - will be the parent directory of - the result. - - The result is just the directory '.distlib' in the parent directory as - determined above, or with the name specified with ``suffix``. - """ - if suffix is None: - suffix = '.distlib' - if os.name == 'nt' and 'LOCALAPPDATA' in os.environ: - result = os.path.expandvars('$localappdata') - else: - # Assume posix, or old Windows - result = os.path.expanduser('~') - # we use 'isdir' instead of 'exists', because we want to - # fail if there's a file with that name - if os.path.isdir(result): - usable = os.access(result, os.W_OK) - if not usable: - logger.warning('Directory exists but is not writable: %s', result) - else: - try: - os.makedirs(result) - usable = True - except OSError: - logger.warning('Unable to create %s', result, exc_info=True) - usable = False - if not usable: - result = tempfile.mkdtemp() - logger.warning('Default location unusable, using %s', result) - return os.path.join(result, suffix) - - -def path_to_cache_dir(path): - """ - Convert an absolute path to a directory name for use in a cache. - - The algorithm used is: - - #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. - #. Any occurrence of ``os.sep`` is replaced with ``'--'``. - #. ``'.cache'`` is appended. - """ - d, p = os.path.splitdrive(os.path.abspath(path)) - if d: - d = d.replace(':', '---') - p = p.replace(os.sep, '--') - return d + p + '.cache' - - -def ensure_slash(s): - if not s.endswith('/'): - return s + '/' - return s - - -def parse_credentials(netloc): - username = password = None - if '@' in netloc: - prefix, netloc = netloc.rsplit('@', 1) - if ':' not in prefix: - username = prefix - else: - username, password = prefix.split(':', 1) - if username: - username = unquote(username) - if password: - password = unquote(password) - return username, password, netloc - - -def get_process_umask(): - result = os.umask(0o22) - os.umask(result) - return result - -def is_string_sequence(seq): - result = True - i = None - for i, s in enumerate(seq): - if not isinstance(s, string_types): - result = False - break - assert i is not None - return result - -PROJECT_NAME_AND_VERSION = re.compile('([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-' - '([a-z0-9_.+-]+)', re.I) -PYTHON_VERSION = re.compile(r'-py(\d\.?\d?)') - - -def split_filename(filename, project_name=None): - """ - Extract name, version, python version from a filename (no extension) - - Return name, version, pyver or None - """ - result = None - pyver = None - filename = unquote(filename).replace(' ', '-') - m = PYTHON_VERSION.search(filename) - if m: - pyver = m.group(1) - filename = filename[:m.start()] - if project_name and len(filename) > len(project_name) + 1: - m = re.match(re.escape(project_name) + r'\b', filename) - if m: - n = m.end() - result = filename[:n], filename[n + 1:], pyver - if result is None: - m = PROJECT_NAME_AND_VERSION.match(filename) - if m: - result = m.group(1), m.group(3), pyver - return result - -# Allow spaces in name because of legacy dists like "Twisted Core" -NAME_VERSION_RE = re.compile(r'(?P[\w .-]+)\s*' - r'\(\s*(?P[^\s)]+)\)$') - -def parse_name_and_version(p): - """ - A utility method used to get name and version from a string. - - From e.g. a Provides-Dist value. - - :param p: A value in a form 'foo (1.0)' - :return: The name and version as a tuple. - """ - m = NAME_VERSION_RE.match(p) - if not m: - raise DistlibException('Ill-formed name/version string: \'%s\'' % p) - d = m.groupdict() - return d['name'].strip().lower(), d['ver'] - -def get_extras(requested, available): - result = set() - requested = set(requested or []) - available = set(available or []) - if '*' in requested: - requested.remove('*') - result |= available - for r in requested: - if r == '-': - result.add(r) - elif r.startswith('-'): - unwanted = r[1:] - if unwanted not in available: - logger.warning('undeclared extra: %s' % unwanted) - if unwanted in result: - result.remove(unwanted) - else: - if r not in available: - logger.warning('undeclared extra: %s' % r) - result.add(r) - return result -# -# Extended metadata functionality -# - -def _get_external_data(url): - result = {} - try: - # urlopen might fail if it runs into redirections, - # because of Python issue #13696. Fixed in locators - # using a custom redirect handler. - resp = urlopen(url) - headers = resp.info() - ct = headers.get('Content-Type') - if not ct.startswith('application/json'): - logger.debug('Unexpected response for JSON request: %s', ct) - else: - reader = codecs.getreader('utf-8')(resp) - #data = reader.read().decode('utf-8') - #result = json.loads(data) - result = json.load(reader) - except Exception as e: - logger.exception('Failed to get external data for %s: %s', url, e) - return result - -_external_data_base_url = 'https://www.red-dove.com/pypi/projects/' - -def get_project_data(name): - url = '%s/%s/project.json' % (name[0].upper(), name) - url = urljoin(_external_data_base_url, url) - result = _get_external_data(url) - return result - -def get_package_data(name, version): - url = '%s/%s/package-%s.json' % (name[0].upper(), name, version) - url = urljoin(_external_data_base_url, url) - return _get_external_data(url) - - -class Cache(object): - """ - A class implementing a cache for resources that need to live in the file system - e.g. shared libraries. This class was moved from resources to here because it - could be used by other modules, e.g. the wheel module. - """ - - def __init__(self, base): - """ - Initialise an instance. - - :param base: The base directory where the cache should be located. - """ - # we use 'isdir' instead of 'exists', because we want to - # fail if there's a file with that name - if not os.path.isdir(base): # pragma: no cover - os.makedirs(base) - if (os.stat(base).st_mode & 0o77) != 0: - logger.warning('Directory \'%s\' is not private', base) - self.base = os.path.abspath(os.path.normpath(base)) - - def prefix_to_dir(self, prefix): - """ - Converts a resource prefix to a directory name in the cache. - """ - return path_to_cache_dir(prefix) - - def clear(self): - """ - Clear the cache. - """ - not_removed = [] - for fn in os.listdir(self.base): - fn = os.path.join(self.base, fn) - try: - if os.path.islink(fn) or os.path.isfile(fn): - os.remove(fn) - elif os.path.isdir(fn): - shutil.rmtree(fn) - except Exception: - not_removed.append(fn) - return not_removed - - -class EventMixin(object): - """ - A very simple publish/subscribe system. - """ - def __init__(self): - self._subscribers = {} - - def add(self, event, subscriber, append=True): - """ - Add a subscriber for an event. - - :param event: The name of an event. - :param subscriber: The subscriber to be added (and called when the - event is published). - :param append: Whether to append or prepend the subscriber to an - existing subscriber list for the event. - """ - subs = self._subscribers - if event not in subs: - subs[event] = deque([subscriber]) - else: - sq = subs[event] - if append: - sq.append(subscriber) - else: - sq.appendleft(subscriber) - - def remove(self, event, subscriber): - """ - Remove a subscriber for an event. - - :param event: The name of an event. - :param subscriber: The subscriber to be removed. - """ - subs = self._subscribers - if event not in subs: - raise ValueError('No subscribers: %r' % event) - subs[event].remove(subscriber) - - def get_subscribers(self, event): - """ - Return an iterator for the subscribers for an event. - :param event: The event to return subscribers for. - """ - return iter(self._subscribers.get(event, ())) - - def publish(self, event, *args, **kwargs): - """ - Publish a event and return a list of values returned by its - subscribers. - - :param event: The event to publish. - :param args: The positional arguments to pass to the event's - subscribers. - :param kwargs: The keyword arguments to pass to the event's - subscribers. - """ - result = [] - for subscriber in self.get_subscribers(event): - try: - value = subscriber(event, *args, **kwargs) - except Exception: - logger.exception('Exception during event publication') - value = None - result.append(value) - logger.debug('publish %s: args = %s, kwargs = %s, result = %s', - event, args, kwargs, result) - return result - -# -# Simple sequencing -# -class Sequencer(object): - def __init__(self): - self._preds = {} - self._succs = {} - self._nodes = set() # nodes with no preds/succs - - def add_node(self, node): - self._nodes.add(node) - - def remove_node(self, node, edges=False): - if node in self._nodes: - self._nodes.remove(node) - if edges: - for p in set(self._preds.get(node, ())): - self.remove(p, node) - for s in set(self._succs.get(node, ())): - self.remove(node, s) - # Remove empties - for k, v in list(self._preds.items()): - if not v: - del self._preds[k] - for k, v in list(self._succs.items()): - if not v: - del self._succs[k] - - def add(self, pred, succ): - assert pred != succ - self._preds.setdefault(succ, set()).add(pred) - self._succs.setdefault(pred, set()).add(succ) - - def remove(self, pred, succ): - assert pred != succ - try: - preds = self._preds[succ] - succs = self._succs[pred] - except KeyError: # pragma: no cover - raise ValueError('%r not a successor of anything' % succ) - try: - preds.remove(pred) - succs.remove(succ) - except KeyError: # pragma: no cover - raise ValueError('%r not a successor of %r' % (succ, pred)) - - def is_step(self, step): - return (step in self._preds or step in self._succs or - step in self._nodes) - - def get_steps(self, final): - if not self.is_step(final): - raise ValueError('Unknown: %r' % final) - result = [] - todo = [] - seen = set() - todo.append(final) - while todo: - step = todo.pop(0) - if step in seen: - # if a step was already seen, - # move it to the end (so it will appear earlier - # when reversed on return) ... but not for the - # final step, as that would be confusing for - # users - if step != final: - result.remove(step) - result.append(step) - else: - seen.add(step) - result.append(step) - preds = self._preds.get(step, ()) - todo.extend(preds) - return reversed(result) - - @property - def strong_connections(self): - #http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm - index_counter = [0] - stack = [] - lowlinks = {} - index = {} - result = [] - - graph = self._succs - - def strongconnect(node): - # set the depth index for this node to the smallest unused index - index[node] = index_counter[0] - lowlinks[node] = index_counter[0] - index_counter[0] += 1 - stack.append(node) - - # Consider successors - try: - successors = graph[node] - except Exception: - successors = [] - for successor in successors: - if successor not in lowlinks: - # Successor has not yet been visited - strongconnect(successor) - lowlinks[node] = min(lowlinks[node],lowlinks[successor]) - elif successor in stack: - # the successor is in the stack and hence in the current - # strongly connected component (SCC) - lowlinks[node] = min(lowlinks[node],index[successor]) - - # If `node` is a root node, pop the stack and generate an SCC - if lowlinks[node] == index[node]: - connected_component = [] - - while True: - successor = stack.pop() - connected_component.append(successor) - if successor == node: break - component = tuple(connected_component) - # storing the result - result.append(component) - - for node in graph: - if node not in lowlinks: - strongconnect(node) - - return result - - @property - def dot(self): - result = ['digraph G {'] - for succ in self._preds: - preds = self._preds[succ] - for pred in preds: - result.append(' %s -> %s;' % (pred, succ)) - for node in self._nodes: - result.append(' %s;' % node) - result.append('}') - return '\n'.join(result) - -# -# Unarchiving functionality for zip, tar, tgz, tbz, whl -# - -ARCHIVE_EXTENSIONS = ('.tar.gz', '.tar.bz2', '.tar', '.zip', - '.tgz', '.tbz', '.whl') - -def unarchive(archive_filename, dest_dir, format=None, check=True): - - def check_path(path): - if not isinstance(path, text_type): - path = path.decode('utf-8') - p = os.path.abspath(os.path.join(dest_dir, path)) - if not p.startswith(dest_dir) or p[plen] != os.sep: - raise ValueError('path outside destination: %r' % p) - - dest_dir = os.path.abspath(dest_dir) - plen = len(dest_dir) - archive = None - if format is None: - if archive_filename.endswith(('.zip', '.whl')): - format = 'zip' - elif archive_filename.endswith(('.tar.gz', '.tgz')): - format = 'tgz' - mode = 'r:gz' - elif archive_filename.endswith(('.tar.bz2', '.tbz')): - format = 'tbz' - mode = 'r:bz2' - elif archive_filename.endswith('.tar'): - format = 'tar' - mode = 'r' - else: # pragma: no cover - raise ValueError('Unknown format for %r' % archive_filename) - try: - if format == 'zip': - archive = ZipFile(archive_filename, 'r') - if check: - names = archive.namelist() - for name in names: - check_path(name) - else: - archive = tarfile.open(archive_filename, mode) - if check: - names = archive.getnames() - for name in names: - check_path(name) - if format != 'zip' and sys.version_info[0] < 3: - # See Python issue 17153. If the dest path contains Unicode, - # tarfile extraction fails on Python 2.x if a member path name - # contains non-ASCII characters - it leads to an implicit - # bytes -> unicode conversion using ASCII to decode. - for tarinfo in archive.getmembers(): - if not isinstance(tarinfo.name, text_type): - tarinfo.name = tarinfo.name.decode('utf-8') - archive.extractall(dest_dir) - - finally: - if archive: - archive.close() - - -def zip_dir(directory): - """zip a directory tree into a BytesIO object""" - result = io.BytesIO() - dlen = len(directory) - with ZipFile(result, "w") as zf: - for root, dirs, files in os.walk(directory): - for name in files: - full = os.path.join(root, name) - rel = root[dlen:] - dest = os.path.join(rel, name) - zf.write(full, dest) - return result - -# -# Simple progress bar -# - -UNITS = ('', 'K', 'M', 'G','T','P') - - -class Progress(object): - unknown = 'UNKNOWN' - - def __init__(self, minval=0, maxval=100): - assert maxval is None or maxval >= minval - self.min = self.cur = minval - self.max = maxval - self.started = None - self.elapsed = 0 - self.done = False - - def update(self, curval): - assert self.min <= curval - assert self.max is None or curval <= self.max - self.cur = curval - now = time.time() - if self.started is None: - self.started = now - else: - self.elapsed = now - self.started - - def increment(self, incr): - assert incr >= 0 - self.update(self.cur + incr) - - def start(self): - self.update(self.min) - return self - - def stop(self): - if self.max is not None: - self.update(self.max) - self.done = True - - @property - def maximum(self): - return self.unknown if self.max is None else self.max - - @property - def percentage(self): - if self.done: - result = '100 %' - elif self.max is None: - result = ' ?? %' - else: - v = 100.0 * (self.cur - self.min) / (self.max - self.min) - result = '%3d %%' % v - return result - - def format_duration(self, duration): - if (duration <= 0) and self.max is None or self.cur == self.min: - result = '??:??:??' - #elif duration < 1: - # result = '--:--:--' - else: - result = time.strftime('%H:%M:%S', time.gmtime(duration)) - return result - - @property - def ETA(self): - if self.done: - prefix = 'Done' - t = self.elapsed - #import pdb; pdb.set_trace() - else: - prefix = 'ETA ' - if self.max is None: - t = -1 - elif self.elapsed == 0 or (self.cur == self.min): - t = 0 - else: - #import pdb; pdb.set_trace() - t = float(self.max - self.min) - t /= self.cur - self.min - t = (t - 1) * self.elapsed - return '%s: %s' % (prefix, self.format_duration(t)) - - @property - def speed(self): - if self.elapsed == 0: - result = 0.0 - else: - result = (self.cur - self.min) / self.elapsed - for unit in UNITS: - if result < 1000: - break - result /= 1000.0 - return '%d %sB/s' % (result, unit) - -# -# Glob functionality -# - -RICH_GLOB = re.compile(r'\{([^}]*)\}') -_CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]') -_CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$') - - -def iglob(path_glob): - """Extended globbing function that supports ** and {opt1,opt2,opt3}.""" - if _CHECK_RECURSIVE_GLOB.search(path_glob): - msg = """invalid glob %r: recursive glob "**" must be used alone""" - raise ValueError(msg % path_glob) - if _CHECK_MISMATCH_SET.search(path_glob): - msg = """invalid glob %r: mismatching set marker '{' or '}'""" - raise ValueError(msg % path_glob) - return _iglob(path_glob) - - -def _iglob(path_glob): - rich_path_glob = RICH_GLOB.split(path_glob, 1) - if len(rich_path_glob) > 1: - assert len(rich_path_glob) == 3, rich_path_glob - prefix, set, suffix = rich_path_glob - for item in set.split(','): - for path in _iglob(''.join((prefix, item, suffix))): - yield path - else: - if '**' not in path_glob: - for item in std_iglob(path_glob): - yield item - else: - prefix, radical = path_glob.split('**', 1) - if prefix == '': - prefix = '.' - if radical == '': - radical = '*' - else: - # we support both - radical = radical.lstrip('/') - radical = radical.lstrip('\\') - for path, dir, files in os.walk(prefix): - path = os.path.normpath(path) - for fn in _iglob(os.path.join(path, radical)): - yield fn - -if ssl: - from .compat import (HTTPSHandler as BaseHTTPSHandler, match_hostname, - CertificateError) - - -# -# HTTPSConnection which verifies certificates/matches domains -# - - class HTTPSConnection(httplib.HTTPSConnection): - ca_certs = None # set this to the path to the certs file (.pem) - check_domain = True # only used if ca_certs is not None - - # noinspection PyPropertyAccess - def connect(self): - sock = socket.create_connection((self.host, self.port), self.timeout) - if getattr(self, '_tunnel_host', False): - self.sock = sock - self._tunnel() - - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - if hasattr(ssl, 'OP_NO_SSLv2'): - context.options |= ssl.OP_NO_SSLv2 - if self.cert_file: - context.load_cert_chain(self.cert_file, self.key_file) - kwargs = {} - if self.ca_certs: - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(cafile=self.ca_certs) - if getattr(ssl, 'HAS_SNI', False): - kwargs['server_hostname'] = self.host - - self.sock = context.wrap_socket(sock, **kwargs) - if self.ca_certs and self.check_domain: - try: - match_hostname(self.sock.getpeercert(), self.host) - logger.debug('Host verified: %s', self.host) - except CertificateError: # pragma: no cover - self.sock.shutdown(socket.SHUT_RDWR) - self.sock.close() - raise - - class HTTPSHandler(BaseHTTPSHandler): - def __init__(self, ca_certs, check_domain=True): - BaseHTTPSHandler.__init__(self) - self.ca_certs = ca_certs - self.check_domain = check_domain - - def _conn_maker(self, *args, **kwargs): - """ - This is called to create a connection instance. Normally you'd - pass a connection class to do_open, but it doesn't actually check for - a class, and just expects a callable. As long as we behave just as a - constructor would have, we should be OK. If it ever changes so that - we *must* pass a class, we'll create an UnsafeHTTPSConnection class - which just sets check_domain to False in the class definition, and - choose which one to pass to do_open. - """ - result = HTTPSConnection(*args, **kwargs) - if self.ca_certs: - result.ca_certs = self.ca_certs - result.check_domain = self.check_domain - return result - - def https_open(self, req): - try: - return self.do_open(self._conn_maker, req) - except URLError as e: - if 'certificate verify failed' in str(e.reason): - raise CertificateError('Unable to verify server certificate ' - 'for %s' % req.host) - else: - raise - - # - # To prevent against mixing HTTP traffic with HTTPS (examples: A Man-In-The- - # Middle proxy using HTTP listens on port 443, or an index mistakenly serves - # HTML containing a http://xyz link when it should be https://xyz), - # you can use the following handler class, which does not allow HTTP traffic. - # - # It works by inheriting from HTTPHandler - so build_opener won't add a - # handler for HTTP itself. - # - class HTTPSOnlyHandler(HTTPSHandler, HTTPHandler): - def http_open(self, req): - raise URLError('Unexpected HTTP request on what should be a secure ' - 'connection: %s' % req) - -# -# XML-RPC with timeouts -# -class Transport(xmlrpclib.Transport): - def __init__(self, timeout, use_datetime=0): - self.timeout = timeout - xmlrpclib.Transport.__init__(self, use_datetime) - - def make_connection(self, host): - h, eh, x509 = self.get_host_info(host) - if not self._connection or host != self._connection[0]: - self._extra_headers = eh - self._connection = host, httplib.HTTPConnection(h) - return self._connection[1] - -if ssl: - class SafeTransport(xmlrpclib.SafeTransport): - def __init__(self, timeout, use_datetime=0): - self.timeout = timeout - xmlrpclib.SafeTransport.__init__(self, use_datetime) - - def make_connection(self, host): - h, eh, kwargs = self.get_host_info(host) - if not kwargs: - kwargs = {} - kwargs['timeout'] = self.timeout - if not self._connection or host != self._connection[0]: - self._extra_headers = eh - self._connection = host, httplib.HTTPSConnection(h, None, - **kwargs) - return self._connection[1] - - -class ServerProxy(xmlrpclib.ServerProxy): - def __init__(self, uri, **kwargs): - self.timeout = timeout = kwargs.pop('timeout', None) - # The above classes only come into play if a timeout - # is specified - if timeout is not None: - # scheme = splittype(uri) # deprecated as of Python 3.8 - scheme = urlparse(uri)[0] - use_datetime = kwargs.get('use_datetime', 0) - if scheme == 'https': - tcls = SafeTransport - else: - tcls = Transport - kwargs['transport'] = t = tcls(timeout, use_datetime=use_datetime) - self.transport = t - xmlrpclib.ServerProxy.__init__(self, uri, **kwargs) - -# -# CSV functionality. This is provided because on 2.x, the csv module can't -# handle Unicode. However, we need to deal with Unicode in e.g. RECORD files. -# - -def _csv_open(fn, mode, **kwargs): - if sys.version_info[0] < 3: - mode += 'b' - else: - kwargs['newline'] = '' - # Python 3 determines encoding from locale. Force 'utf-8' - # file encoding to match other forced utf-8 encoding - kwargs['encoding'] = 'utf-8' - return open(fn, mode, **kwargs) - - -class CSVBase(object): - defaults = { - 'delimiter': str(','), # The strs are used because we need native - 'quotechar': str('"'), # str in the csv API (2.x won't take - 'lineterminator': str('\n') # Unicode) - } - - def __enter__(self): - return self - - def __exit__(self, *exc_info): - self.stream.close() - - -class CSVReader(CSVBase): - def __init__(self, **kwargs): - if 'stream' in kwargs: - stream = kwargs['stream'] - if sys.version_info[0] >= 3: - # needs to be a text stream - stream = codecs.getreader('utf-8')(stream) - self.stream = stream - else: - self.stream = _csv_open(kwargs['path'], 'r') - self.reader = csv.reader(self.stream, **self.defaults) - - def __iter__(self): - return self - - def next(self): - result = next(self.reader) - if sys.version_info[0] < 3: - for i, item in enumerate(result): - if not isinstance(item, text_type): - result[i] = item.decode('utf-8') - return result - - __next__ = next - -class CSVWriter(CSVBase): - def __init__(self, fn, **kwargs): - self.stream = _csv_open(fn, 'w') - self.writer = csv.writer(self.stream, **self.defaults) - - def writerow(self, row): - if sys.version_info[0] < 3: - r = [] - for item in row: - if isinstance(item, text_type): - item = item.encode('utf-8') - r.append(item) - row = r - self.writer.writerow(row) - -# -# Configurator functionality -# - -class Configurator(BaseConfigurator): - - value_converters = dict(BaseConfigurator.value_converters) - value_converters['inc'] = 'inc_convert' - - def __init__(self, config, base=None): - super(Configurator, self).__init__(config) - self.base = base or os.getcwd() - - def configure_custom(self, config): - def convert(o): - if isinstance(o, (list, tuple)): - result = type(o)([convert(i) for i in o]) - elif isinstance(o, dict): - if '()' in o: - result = self.configure_custom(o) - else: - result = {} - for k in o: - result[k] = convert(o[k]) - else: - result = self.convert(o) - return result - - c = config.pop('()') - if not callable(c): - c = self.resolve(c) - props = config.pop('.', None) - # Check for valid identifiers - args = config.pop('[]', ()) - if args: - args = tuple([convert(o) for o in args]) - items = [(k, convert(config[k])) for k in config if valid_ident(k)] - kwargs = dict(items) - result = c(*args, **kwargs) - if props: - for n, v in props.items(): - setattr(result, n, convert(v)) - return result - - def __getitem__(self, key): - result = self.config[key] - if isinstance(result, dict) and '()' in result: - self.config[key] = result = self.configure_custom(result) - return result - - def inc_convert(self, value): - """Default converter for the inc:// protocol.""" - if not os.path.isabs(value): - value = os.path.join(self.base, value) - with codecs.open(value, 'r', encoding='utf-8') as f: - result = json.load(f) - return result - - -class SubprocessMixin(object): - """ - Mixin for running subprocesses and capturing their output - """ - def __init__(self, verbose=False, progress=None): - self.verbose = verbose - self.progress = progress - - def reader(self, stream, context): - """ - Read lines from a subprocess' output stream and either pass to a progress - callable (if specified) or write progress information to sys.stderr. - """ - progress = self.progress - verbose = self.verbose - while True: - s = stream.readline() - if not s: - break - if progress is not None: - progress(s, context) - else: - if not verbose: - sys.stderr.write('.') - else: - sys.stderr.write(s.decode('utf-8')) - sys.stderr.flush() - stream.close() - - def run_command(self, cmd, **kwargs): - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, **kwargs) - t1 = threading.Thread(target=self.reader, args=(p.stdout, 'stdout')) - t1.start() - t2 = threading.Thread(target=self.reader, args=(p.stderr, 'stderr')) - t2.start() - p.wait() - t1.join() - t2.join() - if self.progress is not None: - self.progress('done.', 'main') - elif self.verbose: - sys.stderr.write('done.\n') - return p - - -def normalize_name(name): - """Normalize a python package name a la PEP 503""" - # https://www.python.org/dev/peps/pep-0503/#normalized-names - return re.sub('[-_.]+', '-', name).lower() - -# def _get_pypirc_command(): - # """ - # Get the distutils command for interacting with PyPI configurations. - # :return: the command. - # """ - # from distutils.core import Distribution - # from distutils.config import PyPIRCCommand - # d = Distribution() - # return PyPIRCCommand(d) - -class PyPIRCFile(object): - - DEFAULT_REPOSITORY = 'https://upload.pypi.org/legacy/' - DEFAULT_REALM = 'pypi' - - def __init__(self, fn=None, url=None): - if fn is None: - fn = os.path.join(os.path.expanduser('~'), '.pypirc') - self.filename = fn - self.url = url - - def read(self): - result = {} - - if os.path.exists(self.filename): - repository = self.url or self.DEFAULT_REPOSITORY - - config = configparser.RawConfigParser() - config.read(self.filename) - sections = config.sections() - if 'distutils' in sections: - # let's get the list of servers - index_servers = config.get('distutils', 'index-servers') - _servers = [server.strip() for server in - index_servers.split('\n') - if server.strip() != ''] - if _servers == []: - # nothing set, let's try to get the default pypi - if 'pypi' in sections: - _servers = ['pypi'] - else: - for server in _servers: - result = {'server': server} - result['username'] = config.get(server, 'username') - - # optional params - for key, default in (('repository', self.DEFAULT_REPOSITORY), - ('realm', self.DEFAULT_REALM), - ('password', None)): - if config.has_option(server, key): - result[key] = config.get(server, key) - else: - result[key] = default - - # work around people having "repository" for the "pypi" - # section of their config set to the HTTP (rather than - # HTTPS) URL - if (server == 'pypi' and - repository in (self.DEFAULT_REPOSITORY, 'pypi')): - result['repository'] = self.DEFAULT_REPOSITORY - elif (result['server'] != repository and - result['repository'] != repository): - result = {} - elif 'server-login' in sections: - # old format - server = 'server-login' - if config.has_option(server, 'repository'): - repository = config.get(server, 'repository') - else: - repository = self.DEFAULT_REPOSITORY - result = { - 'username': config.get(server, 'username'), - 'password': config.get(server, 'password'), - 'repository': repository, - 'server': server, - 'realm': self.DEFAULT_REALM - } - return result - - def update(self, username, password): - # import pdb; pdb.set_trace() - config = configparser.RawConfigParser() - fn = self.filename - config.read(fn) - if not config.has_section('pypi'): - config.add_section('pypi') - config.set('pypi', 'username', username) - config.set('pypi', 'password', password) - with open(fn, 'w') as f: - config.write(f) - -def _load_pypirc(index): - """ - Read the PyPI access configuration as supported by distutils. - """ - return PyPIRCFile(url=index.url).read() - -def _store_pypirc(index): - PyPIRCFile().update(index.username, index.password) - -# -# get_platform()/get_host_platform() copied from Python 3.10.a0 source, with some minor -# tweaks -# - -def get_host_platform(): - """Return a string that identifies the current platform. This is used mainly to - distinguish platform-specific build directories and platform-specific built - distributions. Typically includes the OS name and version and the - architecture (as supplied by 'os.uname()'), although the exact information - included depends on the OS; eg. on Linux, the kernel version isn't - particularly important. - - Examples of returned values: - linux-i586 - linux-alpha (?) - solaris-2.6-sun4u - - Windows will return one of: - win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) - win32 (all others - specifically, sys.platform is returned) - - For other non-POSIX platforms, currently just returns 'sys.platform'. - - """ - if os.name == 'nt': - if 'amd64' in sys.version.lower(): - return 'win-amd64' - if '(arm)' in sys.version.lower(): - return 'win-arm32' - if '(arm64)' in sys.version.lower(): - return 'win-arm64' - return sys.platform - - # Set for cross builds explicitly - if "_PYTHON_HOST_PLATFORM" in os.environ: - return os.environ["_PYTHON_HOST_PLATFORM"] - - if os.name != 'posix' or not hasattr(os, 'uname'): - # XXX what about the architecture? NT is Intel or Alpha, - # Mac OS is M68k or PPC, etc. - return sys.platform - - # Try to distinguish various flavours of Unix - - (osname, host, release, version, machine) = os.uname() - - # Convert the OS name to lowercase, remove '/' characters, and translate - # spaces (for "Power Macintosh") - osname = osname.lower().replace('/', '') - machine = machine.replace(' ', '_').replace('/', '-') - - if osname[:5] == 'linux': - # At least on Linux/Intel, 'machine' is the processor -- - # i386, etc. - # XXX what about Alpha, SPARC, etc? - return "%s-%s" % (osname, machine) - - elif osname[:5] == 'sunos': - if release[0] >= '5': # SunOS 5 == Solaris 2 - osname = 'solaris' - release = '%d.%s' % (int(release[0]) - 3, release[2:]) - # We can't use 'platform.architecture()[0]' because a - # bootstrap problem. We use a dict to get an error - # if some suspicious happens. - bitness = {2147483647:'32bit', 9223372036854775807:'64bit'} - machine += '.%s' % bitness[sys.maxsize] - # fall through to standard osname-release-machine representation - elif osname[:3] == 'aix': - from _aix_support import aix_platform - return aix_platform() - elif osname[:6] == 'cygwin': - osname = 'cygwin' - rel_re = re.compile (r'[\d.]+', re.ASCII) - m = rel_re.match(release) - if m: - release = m.group() - elif osname[:6] == 'darwin': - import _osx_support, distutils.sysconfig - osname, release, machine = _osx_support.get_platform_osx( - distutils.sysconfig.get_config_vars(), - osname, release, machine) - - return '%s-%s-%s' % (osname, release, machine) - - -_TARGET_TO_PLAT = { - 'x86' : 'win32', - 'x64' : 'win-amd64', - 'arm' : 'win-arm32', -} - - -def get_platform(): - if os.name != 'nt': - return get_host_platform() - cross_compilation_target = os.environ.get('VSCMD_ARG_TGT_ARCH') - if cross_compilation_target not in _TARGET_TO_PLAT: - return get_host_platform() - return _TARGET_TO_PLAT[cross_compilation_target] diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/packaging/_musllinux.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/packaging/_musllinux.py deleted file mode 100644 index 8ac3059ba3c246b9a5a6fb8d14936bb07777191e..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +++ /dev/null @@ -1,136 +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 contextlib -import functools -import operator -import os -import re -import struct -import subprocess -import sys -from typing import IO, Iterator, NamedTuple, Optional, Tuple - - -def _read_unpacked(f: IO[bytes], fmt: str) -> Tuple[int, ...]: - return struct.unpack(fmt, f.read(struct.calcsize(fmt))) - - -def _parse_ld_musl_from_elf(f: IO[bytes]) -> Optional[str]: - """Detect musl libc location by parsing the Python executable. - - Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca - ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html - """ - f.seek(0) - try: - ident = _read_unpacked(f, "16B") - except struct.error: - return None - if ident[:4] != tuple(b"\x7fELF"): # Invalid magic, not ELF. - return None - f.seek(struct.calcsize("HHI"), 1) # Skip file type, machine, and version. - - try: - # e_fmt: Format for program header. - # p_fmt: Format for section header. - # p_idx: Indexes to find p_type, p_offset, and p_filesz. - e_fmt, p_fmt, p_idx = { - 1: ("IIIIHHH", "IIIIIIII", (0, 1, 4)), # 32-bit. - 2: ("QQQIHHH", "IIQQQQQQ", (0, 2, 5)), # 64-bit. - }[ident[4]] - except KeyError: - return None - else: - p_get = operator.itemgetter(*p_idx) - - # Find the interpreter section and return its content. - try: - _, e_phoff, _, _, _, e_phentsize, e_phnum = _read_unpacked(f, e_fmt) - except struct.error: - return None - for i in range(e_phnum + 1): - f.seek(e_phoff + e_phentsize * i) - try: - p_type, p_offset, p_filesz = p_get(_read_unpacked(f, p_fmt)) - except struct.error: - return None - if p_type != 3: # Not PT_INTERP. - continue - f.seek(p_offset) - interpreter = os.fsdecode(f.read(p_filesz)).strip("\0") - if "musl" not in interpreter: - return None - return interpreter - return None - - -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 - """ - with contextlib.ExitStack() as stack: - try: - f = stack.enter_context(open(executable, "rb")) - except OSError: - return None - ld = _parse_ld_musl_from_elf(f) - if not 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/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/rich/abc.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/rich/abc.py deleted file mode 100644 index e6e498efabfab0dcf31cd7731f8f821cc423bc4f..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/rich/abc.py +++ /dev/null @@ -1,33 +0,0 @@ -from abc import ABC - - -class RichRenderable(ABC): - """An abstract base class for Rich renderables. - - Note that there is no need to extend this class, the intended use is to check if an - object supports the Rich renderable protocol. For example:: - - if isinstance(my_object, RichRenderable): - console.print(my_object) - - """ - - @classmethod - def __subclasshook__(cls, other: type) -> bool: - """Check if this class supports the rich render protocol.""" - return hasattr(other, "__rich_console__") or hasattr(other, "__rich__") - - -if __name__ == "__main__": # pragma: no cover - from pip._vendor.rich.text import Text - - t = Text() - print(isinstance(Text, RichRenderable)) - print(isinstance(t, RichRenderable)) - - class Foo: - pass - - f = Foo() - print(isinstance(f, RichRenderable)) - print(isinstance("", RichRenderable)) diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py deleted file mode 100644 index c326e80dd117458ff6e71741ca57359629b05ae4..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +++ /dev/null @@ -1,216 +0,0 @@ -# -*- coding: utf-8 -*- -""" -This module contains provisional support for SOCKS proxies from within -urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and -SOCKS5. To enable its functionality, either install PySocks or install this -module with the ``socks`` extra. - -The SOCKS implementation supports the full range of urllib3 features. It also -supports the following SOCKS features: - -- SOCKS4A (``proxy_url='socks4a://...``) -- SOCKS4 (``proxy_url='socks4://...``) -- SOCKS5 with remote DNS (``proxy_url='socks5h://...``) -- SOCKS5 with local DNS (``proxy_url='socks5://...``) -- Usernames and passwords for the SOCKS proxy - -.. note:: - It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in - your ``proxy_url`` to ensure that DNS resolution is done from the remote - server instead of client-side when connecting to a domain name. - -SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5 -supports IPv4, IPv6, and domain names. - -When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url`` -will be sent as the ``userid`` section of the SOCKS request: - -.. code-block:: python - - proxy_url="socks4a://@proxy-host" - -When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion -of the ``proxy_url`` will be sent as the username/password to authenticate -with the proxy: - -.. code-block:: python - - proxy_url="socks5h://:@proxy-host" - -""" -from __future__ import absolute_import - -try: - import socks -except ImportError: - import warnings - - from ..exceptions import DependencyWarning - - warnings.warn( - ( - "SOCKS support in urllib3 requires the installation of optional " - "dependencies: specifically, PySocks. For more information, see " - "https://urllib3.readthedocs.io/en/1.26.x/contrib.html#socks-proxies" - ), - DependencyWarning, - ) - raise - -from socket import error as SocketError -from socket import timeout as SocketTimeout - -from ..connection import HTTPConnection, HTTPSConnection -from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool -from ..exceptions import ConnectTimeoutError, NewConnectionError -from ..poolmanager import PoolManager -from ..util.url import parse_url - -try: - import ssl -except ImportError: - ssl = None - - -class SOCKSConnection(HTTPConnection): - """ - A plain-text HTTP connection that connects via a SOCKS proxy. - """ - - def __init__(self, *args, **kwargs): - self._socks_options = kwargs.pop("_socks_options") - super(SOCKSConnection, self).__init__(*args, **kwargs) - - def _new_conn(self): - """ - Establish a new connection via the SOCKS proxy. - """ - extra_kw = {} - if self.source_address: - extra_kw["source_address"] = self.source_address - - if self.socket_options: - extra_kw["socket_options"] = self.socket_options - - try: - conn = socks.create_connection( - (self.host, self.port), - proxy_type=self._socks_options["socks_version"], - proxy_addr=self._socks_options["proxy_host"], - proxy_port=self._socks_options["proxy_port"], - proxy_username=self._socks_options["username"], - proxy_password=self._socks_options["password"], - proxy_rdns=self._socks_options["rdns"], - timeout=self.timeout, - **extra_kw - ) - - except SocketTimeout: - raise ConnectTimeoutError( - self, - "Connection to %s timed out. (connect timeout=%s)" - % (self.host, self.timeout), - ) - - except socks.ProxyError as e: - # This is fragile as hell, but it seems to be the only way to raise - # useful errors here. - if e.socket_err: - error = e.socket_err - if isinstance(error, SocketTimeout): - raise ConnectTimeoutError( - self, - "Connection to %s timed out. (connect timeout=%s)" - % (self.host, self.timeout), - ) - else: - raise NewConnectionError( - self, "Failed to establish a new connection: %s" % error - ) - else: - raise NewConnectionError( - self, "Failed to establish a new connection: %s" % e - ) - - except SocketError as e: # Defensive: PySocks should catch all these. - raise NewConnectionError( - self, "Failed to establish a new connection: %s" % e - ) - - return conn - - -# We don't need to duplicate the Verified/Unverified distinction from -# urllib3/connection.py here because the HTTPSConnection will already have been -# correctly set to either the Verified or Unverified form by that module. This -# means the SOCKSHTTPSConnection will automatically be the correct type. -class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): - pass - - -class SOCKSHTTPConnectionPool(HTTPConnectionPool): - ConnectionCls = SOCKSConnection - - -class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): - ConnectionCls = SOCKSHTTPSConnection - - -class SOCKSProxyManager(PoolManager): - """ - A version of the urllib3 ProxyManager that routes connections via the - defined SOCKS proxy. - """ - - pool_classes_by_scheme = { - "http": SOCKSHTTPConnectionPool, - "https": SOCKSHTTPSConnectionPool, - } - - def __init__( - self, - proxy_url, - username=None, - password=None, - num_pools=10, - headers=None, - **connection_pool_kw - ): - parsed = parse_url(proxy_url) - - if username is None and password is None and parsed.auth is not None: - split = parsed.auth.split(":") - if len(split) == 2: - username, password = split - if parsed.scheme == "socks5": - socks_version = socks.PROXY_TYPE_SOCKS5 - rdns = False - elif parsed.scheme == "socks5h": - socks_version = socks.PROXY_TYPE_SOCKS5 - rdns = True - elif parsed.scheme == "socks4": - socks_version = socks.PROXY_TYPE_SOCKS4 - rdns = False - elif parsed.scheme == "socks4a": - socks_version = socks.PROXY_TYPE_SOCKS4 - rdns = True - else: - raise ValueError("Unable to determine SOCKS version from %s" % proxy_url) - - self.proxy_url = proxy_url - - socks_options = { - "socks_version": socks_version, - "proxy_host": parsed.host, - "proxy_port": parsed.port, - "username": username, - "password": password, - "rdns": rdns, - } - connection_pool_kw["_socks_options"] = socks_options - - super(SOCKSProxyManager, self).__init__( - num_pools, headers, **connection_pool_kw - ) - - self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme diff --git a/spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/evaluation/cityscapes_evaluation.py b/spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/evaluation/cityscapes_evaluation.py deleted file mode 100644 index 5af78f6854f72c0f2537e34bc056d4a8b6541da6..0000000000000000000000000000000000000000 --- a/spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/evaluation/cityscapes_evaluation.py +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -import glob -import logging -import os -import tempfile -from collections import OrderedDict -import torch -from fvcore.common.file_io import PathManager -from PIL import Image - -from detectron2.data import MetadataCatalog -from detectron2.utils import comm - -from .evaluator import DatasetEvaluator - - -class CityscapesEvaluator(DatasetEvaluator): - """ - Evaluate instance segmentation results using cityscapes API. - - Note: - * It does not work in multi-machine distributed training. - * It contains a synchronization, therefore has to be used on all ranks. - * Only the main process runs evaluation. - """ - - def __init__(self, dataset_name): - """ - Args: - dataset_name (str): the name of the dataset. - It must have the following metadata associated with it: - "thing_classes", "gt_dir". - """ - self._metadata = MetadataCatalog.get(dataset_name) - self._cpu_device = torch.device("cpu") - self._logger = logging.getLogger(__name__) - - def reset(self): - self._working_dir = tempfile.TemporaryDirectory(prefix="cityscapes_eval_") - self._temp_dir = self._working_dir.name - # All workers will write to the same results directory - # TODO this does not work in distributed training - self._temp_dir = comm.all_gather(self._temp_dir)[0] - if self._temp_dir != self._working_dir.name: - self._working_dir.cleanup() - self._logger.info( - "Writing cityscapes results to temporary directory {} ...".format(self._temp_dir) - ) - - def process(self, inputs, outputs): - from cityscapesscripts.helpers.labels import name2label - - for input, output in zip(inputs, outputs): - file_name = input["file_name"] - basename = os.path.splitext(os.path.basename(file_name))[0] - pred_txt = os.path.join(self._temp_dir, basename + "_pred.txt") - - output = output["instances"].to(self._cpu_device) - num_instances = len(output) - with open(pred_txt, "w") as fout: - for i in range(num_instances): - pred_class = output.pred_classes[i] - classes = self._metadata.thing_classes[pred_class] - class_id = name2label[classes].id - score = output.scores[i] - mask = output.pred_masks[i].numpy().astype("uint8") - png_filename = os.path.join( - self._temp_dir, basename + "_{}_{}.png".format(i, classes) - ) - - Image.fromarray(mask * 255).save(png_filename) - fout.write("{} {} {}\n".format(os.path.basename(png_filename), class_id, score)) - - def evaluate(self): - """ - Returns: - dict: has a key "segm", whose value is a dict of "AP" and "AP50". - """ - comm.synchronize() - if comm.get_rank() > 0: - return - import cityscapesscripts.evaluation.evalInstanceLevelSemanticLabeling as cityscapes_eval - - self._logger.info("Evaluating results under {} ...".format(self._temp_dir)) - - # set some global states in cityscapes evaluation API, before evaluating - cityscapes_eval.args.predictionPath = os.path.abspath(self._temp_dir) - cityscapes_eval.args.predictionWalk = None - cityscapes_eval.args.JSONOutput = False - cityscapes_eval.args.colorized = False - cityscapes_eval.args.gtInstancesFile = os.path.join(self._temp_dir, "gtInstances.json") - - # These lines are adopted from - # https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/evaluation/evalInstanceLevelSemanticLabeling.py # noqa - gt_dir = PathManager.get_local_path(self._metadata.gt_dir) - groundTruthImgList = glob.glob(os.path.join(gt_dir, "*", "*_gtFine_instanceIds.png")) - assert len( - groundTruthImgList - ), "Cannot find any ground truth images to use for evaluation. Searched for: {}".format( - cityscapes_eval.args.groundTruthSearch - ) - predictionImgList = [] - for gt in groundTruthImgList: - predictionImgList.append(cityscapes_eval.getPrediction(gt, cityscapes_eval.args)) - results = cityscapes_eval.evaluateImgLists( - predictionImgList, groundTruthImgList, cityscapes_eval.args - )["averages"] - - ret = OrderedDict() - ret["segm"] = {"AP": results["allAp"] * 100, "AP50": results["allAp50%"] * 100} - self._working_dir.cleanup() - return ret diff --git a/spaces/CVPR/LIVE/thrust/thrust/allocate_unique.h b/spaces/CVPR/LIVE/thrust/thrust/allocate_unique.h deleted file mode 100644 index 6e67d1b18a6dd8c4e8dd27a0f78531819489d6a4..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/allocate_unique.h +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) 2018 NVIDIA Corporation -// Author: Bryce Adelstein Lelbach -// -// Distributed under the Boost Software License v1.0 (boost.org/LICENSE_1_0.txt) - -#pragma once - -#include -#include - -#if THRUST_CPP_DIALECT >= 2011 - -#include -#include -#include -#include - -#include -#include - -namespace thrust -{ - -// wg21.link/p0316r0 - -/////////////////////////////////////////////////////////////////////////////// - -namespace detail -{ - -template -void allocator_delete_impl( - Allocator const& alloc, Pointer p, std::false_type -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >; - - typename traits::allocator_type alloc_T(alloc); - - if (nullptr != pointer_traits::get(p)) - { - traits::destroy(alloc_T, thrust::raw_pointer_cast(p)); - traits::deallocate(alloc_T, p, 1); - } -} - -template -void allocator_delete_impl( - Allocator const& alloc, Pointer p, std::true_type -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >; - - typename traits::allocator_type alloc_T(alloc); - - if (nullptr != pointer_traits::get(p)) - { - traits::deallocate(alloc_T, p, 1); - } -} - -} // namespace detail - -template -struct allocator_delete final -{ - using allocator_type - = typename std::remove_cv< - typename std::remove_reference::type - >::type::template rebind::other; - using pointer = typename detail::allocator_traits::pointer; - - template - allocator_delete(UAllocator&& other) noexcept - : alloc_(THRUST_FWD(other)) - {} - - template - allocator_delete( - allocator_delete const& other - ) noexcept - : alloc_(other.get_allocator()) - {} - template - allocator_delete( - allocator_delete&& other - ) noexcept - : alloc_(std::move(other.get_allocator())) - {} - - template - allocator_delete& operator=( - allocator_delete const& other - ) noexcept - { - alloc_ = other.get_allocator(); - return *this; - } - template - allocator_delete& operator=( - allocator_delete&& other - ) noexcept - { - alloc_ = std::move(other.get_allocator()); - return *this; - } - - void operator()(pointer p) - { - std::integral_constant ic; - - detail::allocator_delete_impl(get_allocator(), p, ic); - } - - allocator_type& get_allocator() noexcept { return alloc_; } - allocator_type const& get_allocator() const noexcept { return alloc_; } - - void swap(allocator_delete& other) noexcept - { - using std::swap; - swap(alloc_, other.alloc_); - } - -private: - allocator_type alloc_; -}; - -template -using uninitialized_allocator_delete = allocator_delete; - -namespace detail { - -template -void array_allocator_delete_impl( - Allocator const& alloc, Pointer p, Size count, std::false_type -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >; - - typename traits::allocator_type alloc_T(alloc); - - if (nullptr != pointer_traits::get(p)) - { - destroy_n(alloc_T, p, count); - traits::deallocate(alloc_T, p, count); - } -} - -template -void array_allocator_delete_impl( - Allocator const& alloc, Pointer p, Size count, std::true_type -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >; - - typename traits::allocator_type alloc_T(alloc); - - if (nullptr != pointer_traits::get(p)) - { - traits::deallocate(alloc_T, p, count); - } -} - -} // namespace detail - -template -struct array_allocator_delete final -{ - using allocator_type - = typename std::remove_cv< - typename std::remove_reference::type - >::type::template rebind::other; - using pointer = typename detail::allocator_traits::pointer; - - template - array_allocator_delete(UAllocator&& other, std::size_t n) noexcept - : alloc_(THRUST_FWD(other)), count_(n) - {} - - template - array_allocator_delete( - array_allocator_delete const& other - ) noexcept - : alloc_(other.get_allocator()), count_(other.count_) - {} - template - array_allocator_delete( - array_allocator_delete&& other - ) noexcept - : alloc_(std::move(other.get_allocator())), count_(other.count_) - {} - - template - array_allocator_delete& operator=( - array_allocator_delete const& other - ) noexcept - { - alloc_ = other.get_allocator(); - count_ = other.count_; - return *this; - } - template - array_allocator_delete& operator=( - array_allocator_delete&& other - ) noexcept - { - alloc_ = std::move(other.get_allocator()); - count_ = other.count_; - return *this; - } - - void operator()(pointer p) - { - std::integral_constant ic; - - detail::array_allocator_delete_impl(get_allocator(), p, count_, ic); - } - - allocator_type& get_allocator() noexcept { return alloc_; } - allocator_type const& get_allocator() const noexcept { return alloc_; } - - void swap(array_allocator_delete& other) noexcept - { - using std::swap; - swap(alloc_, other.alloc_); - swap(count_, other.count_); - } - -private: - allocator_type alloc_; - std::size_t count_; -}; - -template -using uninitialized_array_allocator_delete - = array_allocator_delete; - -/////////////////////////////////////////////////////////////////////////////// - -template -struct tagged_deleter : Lambda -{ - __host__ __device__ - tagged_deleter(Lambda&& l) : Lambda(THRUST_FWD(l)) {} - - using pointer = Pointer; -}; - -template -__host__ __device__ -tagged_deleter -make_tagged_deleter(Lambda&& l) -{ - return tagged_deleter(THRUST_FWD(l)); -} - -/////////////////////////////////////////////////////////////////////////////// - -template -__host__ -std::unique_ptr< - T, - allocator_delete< - T - , typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits::allocator_type - > -> -allocate_unique( - Allocator const& alloc, Args&&... args -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits; - - typename traits::allocator_type alloc_T(alloc); - - auto hold_deleter = make_tagged_deleter( - [&alloc_T] (typename traits::pointer p) { - traits::deallocate(alloc_T, p, 1); - } - ); - using hold_t = std::unique_ptr; - auto hold = hold_t(traits::allocate(alloc_T, 1), hold_deleter); - - traits::construct( - alloc_T, thrust::raw_pointer_cast(hold.get()), THRUST_FWD(args)... - ); - auto deleter = allocator_delete(alloc); - return std::unique_ptr - (hold.release(), std::move(deleter)); -} - -template -__host__ -std::unique_ptr< - T, - uninitialized_allocator_delete< - T - , typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits::allocator_type - > -> -uninitialized_allocate_unique( - Allocator const& alloc -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits; - - typename traits::allocator_type alloc_T(alloc); - - auto hold_deleter = make_tagged_deleter( - [&alloc_T] (typename traits::pointer p) { - traits::deallocate(alloc_T, p, 1); - } - ); - using hold_t = std::unique_ptr; - auto hold = hold_t(traits::allocate(alloc_T, 1), hold_deleter); - - auto deleter = uninitialized_allocator_delete< - T, typename traits::allocator_type - >(alloc_T); - return std::unique_ptr - (hold.release(), std::move(deleter)); -} - -template -__host__ -std::unique_ptr< - T[], - array_allocator_delete< - T - , typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits::allocator_type - > -> -allocate_unique_n( - Allocator const& alloc, Size n, Args&&... args -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits; - - typename traits::allocator_type alloc_T(alloc); - - auto hold_deleter = make_tagged_deleter( - [n, &alloc_T] (typename traits::pointer p) { - traits::deallocate(alloc_T, p, n); - } - ); - using hold_t = std::unique_ptr; - auto hold = hold_t(traits::allocate(alloc_T, n), hold_deleter); - - uninitialized_construct_n_with_allocator( - alloc_T, hold.get(), n, THRUST_FWD(args)... - ); - auto deleter = array_allocator_delete< - T, typename traits::allocator_type - >(alloc_T, n); - return std::unique_ptr - (hold.release(), std::move(deleter)); -} - -template -__host__ -std::unique_ptr< - T[], - uninitialized_array_allocator_delete< - T - , typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits::allocator_type - > -> -uninitialized_allocate_unique_n( - Allocator const& alloc, Size n -) -{ - using traits = typename detail::allocator_traits< - typename std::remove_cv< - typename std::remove_reference::type - >::type - >::template rebind_traits; - - typename traits::allocator_type alloc_T(alloc); - - auto hold_deleter = make_tagged_deleter( - [n, &alloc_T] (typename traits::pointer p) { - traits::deallocate(alloc_T, p, n); - } - ); - using hold_t = std::unique_ptr; - auto hold = hold_t(traits::allocate(alloc_T, n), hold_deleter); - - auto deleter = uninitialized_array_allocator_delete< - T, typename traits::allocator_type - >(alloc_T, n); - return std::unique_ptr - (hold.release(), std::move(deleter)); -} - -/////////////////////////////////////////////////////////////////////////////// - -} // end namespace thrust - -#endif // THRUST_CPP_DIALECT >= 2011 - diff --git a/spaces/CVPR/LIVE/thrust/thrust/system/detail/adl/reverse.h b/spaces/CVPR/LIVE/thrust/thrust/system/detail/adl/reverse.h deleted file mode 100644 index f6bd8947ee4bf3715441e9516160082427aa1491..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/system/detail/adl/reverse.h +++ /dev/null @@ -1,44 +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 fill 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. - */ - -#pragma once - -#include - -// the purpose of this header is to #include the reverse.h header -// of the sequential, host, and device systems. It should be #included in any -// code which uses adl to dispatch reverse - -#include - -// SCons can't see through the #defines below to figure out what this header -// includes, so we fake it out by specifying all possible files we might end up -// including inside an #if 0. -#if 0 -#include -#include -#include -#include -#endif - -#define __THRUST_HOST_SYSTEM_REVERSE_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/reverse.h> -#include __THRUST_HOST_SYSTEM_REVERSE_HEADER -#undef __THRUST_HOST_SYSTEM_REVERSE_HEADER - -#define __THRUST_DEVICE_SYSTEM_REVERSE_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/reverse.h> -#include __THRUST_DEVICE_SYSTEM_REVERSE_HEADER -#undef __THRUST_DEVICE_SYSTEM_REVERSE_HEADER - diff --git a/spaces/ChillyFaze/runwayml-stable-diffusion-v1-5/app.py b/spaces/ChillyFaze/runwayml-stable-diffusion-v1-5/app.py deleted file mode 100644 index a82df332731f067826d3e1ef79fabceffb74d07e..0000000000000000000000000000000000000000 --- a/spaces/ChillyFaze/runwayml-stable-diffusion-v1-5/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/runwayml/stable-diffusion-v1-5").launch() \ No newline at end of file diff --git a/spaces/CrabApple/prompthero-openjourney-v2/app.py b/spaces/CrabApple/prompthero-openjourney-v2/app.py deleted file mode 100644 index 4fa45eda1d4a0af263ec59b35e375b837fe1ecf1..0000000000000000000000000000000000000000 --- a/spaces/CrabApple/prompthero-openjourney-v2/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/prompthero/openjourney-v2").launch() \ No newline at end of file diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fastapi/middleware/wsgi.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fastapi/middleware/wsgi.py deleted file mode 100644 index c4c6a797d2675e1c13b028be977c64a822fb649b..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fastapi/middleware/wsgi.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.middleware.wsgi import WSGIMiddleware as WSGIMiddleware # noqa diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/pens/filterPen.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/pens/filterPen.py deleted file mode 100644 index 81423109ae6b0caed4b75189a0d87b64cf8d0197..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/pens/filterPen.py +++ /dev/null @@ -1,164 +0,0 @@ -from fontTools.pens.basePen import AbstractPen -from fontTools.pens.pointPen import AbstractPointPen -from fontTools.pens.recordingPen import RecordingPen - - -class _PassThruComponentsMixin(object): - def addComponent(self, glyphName, transformation, **kwargs): - self._outPen.addComponent(glyphName, transformation, **kwargs) - - -class FilterPen(_PassThruComponentsMixin, AbstractPen): - - """Base class for pens that apply some transformation to the coordinates - they receive and pass them to another pen. - - You can override any of its methods. The default implementation does - nothing, but passes the commands unmodified to the other pen. - - >>> from fontTools.pens.recordingPen import RecordingPen - >>> rec = RecordingPen() - >>> pen = FilterPen(rec) - >>> v = iter(rec.value) - - >>> pen.moveTo((0, 0)) - >>> next(v) - ('moveTo', ((0, 0),)) - - >>> pen.lineTo((1, 1)) - >>> next(v) - ('lineTo', ((1, 1),)) - - >>> pen.curveTo((2, 2), (3, 3), (4, 4)) - >>> next(v) - ('curveTo', ((2, 2), (3, 3), (4, 4))) - - >>> pen.qCurveTo((5, 5), (6, 6), (7, 7), (8, 8)) - >>> next(v) - ('qCurveTo', ((5, 5), (6, 6), (7, 7), (8, 8))) - - >>> pen.closePath() - >>> next(v) - ('closePath', ()) - - >>> pen.moveTo((9, 9)) - >>> next(v) - ('moveTo', ((9, 9),)) - - >>> pen.endPath() - >>> next(v) - ('endPath', ()) - - >>> pen.addComponent('foo', (1, 0, 0, 1, 0, 0)) - >>> next(v) - ('addComponent', ('foo', (1, 0, 0, 1, 0, 0))) - """ - - def __init__(self, outPen): - self._outPen = outPen - self.current_pt = None - - def moveTo(self, pt): - self._outPen.moveTo(pt) - self.current_pt = pt - - def lineTo(self, pt): - self._outPen.lineTo(pt) - self.current_pt = pt - - def curveTo(self, *points): - self._outPen.curveTo(*points) - self.current_pt = points[-1] - - def qCurveTo(self, *points): - self._outPen.qCurveTo(*points) - self.current_pt = points[-1] - - def closePath(self): - self._outPen.closePath() - self.current_pt = None - - def endPath(self): - self._outPen.endPath() - self.current_pt = None - - -class ContourFilterPen(_PassThruComponentsMixin, RecordingPen): - """A "buffered" filter pen that accumulates contour data, passes - it through a ``filterContour`` method when the contour is closed or ended, - and finally draws the result with the output pen. - - Components are passed through unchanged. - """ - - def __init__(self, outPen): - super(ContourFilterPen, self).__init__() - self._outPen = outPen - - def closePath(self): - super(ContourFilterPen, self).closePath() - self._flushContour() - - def endPath(self): - super(ContourFilterPen, self).endPath() - self._flushContour() - - def _flushContour(self): - result = self.filterContour(self.value) - if result is not None: - self.value = result - self.replay(self._outPen) - self.value = [] - - def filterContour(self, contour): - """Subclasses must override this to perform the filtering. - - The contour is a list of pen (operator, operands) tuples. - Operators are strings corresponding to the AbstractPen methods: - "moveTo", "lineTo", "curveTo", "qCurveTo", "closePath" and - "endPath". The operands are the positional arguments that are - passed to each method. - - If the method doesn't return a value (i.e. returns None), it's - assumed that the argument was modified in-place. - Otherwise, the return value is drawn with the output pen. - """ - return # or return contour - - -class FilterPointPen(_PassThruComponentsMixin, AbstractPointPen): - """Baseclass for point pens that apply some transformation to the - coordinates they receive and pass them to another point pen. - - You can override any of its methods. The default implementation does - nothing, but passes the commands unmodified to the other pen. - - >>> from fontTools.pens.recordingPen import RecordingPointPen - >>> rec = RecordingPointPen() - >>> pen = FilterPointPen(rec) - >>> v = iter(rec.value) - >>> pen.beginPath(identifier="abc") - >>> next(v) - ('beginPath', (), {'identifier': 'abc'}) - >>> pen.addPoint((1, 2), "line", False) - >>> next(v) - ('addPoint', ((1, 2), 'line', False, None), {}) - >>> pen.addComponent("a", (2, 0, 0, 2, 10, -10), identifier="0001") - >>> next(v) - ('addComponent', ('a', (2, 0, 0, 2, 10, -10)), {'identifier': '0001'}) - >>> pen.endPath() - >>> next(v) - ('endPath', (), {}) - """ - - def __init__(self, outPointPen): - self._outPen = outPointPen - - def beginPath(self, **kwargs): - self._outPen.beginPath(**kwargs) - - def endPath(self): - self._outPen.endPath() - - def addPoint(self, pt, segmentType=None, smooth=False, name=None, **kwargs): - self._outPen.addPoint(pt, segmentType, smooth, name, **kwargs) diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-22108117.js b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-22108117.js deleted file mode 100644 index 1548119864cc83116796c345b255d84f2c818d0a..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-22108117.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-1d65707a.js";import{B as ZW}from"./Button-f155035a.js";import{g as JW}from"./color-90ab3aab.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-eec13822.js";import{B as kY}from"./BlockLabel-66866176.js";import"./Blocks-c9e1499d.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-22108117.js.map diff --git a/spaces/DaleChen/AutoGPT/autogpt/chat.py b/spaces/DaleChen/AutoGPT/autogpt/chat.py deleted file mode 100644 index 1f6bca96eb216c667656b50f131006b83c681065..0000000000000000000000000000000000000000 --- a/spaces/DaleChen/AutoGPT/autogpt/chat.py +++ /dev/null @@ -1,175 +0,0 @@ -import time - -from openai.error import RateLimitError - -from autogpt import token_counter -from autogpt.config import Config -from autogpt.llm_utils import create_chat_completion -from autogpt.logs import logger - -cfg = Config() - - -def create_chat_message(role, content): - """ - Create a chat message with the given role and content. - - Args: - role (str): The role of the message sender, e.g., "system", "user", or "assistant". - content (str): The content of the message. - - Returns: - dict: A dictionary containing the role and content of the message. - """ - return {"role": role, "content": content} - - -def generate_context(prompt, relevant_memory, full_message_history, model): - current_context = [ - create_chat_message("system", prompt), - create_chat_message( - "system", f"The current time and date is {time.strftime('%c')}" - ), - create_chat_message( - "system", - f"This reminds you of these events from your past:\n{relevant_memory}\n\n", - ), - ] - - # Add messages from the full message history until we reach the token limit - next_message_to_add_index = len(full_message_history) - 1 - insertion_index = len(current_context) - # Count the currently used tokens - current_tokens_used = token_counter.count_message_tokens(current_context, model) - return ( - next_message_to_add_index, - current_tokens_used, - insertion_index, - current_context, - ) - - -# TODO: Change debug from hardcode to argument -def chat_with_ai( - prompt, user_input, full_message_history, permanent_memory, token_limit -): - """Interact with the OpenAI API, sending the prompt, user input, message history, - and permanent memory.""" - while True: - try: - """ - Interact with the OpenAI API, sending the prompt, user input, - message history, and permanent memory. - - Args: - prompt (str): The prompt explaining the rules to the AI. - user_input (str): The input from the user. - full_message_history (list): The list of all messages sent between the - user and the AI. - permanent_memory (Obj): The memory object containing the permanent - memory. - token_limit (int): The maximum number of tokens allowed in the API call. - - Returns: - str: The AI's response. - """ - model = cfg.fast_llm_model # TODO: Change model from hardcode to argument - # Reserve 1000 tokens for the response - - logger.debug(f"Token limit: {token_limit}") - send_token_limit = token_limit - 1000 - - relevant_memory = ( - "" - if len(full_message_history) == 0 - else permanent_memory.get_relevant(str(full_message_history[-9:]), 10) - ) - - logger.debug(f"Memory Stats: {permanent_memory.get_stats()}") - - ( - next_message_to_add_index, - current_tokens_used, - insertion_index, - current_context, - ) = generate_context(prompt, relevant_memory, full_message_history, model) - - while current_tokens_used > 2500: - # remove memories until we are under 2500 tokens - relevant_memory = relevant_memory[:-1] - ( - next_message_to_add_index, - current_tokens_used, - insertion_index, - current_context, - ) = generate_context( - prompt, relevant_memory, full_message_history, model - ) - - current_tokens_used += token_counter.count_message_tokens( - [create_chat_message("user", user_input)], model - ) # Account for user input (appended later) - - while next_message_to_add_index >= 0: - # print (f"CURRENT TOKENS USED: {current_tokens_used}") - message_to_add = full_message_history[next_message_to_add_index] - - tokens_to_add = token_counter.count_message_tokens( - [message_to_add], model - ) - if current_tokens_used + tokens_to_add > send_token_limit: - break - - # Add the most recent message to the start of the current context, - # after the two system prompts. - current_context.insert( - insertion_index, full_message_history[next_message_to_add_index] - ) - - # Count the currently used tokens - current_tokens_used += tokens_to_add - - # Move to the next most recent message in the full message history - next_message_to_add_index -= 1 - - # Append user input, the length of this is accounted for above - current_context.extend([create_chat_message("user", user_input)]) - - # Calculate remaining tokens - tokens_remaining = token_limit - current_tokens_used - # assert tokens_remaining >= 0, "Tokens remaining is negative. - # This should never happen, please submit a bug report at - # https://www.github.com/Torantulino/Auto-GPT" - - # Debug print the current context - logger.debug(f"Token limit: {token_limit}") - logger.debug(f"Send Token Count: {current_tokens_used}") - logger.debug(f"Tokens remaining for response: {tokens_remaining}") - logger.debug("------------ CONTEXT SENT TO AI ---------------") - for message in current_context: - # Skip printing the prompt - if message["role"] == "system" and message["content"] == prompt: - continue - logger.debug(f"{message['role'].capitalize()}: {message['content']}") - logger.debug("") - logger.debug("----------- END OF CONTEXT ----------------") - - # TODO: use a model defined elsewhere, so that model can contain - # temperature and other settings we care about - assistant_reply = create_chat_completion( - model=model, - messages=current_context, - max_tokens=tokens_remaining, - ) - - # Update full message history - full_message_history.append(create_chat_message("user", user_input)) - full_message_history.append( - create_chat_message("assistant", assistant_reply) - ) - - return assistant_reply - except RateLimitError: - # TODO: When we switch to langchain, this is built in - print("Error: ", "API Rate Limit Reached. Waiting 10 seconds...") - time.sleep(10) diff --git a/spaces/Datasculptor/3D-Room-Layout-Estimation_LGT-Net/postprocessing/post_process.py b/spaces/Datasculptor/3D-Room-Layout-Estimation_LGT-Net/postprocessing/post_process.py deleted file mode 100644 index c58d894d58d6ed1e90fc1c35d85b55acb24a3125..0000000000000000000000000000000000000000 --- a/spaces/Datasculptor/3D-Room-Layout-Estimation_LGT-Net/postprocessing/post_process.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -@Date: 2021/10/08 -@description: -""" -import numpy as np -import cv2 - -from postprocessing.dula.layout import fit_layout -from postprocessing.dula.layout_old import fit_layout_old -from utils.conversion import depth2xyz, xyz2depth - - -def post_process(b_depth, type_name='manhattan', need_cube=False): - plan_y = 1 - b_xyz = depth2xyz(b_depth, plan_y) - - b_processed_xyz = [] - for xyz in b_xyz: - if type_name == 'manhattan': - processed_xz = fit_layout(floor_xz=xyz[..., ::2], need_cube=need_cube, show=False) - elif type_name == 'manhattan_old': - processed_xz = fit_layout_old(floor_xz=xyz[..., ::2], need_cube=need_cube, show=False) - elif type_name == 'atalanta': - processed_xz = cv2.approxPolyDP(xyz[..., ::2].astype(np.float32), 0.1, False)[:, 0, :] - else: - raise NotImplementedError("Unknown post-processing type") - - if need_cube: - assert len(processed_xz) == 4 - - processed_xyz = np.insert(processed_xz, 1, plan_y, axis=1) - b_processed_xyz.append(processed_xyz) - - return np.array(b_processed_xyz) \ No newline at end of file diff --git a/spaces/Denevan/BingAI/README.md b/spaces/Denevan/BingAI/README.md deleted file mode 100644 index 918acef7b8464a56d793eb16119e4812092a8b90..0000000000000000000000000000000000000000 --- a/spaces/Denevan/BingAI/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: BingAI -emoji: 📉 -colorFrom: yellow -colorTo: red -sdk: docker -pinned: false -license: mit -app_port: 8080 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/DragGan/DragGan/torch_utils/training_stats.py b/spaces/DragGan/DragGan/torch_utils/training_stats.py deleted file mode 100644 index 5de4134f1943e7c3104bbc926b2abaf828626525..0000000000000000000000000000000000000000 --- a/spaces/DragGan/DragGan/torch_utils/training_stats.py +++ /dev/null @@ -1,268 +0,0 @@ -# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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. - -"""Facilities for reporting and collecting training statistics across -multiple processes and devices. The interface is designed to minimize -synchronization overhead as well as the amount of boilerplate in user -code.""" - -import re -import numpy as np -import torch -import dnnlib - -from . import misc - -#---------------------------------------------------------------------------- - -_num_moments = 3 # [num_scalars, sum_of_scalars, sum_of_squares] -_reduce_dtype = torch.float32 # Data type to use for initial per-tensor reduction. -_counter_dtype = torch.float64 # Data type to use for the internal counters. -_rank = 0 # Rank of the current process. -_sync_device = None # Device to use for multiprocess communication. None = single-process. -_sync_called = False # Has _sync() been called yet? -_counters = dict() # Running counters on each device, updated by report(): name => device => torch.Tensor -_cumulative = dict() # Cumulative counters on the CPU, updated by _sync(): name => torch.Tensor - -#---------------------------------------------------------------------------- - -def init_multiprocessing(rank, sync_device): - r"""Initializes `torch_utils.training_stats` for collecting statistics - across multiple processes. - - This function must be called after - `torch.distributed.init_process_group()` and before `Collector.update()`. - The call is not necessary if multi-process collection is not needed. - - Args: - rank: Rank of the current process. - sync_device: PyTorch device to use for inter-process - communication, or None to disable multi-process - collection. Typically `torch.device('cuda', rank)`. - """ - global _rank, _sync_device - assert not _sync_called - _rank = rank - _sync_device = sync_device - -#---------------------------------------------------------------------------- - -@misc.profiled_function -def report(name, value): - r"""Broadcasts the given set of scalars to all interested instances of - `Collector`, across device and process boundaries. - - This function is expected to be extremely cheap and can be safely - called from anywhere in the training loop, loss function, or inside a - `torch.nn.Module`. - - Warning: The current implementation expects the set of unique names to - be consistent across processes. Please make sure that `report()` is - called at least once for each unique name by each process, and in the - same order. If a given process has no scalars to broadcast, it can do - `report(name, [])` (empty list). - - Args: - name: Arbitrary string specifying the name of the statistic. - Averages are accumulated separately for each unique name. - value: Arbitrary set of scalars. Can be a list, tuple, - NumPy array, PyTorch tensor, or Python scalar. - - Returns: - The same `value` that was passed in. - """ - if name not in _counters: - _counters[name] = dict() - - elems = torch.as_tensor(value) - if elems.numel() == 0: - return value - - elems = elems.detach().flatten().to(_reduce_dtype) - moments = torch.stack([ - torch.ones_like(elems).sum(), - elems.sum(), - elems.square().sum(), - ]) - assert moments.ndim == 1 and moments.shape[0] == _num_moments - moments = moments.to(_counter_dtype) - - device = moments.device - if device not in _counters[name]: - _counters[name][device] = torch.zeros_like(moments) - _counters[name][device].add_(moments) - return value - -#---------------------------------------------------------------------------- - -def report0(name, value): - r"""Broadcasts the given set of scalars by the first process (`rank = 0`), - but ignores any scalars provided by the other processes. - See `report()` for further details. - """ - report(name, value if _rank == 0 else []) - return value - -#---------------------------------------------------------------------------- - -class Collector: - r"""Collects the scalars broadcasted by `report()` and `report0()` and - computes their long-term averages (mean and standard deviation) over - user-defined periods of time. - - The averages are first collected into internal counters that are not - directly visible to the user. They are then copied to the user-visible - state as a result of calling `update()` and can then be queried using - `mean()`, `std()`, `as_dict()`, etc. Calling `update()` also resets the - internal counters for the next round, so that the user-visible state - effectively reflects averages collected between the last two calls to - `update()`. - - Args: - regex: Regular expression defining which statistics to - collect. The default is to collect everything. - keep_previous: Whether to retain the previous averages if no - scalars were collected on a given round - (default: True). - """ - def __init__(self, regex='.*', keep_previous=True): - self._regex = re.compile(regex) - self._keep_previous = keep_previous - self._cumulative = dict() - self._moments = dict() - self.update() - self._moments.clear() - - def names(self): - r"""Returns the names of all statistics broadcasted so far that - match the regular expression specified at construction time. - """ - return [name for name in _counters if self._regex.fullmatch(name)] - - def update(self): - r"""Copies current values of the internal counters to the - user-visible state and resets them for the next round. - - If `keep_previous=True` was specified at construction time, the - operation is skipped for statistics that have received no scalars - since the last update, retaining their previous averages. - - This method performs a number of GPU-to-CPU transfers and one - `torch.distributed.all_reduce()`. It is intended to be called - periodically in the main training loop, typically once every - N training steps. - """ - if not self._keep_previous: - self._moments.clear() - for name, cumulative in _sync(self.names()): - if name not in self._cumulative: - self._cumulative[name] = torch.zeros([_num_moments], dtype=_counter_dtype) - delta = cumulative - self._cumulative[name] - self._cumulative[name].copy_(cumulative) - if float(delta[0]) != 0: - self._moments[name] = delta - - def _get_delta(self, name): - r"""Returns the raw moments that were accumulated for the given - statistic between the last two calls to `update()`, or zero if - no scalars were collected. - """ - assert self._regex.fullmatch(name) - if name not in self._moments: - self._moments[name] = torch.zeros([_num_moments], dtype=_counter_dtype) - return self._moments[name] - - def num(self, name): - r"""Returns the number of scalars that were accumulated for the given - statistic between the last two calls to `update()`, or zero if - no scalars were collected. - """ - delta = self._get_delta(name) - return int(delta[0]) - - def mean(self, name): - r"""Returns the mean of the scalars that were accumulated for the - given statistic between the last two calls to `update()`, or NaN if - no scalars were collected. - """ - delta = self._get_delta(name) - if int(delta[0]) == 0: - return float('nan') - return float(delta[1] / delta[0]) - - def std(self, name): - r"""Returns the standard deviation of the scalars that were - accumulated for the given statistic between the last two calls to - `update()`, or NaN if no scalars were collected. - """ - delta = self._get_delta(name) - if int(delta[0]) == 0 or not np.isfinite(float(delta[1])): - return float('nan') - if int(delta[0]) == 1: - return float(0) - mean = float(delta[1] / delta[0]) - raw_var = float(delta[2] / delta[0]) - return np.sqrt(max(raw_var - np.square(mean), 0)) - - def as_dict(self): - r"""Returns the averages accumulated between the last two calls to - `update()` as an `dnnlib.EasyDict`. The contents are as follows: - - dnnlib.EasyDict( - NAME = dnnlib.EasyDict(num=FLOAT, mean=FLOAT, std=FLOAT), - ... - ) - """ - stats = dnnlib.EasyDict() - for name in self.names(): - stats[name] = dnnlib.EasyDict(num=self.num(name), mean=self.mean(name), std=self.std(name)) - return stats - - def __getitem__(self, name): - r"""Convenience getter. - `collector[name]` is a synonym for `collector.mean(name)`. - """ - return self.mean(name) - -#---------------------------------------------------------------------------- - -def _sync(names): - r"""Synchronize the global cumulative counters across devices and - processes. Called internally by `Collector.update()`. - """ - if len(names) == 0: - return [] - global _sync_called - _sync_called = True - - # Collect deltas within current rank. - deltas = [] - device = _sync_device if _sync_device is not None else torch.device('cpu') - for name in names: - delta = torch.zeros([_num_moments], dtype=_counter_dtype, device=device) - for counter in _counters[name].values(): - delta.add_(counter.to(device)) - counter.copy_(torch.zeros_like(counter)) - deltas.append(delta) - deltas = torch.stack(deltas) - - # Sum deltas across ranks. - if _sync_device is not None: - torch.distributed.all_reduce(deltas) - - # Update cumulative values. - deltas = deltas.cpu() - for idx, name in enumerate(names): - if name not in _cumulative: - _cumulative[name] = torch.zeros([_num_moments], dtype=_counter_dtype) - _cumulative[name].add_(deltas[idx]) - - # Return name-value pairs. - return [(name, _cumulative[name]) for name in names] - -#---------------------------------------------------------------------------- diff --git a/spaces/Duskfallcrew/Duskfallcrew-Osenayan_Mix/app.py b/spaces/Duskfallcrew/Duskfallcrew-Osenayan_Mix/app.py deleted file mode 100644 index 0fd663daea0fc544b5ef185e424f8ee81aed7e1e..0000000000000000000000000000000000000000 --- a/spaces/Duskfallcrew/Duskfallcrew-Osenayan_Mix/app.py +++ /dev/null @@ -1,19 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/Duskfallcrew/Osenayan_Mix").launch() - -css = """.main-div div{display:inline-flex;align-items:center;gap:.8rem;font-size:1.75rem}.main-div div h1{font-weight:900;margin-bottom:7px}.main-div p{margin-bottom:10px;font-size:94%}a{text-decoration:underline}.tabs{margin-top:0;margin-bottom:0}#gallery{min-height:20rem} -""" -with gr.Blocks(css=css) as demo: - gr.HTML( - f""" -
    -
    -

    Osenayan Mix

    -
    -

    - Demo for Osenayan Mix Stable Diffusion model. We stream a lot of our testing on Twitch . Any chance you can spare a coffee or three? Ko-Fi Anyone?. Request image gens via our Pixiv. Hang with us on discord: Earth & Dusk Discord . No tokens are required.
    - -

    - """ - ) \ No newline at end of file diff --git a/spaces/ECCV2022/PSG/OpenPSG/configs/_base_/schedules/schedule_1x.py b/spaces/ECCV2022/PSG/OpenPSG/configs/_base_/schedules/schedule_1x.py deleted file mode 100644 index 1c01d3df3d9169fee87ffeaa4e0fb60ac3f07b66..0000000000000000000000000000000000000000 --- a/spaces/ECCV2022/PSG/OpenPSG/configs/_base_/schedules/schedule_1x.py +++ /dev/null @@ -1,10 +0,0 @@ -# optimizer -optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001) -optimizer_config = dict(grad_clip=None) -# learning policy -lr_config = dict(policy='step', - warmup='linear', - warmup_iters=500, - warmup_ratio=0.001, - step=[8, 11]) -runner = dict(type='EpochBasedRunner', max_epochs=12) diff --git a/spaces/Emanuel/porttagger/app.py b/spaces/Emanuel/porttagger/app.py deleted file mode 100644 index 45e4862dd8dd9025e1314519dcea2f6b2b3edda4..0000000000000000000000000000000000000000 --- a/spaces/Emanuel/porttagger/app.py +++ /dev/null @@ -1,206 +0,0 @@ -import logging -import os -from pathlib import Path -from typing import List, Tuple - -import gradio as gr -import pandas as pd -import spacy -import torch -from dante_tokenizer import DanteTokenizer -from transformers import AutoModelForTokenClassification, AutoTokenizer - -from preprocessing import expand_contractions - -try: - nlp = spacy.load("pt_core_news_sm") -except Exception: - os.system("python -m spacy download pt_core_news_sm") - nlp = spacy.load("pt_core_news_sm") -dt_tokenizer = DanteTokenizer() - -default_model = "News" -model_choices = { - "News": "Emanuel/porttagger-news-base", - "Tweets (stock market)": "Emanuel/porttagger-tweets-base", - "Oil and Gas (academic texts)": "Emanuel/porttagger-oilgas-base", - "Multigenre": "Emanuel/porttagger-base", -} -pre_tokenizers = { - "News": nlp, - "Tweets (stock market)": dt_tokenizer.tokenize, - "Oil and Gas (academic texts)": nlp, - "Multigenre": nlp, -} -logger = logging.getLogger() -logger.setLevel(logging.DEBUG) - -class MyApp: - def __init__(self) -> None: - self.model = None - self.tokenizer = None - self.pre_tokenizer = None - self.load_model() - - def load_model(self, model_name: str = default_model): - if model_name not in model_choices.keys(): - logger.error("Selected model is not supported, resetting to the default model.") - model_name = default_model - self.model = AutoModelForTokenClassification.from_pretrained(model_choices[model_name]) - self.tokenizer = AutoTokenizer.from_pretrained(model_choices[model_name]) - self.pre_tokenizer = pre_tokenizers[model_name] - -myapp = MyApp() - -def predict(text, logger=None) -> Tuple[List[str], List[str]]: - doc = myapp.pre_tokenizer(text) - tokens = [token.text if not isinstance(token, str) else token for token in doc] - - logger.info("Starting predictions for sentence: {}".format(text)) - print("Using model {}".format(myapp.model.config.__dict__["_name_or_path"])) - - input_tokens = myapp.tokenizer( - tokens, - return_tensors="pt", - is_split_into_words=True, - return_offsets_mapping=True, - return_special_tokens_mask=True, - ) - output = myapp.model(input_tokens["input_ids"]) - - i_token = 0 - labels = [] - scores = [] - for off, is_special_token, pred in zip( - input_tokens["offset_mapping"][0], - input_tokens["special_tokens_mask"][0], - output.logits[0], - ): - if is_special_token or off[0] > 0: - continue - label = myapp.model.config.__dict__["id2label"][int(pred.argmax(axis=-1))] - if logger is not None: - logger.info("{}, {}, {}".format(off, tokens[i_token], label)) - labels.append(label) - scores.append( - "{:.2f}".format(100 * float(torch.softmax(pred, dim=-1).detach().max())) - ) - i_token += 1 - - return tokens, labels, scores - - -def text_analysis(text): - text = expand_contractions(text) - tokens, labels, scores = predict(text, logger) - if len(labels) != len(tokens): - m = len(tokens) - len(labels) - labels += [None] * m - scores += [0] * m - pos_count = pd.DataFrame( - { - "token": tokens, - "tag": labels, - "confidence": scores, - } - ) - pos_tokens = [] - for token, label in zip(tokens, labels): - pos_tokens.extend([(token, label), (" ", None)]) - - output_highlighted.update(visible=True) - output_df.update(visible=True) - - return { - output_highlighted: output_highlighted.update(visible=True, value=(pos_tokens)), - output_df: output_df.update(visible=True, value=pos_count), - } - - -def batch_analysis(input_file): - text = open(input_file.name, encoding="utf-8").read() - text = text.split("\n") - name = Path(input_file.name).stem - sents = [] - for sent in text: - sub_sents = nlp(sent).sents - sub_sents = [str(_sent).strip() for _sent in sub_sents] - sents += sub_sents - conllu_output = [] - - for i, sent in enumerate(sents): - sent = expand_contractions(sent) - conllu_output.append("# sent_id = {}-{}\n".format(name, i + 1)) - conllu_output.append("# text = {}\n".format(sent)) - tokens, labels, scores = predict(sent, logger) - for j, (token, label) in enumerate(zip(tokens, labels)): - conllu_output.append( - "{}\t{}\t_\t{}".format(j + 1, token, label) + "\t_" * 5 + "\n" - ) - conllu_output.append("\n") - - output_filename = "output.conllu" - with open(output_filename, "w") as out_f: - out_f.writelines(conllu_output) - - return {output_file: output_file.update(visible=True, value=output_filename)} - - -css = open("style.css").read() -top_html = open("top.html").read() -bottom_html = open("bottom.html").read() - -with gr.Blocks(css=css) as demo: - gr.HTML(top_html) - select_model = gr.Dropdown(choices=list(model_choices.keys()), label="Tagger model", value=default_model) - select_model.change(myapp.load_model, inputs=[select_model]) - with gr.Tab("Single sentence"): - text = gr.Textbox(placeholder="Enter your text here...", label="Input") - examples = gr.Examples( - examples=[ - [ - "A população não poderia ter acesso a relatórios que explicassem, por exemplo, os motivos exatos de atrasos em obras de linhas e estações." - ], - [ - "Filme 'Star Wars : Os Últimos Jedi' ganha trailer definitivo; assista." - ], - ], - inputs=[text], - label="Select an example", - ) - output_highlighted = gr.HighlightedText(label="Colorful output", visible=False) - output_df = gr.Dataframe(label="Tabular output", visible=False) - submit_btn = gr.Button("Tag it") - submit_btn.click( - fn=text_analysis, inputs=text, outputs=[output_highlighted, output_df] - ) - with gr.Tab("Multiple sentences"): - gr.HTML( - """ -

    -  Upload a plain text file with sentences in it. - Find below an example of what we expect the content of the file to look like. - Sentences are automatically split by spaCy's sentencizer. - To force an explicit segmentation, manually separate the sentences using a new line for each one.

    - """ - ) - gr.Markdown( - """ - ``` - Então ele hesitou, quase como se estivesse surpreso com as próprias palavras, e recitou: - – Vá e não tornes a pecar! - Baley, sorrindo de repente, pegou no cotovelo de R. Daneel e eles saíram juntos pela porta. - ``` - """ - ) - input_file = gr.File(label="Upload your input file here...") - output_file = gr.File(label="Tagged file", visible=False) - submit_btn_batch = gr.Button("Tag it") - submit_btn_batch.click( - fn=batch_analysis, inputs=input_file, outputs=output_file - ) - - gr.HTML(bottom_html) - - -demo.launch(debug=True) diff --git a/spaces/EuroPython2022/mmocr-demo/configs/textrecog/crnn/crnn_academic_dataset.py b/spaces/EuroPython2022/mmocr-demo/configs/textrecog/crnn/crnn_academic_dataset.py deleted file mode 100644 index b8288cb5a1cb48ddc6b32e988b45305e01e76df5..0000000000000000000000000000000000000000 --- a/spaces/EuroPython2022/mmocr-demo/configs/textrecog/crnn/crnn_academic_dataset.py +++ /dev/null @@ -1,35 +0,0 @@ -_base_ = [ - '../../_base_/default_runtime.py', '../../_base_/recog_models/crnn.py', - '../../_base_/recog_pipelines/crnn_pipeline.py', - '../../_base_/recog_datasets/MJ_train.py', - '../../_base_/recog_datasets/academic_test.py', - '../../_base_/schedules/schedule_adadelta_5e.py' -] - -train_list = {{_base_.train_list}} -test_list = {{_base_.test_list}} - -train_pipeline = {{_base_.train_pipeline}} -test_pipeline = {{_base_.test_pipeline}} - -data = dict( - samples_per_gpu=64, - workers_per_gpu=4, - val_dataloader=dict(samples_per_gpu=1), - test_dataloader=dict(samples_per_gpu=1), - train=dict( - type='UniformConcatDataset', - datasets=train_list, - pipeline=train_pipeline), - val=dict( - type='UniformConcatDataset', - datasets=test_list, - pipeline=test_pipeline), - test=dict( - type='UniformConcatDataset', - datasets=test_list, - pipeline=test_pipeline)) - -evaluation = dict(interval=1, metric='acc') - -cudnn_benchmark = True diff --git a/spaces/ExpUnGeD404/Bamber/Dockerfile b/spaces/ExpUnGeD404/Bamber/Dockerfile deleted file mode 100644 index eef259fa372a804549fb0af0913718a13344da34..0000000000000000000000000000000000000000 --- a/spaces/ExpUnGeD404/Bamber/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/khanon/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" ] diff --git a/spaces/Forbu14/LoiLibreQA/utils.py b/spaces/Forbu14/LoiLibreQA/utils.py deleted file mode 100644 index b4e7ef2ed0f4856f69db36d621d09be0307827d5..0000000000000000000000000000000000000000 --- a/spaces/Forbu14/LoiLibreQA/utils.py +++ /dev/null @@ -1,67 +0,0 @@ -import numpy as np -import openai -import os -import random -import string - - -def is_climate_change_related(sentence: str, classifier) -> bool: - """_summary_ - Args: - sentence (str): your sentence to classify - classifier (_type_): zero shot hugging face pipeline classifier - Returns: - bool: is_climate_change_related or not - """ - results = classifier( - sequences=sentence, - candidate_labels=["climate change related", "non climate change related"], - ) - print(f" ## Result from is climate change related {results}") - return results["labels"][np.argmax(results["scores"])] == "climate change related" - - -def make_pairs(lst): - """From a list of even lenght, make tupple pairs - Args: - lst (list): a list of even lenght - Returns: - list: the list as tupple pairs - """ - assert not (l := len(lst) % 2), f"your list is of lenght {l} which is not even" - return [(lst[i], lst[i + 1]) for i in range(0, len(lst), 2)] - - -def set_openai_api_key(text): - """Set the api key and return chain.If no api_key, then None is returned. - To do : add raise error & Warning message - Args: - text (str): openai api key - Returns: - str: Result of connection - """ - openai.api_key = os.environ["api_key"] - - if text.startswith("sk-") and len(text) > 10: - openai.api_key = text - return f"You're all set: this is your api key: {openai.api_key}" - - -def create_user_id(length): - """Create user_id - Args: - length (int): length of user id - Returns: - str: String to id user - """ - letters = string.ascii_lowercase - user_id = "".join(random.choice(letters) for i in range(length)) - return user_id - - -def to_completion(messages): - s = [] - for message in messages: - s.append(f"<|im_start|>{message['role']}\n{message['content']}<|im_end|>") - s.append("<|im_start|>assistant\n") - return "\n".join(s) diff --git a/spaces/GAIR/Factool/factool/knowledge_qa/tool.py b/spaces/GAIR/Factool/factool/knowledge_qa/tool.py deleted file mode 100644 index 1aa0614ae733d8c69de1ff2b8fa564ce2946d53f..0000000000000000000000000000000000000000 --- a/spaces/GAIR/Factool/factool/knowledge_qa/tool.py +++ /dev/null @@ -1,91 +0,0 @@ -import asyncio -from factool.knowledge_qa.google_serper import GoogleSerperAPIWrapper -from factool.utils.openai_wrapper import OpenAIEmbed -import json -import os -import numpy as np -import jsonlines -import pdb - -class google_search(): - def __init__(self, snippet_cnt): - self.serper = GoogleSerperAPIWrapper(snippet_cnt=snippet_cnt) - - async def run(self, queries): - return await self.serper.run(queries) - -class local_search(): - def __init__(self, snippet_cnt, data_link, embedding_link=None): - self.snippet_cnt = snippet_cnt - self.data_link = data_link - self.embedding_link = embedding_link - self.openai_embed = OpenAIEmbed() - self.data = None - self.embedding = None - asyncio.run(self.init_async()) - - - async def init_async(self): - print("init local search") - self.load_data_by_link() - if self.embedding_link is None: - await self.calculate_embedding() - else: - self.load_embedding_by_link() - print("loaded data and embedding") - - def add_suffix_to_json_filename(self, filename): - base_name, extension = os.path.splitext(filename) - return base_name + '_embed' + extension - - def load_data_by_link(self): - #load data from json link - self.data = [] - #self.data = json.load(open(self.data_link, 'r')) - with jsonlines.open(self.data_link) as reader: - for obj in reader: - self.data.append(obj['text']) - - def load_embedding_by_link(self): - self.embedding = [] - #self.embedding = json.load(open(self.embedding_link, 'r')) - with jsonlines.open(self.embedding_link) as reader: - for obj in reader: - self.embedding.append(obj) - - def save_embeddings(self): - #json.dump(self.embedding, open(self.add_suffix_to_json_filename(self.data_link), 'w')) - with jsonlines.open(self.add_suffix_to_json_filename(self.data_link), mode='w') as writer: - writer.write_all(self.embedding) - - async def calculate_embedding(self): - result = await self.openai_embed.process_batch(self.data,retry=3) - self.embedding = [emb["data"][0]["embedding"] for emb in result] - self.save_embeddings() - - async def search(self, query): - result = await self.openai_embed.create_embedding(query) - query_embed = result["data"][0]["embedding"] - dot_product = np.dot(self.embedding, query_embed) - sorted_indices = np.argsort(dot_product)[::-1] - top_k_indices = sorted_indices[:self.snippet_cnt] - return [{"content":self.data[i],"source":"local"} for i in top_k_indices] - - - async def run(self, queries): - flattened_queries = [] - for sublist in queries: - if sublist is None: - sublist = ['None', 'None'] - for item in sublist: - flattened_queries.append(item) - - snippets = await asyncio.gather(*[self.search(query) for query in flattened_queries]) - snippets_split = [snippets[i] + snippets[i+1] for i in range(0, len(snippets), 2)] - return snippets_split - - - - - - diff --git a/spaces/GitMylo/bark-voice-cloning/app.py b/spaces/GitMylo/bark-voice-cloning/app.py deleted file mode 100644 index 4382649733cfacbc1267ca3253d4533fd4454325..0000000000000000000000000000000000000000 --- a/spaces/GitMylo/bark-voice-cloning/app.py +++ /dev/null @@ -1,98 +0,0 @@ -import math -import os.path -import uuid - -import gradio -import numpy -import torch - -from hubert.hubert_manager import HuBERTManager -from hubert.pre_kmeans_hubert import CustomHubert -from hubert.customtokenizer import CustomTokenizer -from encodec import EncodecModel -from encodec.utils import convert_audio - - -hubert_model = CustomHubert(HuBERTManager.make_sure_hubert_installed()) -tokenizer_model = CustomTokenizer.load_from_checkpoint( - HuBERTManager.make_sure_tokenizer_installed(model='quantifier_V1_hubert_base_ls960_23.pth'), - map_location=torch.device('cpu') -) -encodec_model = EncodecModel.encodec_model_24khz() - - - -def clone(audio, *args): - sr, wav = audio - - wav = torch.tensor(wav) - - if wav.dtype == torch.int16: - wav = wav.float() / 32767.0 - - if len(wav.shape) == 2: - if wav.shape[0] == 2: # Stereo to mono if needed - wav = wav.mean(0, keepdim=True) - if wav.shape[1] == 2: - wav = wav.mean(1, keepdim=False).unsqueeze(-1) - - wav = wav[-int(sr*20):] # Take only the last 20 seconds - - wav = wav.reshape(1, -1) # Reshape from gradio style to HuBERT shape. (N, 1) to (1, N) - - semantic_vectors = hubert_model.forward(wav, input_sample_hz=sr) - semantic_tokens = tokenizer_model.get_token(semantic_vectors) - - encodec_model.set_target_bandwidth(6.0) - wav = convert_audio(wav, sr, encodec_model.sample_rate, 1) - wav = wav.unsqueeze(0) - - with torch.no_grad(): - encoded_frames = encodec_model.encode(wav) - - codes = torch.cat([encoded[0] for encoded in encoded_frames], dim=-1).squeeze() # [B, n_q, T] - - if not os.path.isdir('data/speakers'): - os.makedirs('data/speakers') - - file_path = f'data/speakers/{uuid.uuid4().hex}.npz' - - numpy.savez( - file_path, - semantic_prompt=semantic_tokens, - fine_prompt=codes, - coarse_prompt=codes[:2, :] - ) - - return file_path - - - -iface = gradio.interface.Interface(fn=clone, inputs=[ - 'audio', - gradio.Markdown( - ''' - # Bark text to speech voice cloning - [Model](https://huggingface.co/GitMylo/bark-voice-cloning/), [Model GitHub](https://github.com/gitmylo/bark-voice-cloning-HuBERT-quantizer), [Webui GitHub](https://github.com/gitmylo/audio-webui) - - For faster creation of voice clones [Duplicate this space](https://huggingface.co/spaces/GitMylo/bark-voice-cloning?duplicate=true) - - Uploaded audio files get cut to 20 seconds in order to keep it fast for everyone. Only the last 20 seconds will be used. (Bark only uses the last 14 seconds anyway) - - ## Tips for better cloning - ### Make sure these things are **NOT** in your voice input: (in no particular order) - * Noise (You can use a noise remover before) - * Music (There are also music remover tools) (Unless you want music in the background) - * A cut-off at the end (This will cause it to try and continue on the generation) - * Under 1 second of training data (i personally suggest around 10 seconds for good potential, but i've had great results with 5 seconds as well.) - - ### What makes for good prompt audio? (in no particular order) - * Clearly spoken - * No weird background noises - * Only one speaker - * Audio which ends after a sentence ends - * Regular/common voice (They usually have more success, it's still capable of cloning complex voices, but not as good at it) - * Around 10 seconds of data - ''') -], outputs='file') -iface.launch() diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/configs/retinanet/retinanet_x101_32x4d_fpn_2x_coco.py b/spaces/Gradio-Blocks/uniformer_image_detection/configs/retinanet/retinanet_x101_32x4d_fpn_2x_coco.py deleted file mode 100644 index cd78b6df320aea7b23412b2f734e8684f84b9822..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/configs/retinanet/retinanet_x101_32x4d_fpn_2x_coco.py +++ /dev/null @@ -1,13 +0,0 @@ -_base_ = './retinanet_r50_fpn_2x_coco.py' -model = dict( - pretrained='open-mmlab://resnext101_32x4d', - backbone=dict( - type='ResNeXt', - depth=101, - groups=32, - base_width=4, - num_stages=4, - out_indices=(0, 1, 2, 3), - frozen_stages=1, - norm_cfg=dict(type='BN', requires_grad=True), - style='pytorch')) diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/mmdet/datasets/pipelines/transforms.py b/spaces/Gradio-Blocks/uniformer_image_detection/mmdet/datasets/pipelines/transforms.py deleted file mode 100644 index caed51d89ffc1259d0b086954f03c3d4c0749cf2..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/mmdet/datasets/pipelines/transforms.py +++ /dev/null @@ -1,1811 +0,0 @@ -import copy -import inspect - -import mmcv -import numpy as np -from numpy import random - -from mmdet.core import PolygonMasks -from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps -from ..builder import PIPELINES - -try: - from imagecorruptions import corrupt -except ImportError: - corrupt = None - -try: - import albumentations - from albumentations import Compose -except ImportError: - albumentations = None - Compose = None - - -@PIPELINES.register_module() -class Resize(object): - """Resize images & bbox & mask. - - This transform resizes the input image to some scale. Bboxes and masks are - then resized with the same scale factor. If the input dict contains the key - "scale", then the scale in the input dict is used, otherwise the specified - scale in the init method is used. If the input dict contains the key - "scale_factor" (if MultiScaleFlipAug does not give img_scale but - scale_factor), the actual scale will be computed by image shape and - scale_factor. - - `img_scale` can either be a tuple (single-scale) or a list of tuple - (multi-scale). There are 3 multiscale modes: - - - ``ratio_range is not None``: randomly sample a ratio from the ratio \ - range and multiply it with the image scale. - - ``ratio_range is None`` and ``multiscale_mode == "range"``: randomly \ - sample a scale from the multiscale range. - - ``ratio_range is None`` and ``multiscale_mode == "value"``: randomly \ - sample a scale from multiple scales. - - Args: - img_scale (tuple or list[tuple]): Images scales for resizing. - multiscale_mode (str): Either "range" or "value". - ratio_range (tuple[float]): (min_ratio, max_ratio) - keep_ratio (bool): Whether to keep the aspect ratio when resizing the - image. - bbox_clip_border (bool, optional): Whether clip the objects outside - the border of the image. Defaults to True. - backend (str): Image resize backend, choices are 'cv2' and 'pillow'. - These two backends generates slightly different results. Defaults - to 'cv2'. - override (bool, optional): Whether to override `scale` and - `scale_factor` so as to call resize twice. Default False. If True, - after the first resizing, the existed `scale` and `scale_factor` - will be ignored so the second resizing can be allowed. - This option is a work-around for multiple times of resize in DETR. - Defaults to False. - """ - - def __init__(self, - img_scale=None, - multiscale_mode='range', - ratio_range=None, - keep_ratio=True, - bbox_clip_border=True, - backend='cv2', - override=False): - if img_scale is None: - self.img_scale = None - else: - if isinstance(img_scale, list): - self.img_scale = img_scale - else: - self.img_scale = [img_scale] - assert mmcv.is_list_of(self.img_scale, tuple) - - if ratio_range is not None: - # mode 1: given a scale and a range of image ratio - assert len(self.img_scale) == 1 - else: - # mode 2: given multiple scales or a range of scales - assert multiscale_mode in ['value', 'range'] - - self.backend = backend - self.multiscale_mode = multiscale_mode - self.ratio_range = ratio_range - self.keep_ratio = keep_ratio - # TODO: refactor the override option in Resize - self.override = override - self.bbox_clip_border = bbox_clip_border - - @staticmethod - def random_select(img_scales): - """Randomly select an img_scale from given candidates. - - Args: - img_scales (list[tuple]): Images scales for selection. - - Returns: - (tuple, int): Returns a tuple ``(img_scale, scale_dix)``, \ - where ``img_scale`` is the selected image scale and \ - ``scale_idx`` is the selected index in the given candidates. - """ - - assert mmcv.is_list_of(img_scales, tuple) - scale_idx = np.random.randint(len(img_scales)) - img_scale = img_scales[scale_idx] - return img_scale, scale_idx - - @staticmethod - def random_sample(img_scales): - """Randomly sample an img_scale when ``multiscale_mode=='range'``. - - Args: - img_scales (list[tuple]): Images scale range for sampling. - There must be two tuples in img_scales, which specify the lower - and upper bound of image scales. - - Returns: - (tuple, None): Returns a tuple ``(img_scale, None)``, where \ - ``img_scale`` is sampled scale and None is just a placeholder \ - to be consistent with :func:`random_select`. - """ - - assert mmcv.is_list_of(img_scales, tuple) and len(img_scales) == 2 - img_scale_long = [max(s) for s in img_scales] - img_scale_short = [min(s) for s in img_scales] - long_edge = np.random.randint( - min(img_scale_long), - max(img_scale_long) + 1) - short_edge = np.random.randint( - min(img_scale_short), - max(img_scale_short) + 1) - img_scale = (long_edge, short_edge) - return img_scale, None - - @staticmethod - def random_sample_ratio(img_scale, ratio_range): - """Randomly sample an img_scale when ``ratio_range`` is specified. - - A ratio will be randomly sampled from the range specified by - ``ratio_range``. Then it would be multiplied with ``img_scale`` to - generate sampled scale. - - Args: - img_scale (tuple): Images scale base to multiply with ratio. - ratio_range (tuple[float]): The minimum and maximum ratio to scale - the ``img_scale``. - - Returns: - (tuple, None): Returns a tuple ``(scale, None)``, where \ - ``scale`` is sampled ratio multiplied with ``img_scale`` and \ - None is just a placeholder to be consistent with \ - :func:`random_select`. - """ - - assert isinstance(img_scale, tuple) and len(img_scale) == 2 - min_ratio, max_ratio = ratio_range - assert min_ratio <= max_ratio - ratio = np.random.random_sample() * (max_ratio - min_ratio) + min_ratio - scale = int(img_scale[0] * ratio), int(img_scale[1] * ratio) - return scale, None - - def _random_scale(self, results): - """Randomly sample an img_scale according to ``ratio_range`` and - ``multiscale_mode``. - - If ``ratio_range`` is specified, a ratio will be sampled and be - multiplied with ``img_scale``. - If multiple scales are specified by ``img_scale``, a scale will be - sampled according to ``multiscale_mode``. - Otherwise, single scale will be used. - - Args: - results (dict): Result dict from :obj:`dataset`. - - Returns: - dict: Two new keys 'scale` and 'scale_idx` are added into \ - ``results``, which would be used by subsequent pipelines. - """ - - if self.ratio_range is not None: - scale, scale_idx = self.random_sample_ratio( - self.img_scale[0], self.ratio_range) - elif len(self.img_scale) == 1: - scale, scale_idx = self.img_scale[0], 0 - elif self.multiscale_mode == 'range': - scale, scale_idx = self.random_sample(self.img_scale) - elif self.multiscale_mode == 'value': - scale, scale_idx = self.random_select(self.img_scale) - else: - raise NotImplementedError - - results['scale'] = scale - results['scale_idx'] = scale_idx - - def _resize_img(self, results): - """Resize images with ``results['scale']``.""" - for key in results.get('img_fields', ['img']): - if self.keep_ratio: - img, scale_factor = mmcv.imrescale( - results[key], - results['scale'], - return_scale=True, - backend=self.backend) - # the w_scale and h_scale has minor difference - # a real fix should be done in the mmcv.imrescale in the future - new_h, new_w = img.shape[:2] - h, w = results[key].shape[:2] - w_scale = new_w / w - h_scale = new_h / h - else: - img, w_scale, h_scale = mmcv.imresize( - results[key], - results['scale'], - return_scale=True, - backend=self.backend) - results[key] = img - - scale_factor = np.array([w_scale, h_scale, w_scale, h_scale], - dtype=np.float32) - results['img_shape'] = img.shape - # in case that there is no padding - results['pad_shape'] = img.shape - results['scale_factor'] = scale_factor - results['keep_ratio'] = self.keep_ratio - - def _resize_bboxes(self, results): - """Resize bounding boxes with ``results['scale_factor']``.""" - for key in results.get('bbox_fields', []): - bboxes = results[key] * results['scale_factor'] - if self.bbox_clip_border: - img_shape = results['img_shape'] - bboxes[:, 0::2] = np.clip(bboxes[:, 0::2], 0, img_shape[1]) - bboxes[:, 1::2] = np.clip(bboxes[:, 1::2], 0, img_shape[0]) - results[key] = bboxes - - def _resize_masks(self, results): - """Resize masks with ``results['scale']``""" - for key in results.get('mask_fields', []): - if results[key] is None: - continue - if self.keep_ratio: - results[key] = results[key].rescale(results['scale']) - else: - results[key] = results[key].resize(results['img_shape'][:2]) - - def _resize_seg(self, results): - """Resize semantic segmentation map with ``results['scale']``.""" - for key in results.get('seg_fields', []): - if self.keep_ratio: - gt_seg = mmcv.imrescale( - results[key], - results['scale'], - interpolation='nearest', - backend=self.backend) - else: - gt_seg = mmcv.imresize( - results[key], - results['scale'], - interpolation='nearest', - backend=self.backend) - results['gt_semantic_seg'] = gt_seg - - def __call__(self, results): - """Call function to resize images, bounding boxes, masks, semantic - segmentation map. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Resized results, 'img_shape', 'pad_shape', 'scale_factor', \ - 'keep_ratio' keys are added into result dict. - """ - - if 'scale' not in results: - if 'scale_factor' in results: - img_shape = results['img'].shape[:2] - scale_factor = results['scale_factor'] - assert isinstance(scale_factor, float) - results['scale'] = tuple( - [int(x * scale_factor) for x in img_shape][::-1]) - else: - self._random_scale(results) - else: - if not self.override: - assert 'scale_factor' not in results, ( - 'scale and scale_factor cannot be both set.') - else: - results.pop('scale') - if 'scale_factor' in results: - results.pop('scale_factor') - self._random_scale(results) - - self._resize_img(results) - self._resize_bboxes(results) - self._resize_masks(results) - self._resize_seg(results) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(img_scale={self.img_scale}, ' - repr_str += f'multiscale_mode={self.multiscale_mode}, ' - repr_str += f'ratio_range={self.ratio_range}, ' - repr_str += f'keep_ratio={self.keep_ratio}, ' - repr_str += f'bbox_clip_border={self.bbox_clip_border})' - return repr_str - - -@PIPELINES.register_module() -class RandomFlip(object): - """Flip the image & bbox & mask. - - If the input dict contains the key "flip", then the flag will be used, - otherwise it will be randomly decided by a ratio specified in the init - method. - - When random flip is enabled, ``flip_ratio``/``direction`` can either be a - float/string or tuple of float/string. There are 3 flip modes: - - - ``flip_ratio`` is float, ``direction`` is string: the image will be - ``direction``ly flipped with probability of ``flip_ratio`` . - E.g., ``flip_ratio=0.5``, ``direction='horizontal'``, - then image will be horizontally flipped with probability of 0.5. - - ``flip_ratio`` is float, ``direction`` is list of string: the image wil - be ``direction[i]``ly flipped with probability of - ``flip_ratio/len(direction)``. - E.g., ``flip_ratio=0.5``, ``direction=['horizontal', 'vertical']``, - then image will be horizontally flipped with probability of 0.25, - vertically with probability of 0.25. - - ``flip_ratio`` is list of float, ``direction`` is list of string: - given ``len(flip_ratio) == len(direction)``, the image wil - be ``direction[i]``ly flipped with probability of ``flip_ratio[i]``. - E.g., ``flip_ratio=[0.3, 0.5]``, ``direction=['horizontal', - 'vertical']``, then image will be horizontally flipped with probability - of 0.3, vertically with probability of 0.5 - - Args: - flip_ratio (float | list[float], optional): The flipping probability. - Default: None. - direction(str | list[str], optional): The flipping direction. Options - are 'horizontal', 'vertical', 'diagonal'. Default: 'horizontal'. - If input is a list, the length must equal ``flip_ratio``. Each - element in ``flip_ratio`` indicates the flip probability of - corresponding direction. - """ - - def __init__(self, flip_ratio=None, direction='horizontal'): - if isinstance(flip_ratio, list): - assert mmcv.is_list_of(flip_ratio, float) - assert 0 <= sum(flip_ratio) <= 1 - elif isinstance(flip_ratio, float): - assert 0 <= flip_ratio <= 1 - elif flip_ratio is None: - pass - else: - raise ValueError('flip_ratios must be None, float, ' - 'or list of float') - self.flip_ratio = flip_ratio - - valid_directions = ['horizontal', 'vertical', 'diagonal'] - if isinstance(direction, str): - assert direction in valid_directions - elif isinstance(direction, list): - assert mmcv.is_list_of(direction, str) - assert set(direction).issubset(set(valid_directions)) - else: - raise ValueError('direction must be either str or list of str') - self.direction = direction - - if isinstance(flip_ratio, list): - assert len(self.flip_ratio) == len(self.direction) - - def bbox_flip(self, bboxes, img_shape, direction): - """Flip bboxes horizontally. - - Args: - bboxes (numpy.ndarray): Bounding boxes, shape (..., 4*k) - img_shape (tuple[int]): Image shape (height, width) - direction (str): Flip direction. Options are 'horizontal', - 'vertical'. - - Returns: - numpy.ndarray: Flipped bounding boxes. - """ - - assert bboxes.shape[-1] % 4 == 0 - flipped = bboxes.copy() - if direction == 'horizontal': - w = img_shape[1] - flipped[..., 0::4] = w - bboxes[..., 2::4] - flipped[..., 2::4] = w - bboxes[..., 0::4] - elif direction == 'vertical': - h = img_shape[0] - flipped[..., 1::4] = h - bboxes[..., 3::4] - flipped[..., 3::4] = h - bboxes[..., 1::4] - elif direction == 'diagonal': - w = img_shape[1] - h = img_shape[0] - flipped[..., 0::4] = w - bboxes[..., 2::4] - flipped[..., 1::4] = h - bboxes[..., 3::4] - flipped[..., 2::4] = w - bboxes[..., 0::4] - flipped[..., 3::4] = h - bboxes[..., 1::4] - else: - raise ValueError(f"Invalid flipping direction '{direction}'") - return flipped - - def __call__(self, results): - """Call function to flip bounding boxes, masks, semantic segmentation - maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Flipped results, 'flip', 'flip_direction' keys are added \ - into result dict. - """ - - if 'flip' not in results: - if isinstance(self.direction, list): - # None means non-flip - direction_list = self.direction + [None] - else: - # None means non-flip - direction_list = [self.direction, None] - - if isinstance(self.flip_ratio, list): - non_flip_ratio = 1 - sum(self.flip_ratio) - flip_ratio_list = self.flip_ratio + [non_flip_ratio] - else: - non_flip_ratio = 1 - self.flip_ratio - # exclude non-flip - single_ratio = self.flip_ratio / (len(direction_list) - 1) - flip_ratio_list = [single_ratio] * (len(direction_list) - - 1) + [non_flip_ratio] - - cur_dir = np.random.choice(direction_list, p=flip_ratio_list) - - results['flip'] = cur_dir is not None - if 'flip_direction' not in results: - results['flip_direction'] = cur_dir - if results['flip']: - # flip image - for key in results.get('img_fields', ['img']): - results[key] = mmcv.imflip( - results[key], direction=results['flip_direction']) - # flip bboxes - for key in results.get('bbox_fields', []): - results[key] = self.bbox_flip(results[key], - results['img_shape'], - results['flip_direction']) - # flip masks - for key in results.get('mask_fields', []): - results[key] = results[key].flip(results['flip_direction']) - - # flip segs - for key in results.get('seg_fields', []): - results[key] = mmcv.imflip( - results[key], direction=results['flip_direction']) - return results - - def __repr__(self): - return self.__class__.__name__ + f'(flip_ratio={self.flip_ratio})' - - -@PIPELINES.register_module() -class Pad(object): - """Pad the image & mask. - - There are two padding modes: (1) pad to a fixed size and (2) pad to the - minimum size that is divisible by some number. - Added keys are "pad_shape", "pad_fixed_size", "pad_size_divisor", - - Args: - size (tuple, optional): Fixed padding size. - size_divisor (int, optional): The divisor of padded size. - pad_val (float, optional): Padding value, 0 by default. - """ - - def __init__(self, size=None, size_divisor=None, pad_val=0): - self.size = size - self.size_divisor = size_divisor - self.pad_val = pad_val - # only one of size and size_divisor should be valid - assert size is not None or size_divisor is not None - assert size is None or size_divisor is None - - def _pad_img(self, results): - """Pad images according to ``self.size``.""" - for key in results.get('img_fields', ['img']): - if self.size is not None: - padded_img = mmcv.impad( - results[key], shape=self.size, pad_val=self.pad_val) - elif self.size_divisor is not None: - padded_img = mmcv.impad_to_multiple( - results[key], self.size_divisor, pad_val=self.pad_val) - results[key] = padded_img - results['pad_shape'] = padded_img.shape - results['pad_fixed_size'] = self.size - results['pad_size_divisor'] = self.size_divisor - - def _pad_masks(self, results): - """Pad masks according to ``results['pad_shape']``.""" - pad_shape = results['pad_shape'][:2] - for key in results.get('mask_fields', []): - results[key] = results[key].pad(pad_shape, pad_val=self.pad_val) - - def _pad_seg(self, results): - """Pad semantic segmentation map according to - ``results['pad_shape']``.""" - for key in results.get('seg_fields', []): - results[key] = mmcv.impad( - results[key], shape=results['pad_shape'][:2]) - - def __call__(self, results): - """Call function to pad images, masks, semantic segmentation maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Updated result dict. - """ - self._pad_img(results) - self._pad_masks(results) - self._pad_seg(results) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(size={self.size}, ' - repr_str += f'size_divisor={self.size_divisor}, ' - repr_str += f'pad_val={self.pad_val})' - return repr_str - - -@PIPELINES.register_module() -class Normalize(object): - """Normalize the image. - - Added key is "img_norm_cfg". - - Args: - mean (sequence): Mean values of 3 channels. - std (sequence): Std values of 3 channels. - to_rgb (bool): Whether to convert the image from BGR to RGB, - default is true. - """ - - def __init__(self, mean, std, to_rgb=True): - self.mean = np.array(mean, dtype=np.float32) - self.std = np.array(std, dtype=np.float32) - self.to_rgb = to_rgb - - def __call__(self, results): - """Call function to normalize images. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Normalized results, 'img_norm_cfg' key is added into - result dict. - """ - for key in results.get('img_fields', ['img']): - results[key] = mmcv.imnormalize(results[key], self.mean, self.std, - self.to_rgb) - results['img_norm_cfg'] = dict( - mean=self.mean, std=self.std, to_rgb=self.to_rgb) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(mean={self.mean}, std={self.std}, to_rgb={self.to_rgb})' - return repr_str - - -@PIPELINES.register_module() -class RandomCrop(object): - """Random crop the image & bboxes & masks. - - The absolute `crop_size` is sampled based on `crop_type` and `image_size`, - then the cropped results are generated. - - Args: - crop_size (tuple): The relative ratio or absolute pixels of - height and width. - crop_type (str, optional): one of "relative_range", "relative", - "absolute", "absolute_range". "relative" randomly crops - (h * crop_size[0], w * crop_size[1]) part from an input of size - (h, w). "relative_range" uniformly samples relative crop size from - range [crop_size[0], 1] and [crop_size[1], 1] for height and width - respectively. "absolute" crops from an input with absolute size - (crop_size[0], crop_size[1]). "absolute_range" uniformly samples - crop_h in range [crop_size[0], min(h, crop_size[1])] and crop_w - in range [crop_size[0], min(w, crop_size[1])]. Default "absolute". - allow_negative_crop (bool, optional): Whether to allow a crop that does - not contain any bbox area. Default False. - bbox_clip_border (bool, optional): Whether clip the objects outside - the border of the image. Defaults to True. - - Note: - - If the image is smaller than the absolute crop size, return the - original image. - - The keys for bboxes, labels and masks must be aligned. That is, - `gt_bboxes` corresponds to `gt_labels` and `gt_masks`, and - `gt_bboxes_ignore` corresponds to `gt_labels_ignore` and - `gt_masks_ignore`. - - If the crop does not contain any gt-bbox region and - `allow_negative_crop` is set to False, skip this image. - """ - - def __init__(self, - crop_size, - crop_type='absolute', - allow_negative_crop=False, - bbox_clip_border=True): - if crop_type not in [ - 'relative_range', 'relative', 'absolute', 'absolute_range' - ]: - raise ValueError(f'Invalid crop_type {crop_type}.') - if crop_type in ['absolute', 'absolute_range']: - assert crop_size[0] > 0 and crop_size[1] > 0 - assert isinstance(crop_size[0], int) and isinstance( - crop_size[1], int) - else: - assert 0 < crop_size[0] <= 1 and 0 < crop_size[1] <= 1 - self.crop_size = crop_size - self.crop_type = crop_type - self.allow_negative_crop = allow_negative_crop - self.bbox_clip_border = bbox_clip_border - # The key correspondence from bboxes to labels and masks. - self.bbox2label = { - 'gt_bboxes': 'gt_labels', - 'gt_bboxes_ignore': 'gt_labels_ignore' - } - self.bbox2mask = { - 'gt_bboxes': 'gt_masks', - 'gt_bboxes_ignore': 'gt_masks_ignore' - } - - def _crop_data(self, results, crop_size, allow_negative_crop): - """Function to randomly crop images, bounding boxes, masks, semantic - segmentation maps. - - Args: - results (dict): Result dict from loading pipeline. - crop_size (tuple): Expected absolute size after cropping, (h, w). - allow_negative_crop (bool): Whether to allow a crop that does not - contain any bbox area. Default to False. - - Returns: - dict: Randomly cropped results, 'img_shape' key in result dict is - updated according to crop size. - """ - assert crop_size[0] > 0 and crop_size[1] > 0 - for key in results.get('img_fields', ['img']): - img = results[key] - margin_h = max(img.shape[0] - crop_size[0], 0) - margin_w = max(img.shape[1] - crop_size[1], 0) - offset_h = np.random.randint(0, margin_h + 1) - offset_w = np.random.randint(0, margin_w + 1) - crop_y1, crop_y2 = offset_h, offset_h + crop_size[0] - crop_x1, crop_x2 = offset_w, offset_w + crop_size[1] - - # crop the image - img = img[crop_y1:crop_y2, crop_x1:crop_x2, ...] - img_shape = img.shape - results[key] = img - results['img_shape'] = img_shape - - # crop bboxes accordingly and clip to the image boundary - for key in results.get('bbox_fields', []): - # e.g. gt_bboxes and gt_bboxes_ignore - bbox_offset = np.array([offset_w, offset_h, offset_w, offset_h], - dtype=np.float32) - bboxes = results[key] - bbox_offset - if self.bbox_clip_border: - bboxes[:, 0::2] = np.clip(bboxes[:, 0::2], 0, img_shape[1]) - bboxes[:, 1::2] = np.clip(bboxes[:, 1::2], 0, img_shape[0]) - valid_inds = (bboxes[:, 2] > bboxes[:, 0]) & ( - bboxes[:, 3] > bboxes[:, 1]) - # If the crop does not contain any gt-bbox area and - # allow_negative_crop is False, skip this image. - if (key == 'gt_bboxes' and not valid_inds.any() - and not allow_negative_crop): - return None - results[key] = bboxes[valid_inds, :] - # label fields. e.g. gt_labels and gt_labels_ignore - label_key = self.bbox2label.get(key) - if label_key in results: - results[label_key] = results[label_key][valid_inds] - - # mask fields, e.g. gt_masks and gt_masks_ignore - mask_key = self.bbox2mask.get(key) - if mask_key in results: - results[mask_key] = results[mask_key][ - valid_inds.nonzero()[0]].crop( - np.asarray([crop_x1, crop_y1, crop_x2, crop_y2])) - - # crop semantic seg - for key in results.get('seg_fields', []): - results[key] = results[key][crop_y1:crop_y2, crop_x1:crop_x2] - - return results - - def _get_crop_size(self, image_size): - """Randomly generates the absolute crop size based on `crop_type` and - `image_size`. - - Args: - image_size (tuple): (h, w). - - Returns: - crop_size (tuple): (crop_h, crop_w) in absolute pixels. - """ - h, w = image_size - if self.crop_type == 'absolute': - return (min(self.crop_size[0], h), min(self.crop_size[1], w)) - elif self.crop_type == 'absolute_range': - assert self.crop_size[0] <= self.crop_size[1] - crop_h = np.random.randint( - min(h, self.crop_size[0]), - min(h, self.crop_size[1]) + 1) - crop_w = np.random.randint( - min(w, self.crop_size[0]), - min(w, self.crop_size[1]) + 1) - return crop_h, crop_w - elif self.crop_type == 'relative': - crop_h, crop_w = self.crop_size - return int(h * crop_h + 0.5), int(w * crop_w + 0.5) - elif self.crop_type == 'relative_range': - crop_size = np.asarray(self.crop_size, dtype=np.float32) - crop_h, crop_w = crop_size + np.random.rand(2) * (1 - crop_size) - return int(h * crop_h + 0.5), int(w * crop_w + 0.5) - - def __call__(self, results): - """Call function to randomly crop images, bounding boxes, masks, - semantic segmentation maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Randomly cropped results, 'img_shape' key in result dict is - updated according to crop size. - """ - image_size = results['img'].shape[:2] - crop_size = self._get_crop_size(image_size) - results = self._crop_data(results, crop_size, self.allow_negative_crop) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(crop_size={self.crop_size}, ' - repr_str += f'crop_type={self.crop_type}, ' - repr_str += f'allow_negative_crop={self.allow_negative_crop}, ' - repr_str += f'bbox_clip_border={self.bbox_clip_border})' - return repr_str - - -@PIPELINES.register_module() -class SegRescale(object): - """Rescale semantic segmentation maps. - - Args: - scale_factor (float): The scale factor of the final output. - backend (str): Image rescale backend, choices are 'cv2' and 'pillow'. - These two backends generates slightly different results. Defaults - to 'cv2'. - """ - - def __init__(self, scale_factor=1, backend='cv2'): - self.scale_factor = scale_factor - self.backend = backend - - def __call__(self, results): - """Call function to scale the semantic segmentation map. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with semantic segmentation map scaled. - """ - - for key in results.get('seg_fields', []): - if self.scale_factor != 1: - results[key] = mmcv.imrescale( - results[key], - self.scale_factor, - interpolation='nearest', - backend=self.backend) - return results - - def __repr__(self): - return self.__class__.__name__ + f'(scale_factor={self.scale_factor})' - - -@PIPELINES.register_module() -class PhotoMetricDistortion(object): - """Apply photometric distortion to image sequentially, every transformation - is applied with a probability of 0.5. The position of random contrast is in - second or second to last. - - 1. random brightness - 2. random contrast (mode 0) - 3. convert color from BGR to HSV - 4. random saturation - 5. random hue - 6. convert color from HSV to BGR - 7. random contrast (mode 1) - 8. randomly swap channels - - Args: - brightness_delta (int): delta of brightness. - contrast_range (tuple): range of contrast. - saturation_range (tuple): range of saturation. - hue_delta (int): delta of hue. - """ - - def __init__(self, - brightness_delta=32, - contrast_range=(0.5, 1.5), - saturation_range=(0.5, 1.5), - hue_delta=18): - self.brightness_delta = brightness_delta - self.contrast_lower, self.contrast_upper = contrast_range - self.saturation_lower, self.saturation_upper = saturation_range - self.hue_delta = hue_delta - - def __call__(self, results): - """Call function to perform photometric distortion on images. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with images distorted. - """ - - if 'img_fields' in results: - assert results['img_fields'] == ['img'], \ - 'Only single img_fields is allowed' - img = results['img'] - assert img.dtype == np.float32, \ - 'PhotoMetricDistortion needs the input image of dtype np.float32,'\ - ' please set "to_float32=True" in "LoadImageFromFile" pipeline' - # random brightness - if random.randint(2): - delta = random.uniform(-self.brightness_delta, - self.brightness_delta) - img += delta - - # mode == 0 --> do random contrast first - # mode == 1 --> do random contrast last - mode = random.randint(2) - if mode == 1: - if random.randint(2): - alpha = random.uniform(self.contrast_lower, - self.contrast_upper) - img *= alpha - - # convert color from BGR to HSV - img = mmcv.bgr2hsv(img) - - # random saturation - if random.randint(2): - img[..., 1] *= random.uniform(self.saturation_lower, - self.saturation_upper) - - # random hue - if random.randint(2): - img[..., 0] += random.uniform(-self.hue_delta, self.hue_delta) - img[..., 0][img[..., 0] > 360] -= 360 - img[..., 0][img[..., 0] < 0] += 360 - - # convert color from HSV to BGR - img = mmcv.hsv2bgr(img) - - # random contrast - if mode == 0: - if random.randint(2): - alpha = random.uniform(self.contrast_lower, - self.contrast_upper) - img *= alpha - - # randomly swap channels - if random.randint(2): - img = img[..., random.permutation(3)] - - results['img'] = img - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(\nbrightness_delta={self.brightness_delta},\n' - repr_str += 'contrast_range=' - repr_str += f'{(self.contrast_lower, self.contrast_upper)},\n' - repr_str += 'saturation_range=' - repr_str += f'{(self.saturation_lower, self.saturation_upper)},\n' - repr_str += f'hue_delta={self.hue_delta})' - return repr_str - - -@PIPELINES.register_module() -class Expand(object): - """Random expand the image & bboxes. - - Randomly place the original image on a canvas of 'ratio' x original image - size filled with mean values. The ratio is in the range of ratio_range. - - Args: - mean (tuple): mean value of dataset. - to_rgb (bool): if need to convert the order of mean to align with RGB. - ratio_range (tuple): range of expand ratio. - prob (float): probability of applying this transformation - """ - - def __init__(self, - mean=(0, 0, 0), - to_rgb=True, - ratio_range=(1, 4), - seg_ignore_label=None, - prob=0.5): - self.to_rgb = to_rgb - self.ratio_range = ratio_range - if to_rgb: - self.mean = mean[::-1] - else: - self.mean = mean - self.min_ratio, self.max_ratio = ratio_range - self.seg_ignore_label = seg_ignore_label - self.prob = prob - - def __call__(self, results): - """Call function to expand images, bounding boxes. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with images, bounding boxes expanded - """ - - if random.uniform(0, 1) > self.prob: - return results - - if 'img_fields' in results: - assert results['img_fields'] == ['img'], \ - 'Only single img_fields is allowed' - img = results['img'] - - h, w, c = img.shape - ratio = random.uniform(self.min_ratio, self.max_ratio) - # speedup expand when meets large image - if np.all(self.mean == self.mean[0]): - expand_img = np.empty((int(h * ratio), int(w * ratio), c), - img.dtype) - expand_img.fill(self.mean[0]) - else: - expand_img = np.full((int(h * ratio), int(w * ratio), c), - self.mean, - dtype=img.dtype) - left = int(random.uniform(0, w * ratio - w)) - top = int(random.uniform(0, h * ratio - h)) - expand_img[top:top + h, left:left + w] = img - - results['img'] = expand_img - # expand bboxes - for key in results.get('bbox_fields', []): - results[key] = results[key] + np.tile( - (left, top), 2).astype(results[key].dtype) - - # expand masks - for key in results.get('mask_fields', []): - results[key] = results[key].expand( - int(h * ratio), int(w * ratio), top, left) - - # expand segs - for key in results.get('seg_fields', []): - gt_seg = results[key] - expand_gt_seg = np.full((int(h * ratio), int(w * ratio)), - self.seg_ignore_label, - dtype=gt_seg.dtype) - expand_gt_seg[top:top + h, left:left + w] = gt_seg - results[key] = expand_gt_seg - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(mean={self.mean}, to_rgb={self.to_rgb}, ' - repr_str += f'ratio_range={self.ratio_range}, ' - repr_str += f'seg_ignore_label={self.seg_ignore_label})' - return repr_str - - -@PIPELINES.register_module() -class MinIoURandomCrop(object): - """Random crop the image & bboxes, the cropped patches have minimum IoU - requirement with original image & bboxes, the IoU threshold is randomly - selected from min_ious. - - Args: - min_ious (tuple): minimum IoU threshold for all intersections with - bounding boxes - min_crop_size (float): minimum crop's size (i.e. h,w := a*h, a*w, - where a >= min_crop_size). - bbox_clip_border (bool, optional): Whether clip the objects outside - the border of the image. Defaults to True. - - Note: - The keys for bboxes, labels and masks should be paired. That is, \ - `gt_bboxes` corresponds to `gt_labels` and `gt_masks`, and \ - `gt_bboxes_ignore` to `gt_labels_ignore` and `gt_masks_ignore`. - """ - - def __init__(self, - min_ious=(0.1, 0.3, 0.5, 0.7, 0.9), - min_crop_size=0.3, - bbox_clip_border=True): - # 1: return ori img - self.min_ious = min_ious - self.sample_mode = (1, *min_ious, 0) - self.min_crop_size = min_crop_size - self.bbox_clip_border = bbox_clip_border - self.bbox2label = { - 'gt_bboxes': 'gt_labels', - 'gt_bboxes_ignore': 'gt_labels_ignore' - } - self.bbox2mask = { - 'gt_bboxes': 'gt_masks', - 'gt_bboxes_ignore': 'gt_masks_ignore' - } - - def __call__(self, results): - """Call function to crop images and bounding boxes with minimum IoU - constraint. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with images and bounding boxes cropped, \ - 'img_shape' key is updated. - """ - - if 'img_fields' in results: - assert results['img_fields'] == ['img'], \ - 'Only single img_fields is allowed' - img = results['img'] - assert 'bbox_fields' in results - boxes = [results[key] for key in results['bbox_fields']] - boxes = np.concatenate(boxes, 0) - h, w, c = img.shape - while True: - mode = random.choice(self.sample_mode) - self.mode = mode - if mode == 1: - return results - - min_iou = mode - for i in range(50): - new_w = random.uniform(self.min_crop_size * w, w) - new_h = random.uniform(self.min_crop_size * h, h) - - # h / w in [0.5, 2] - if new_h / new_w < 0.5 or new_h / new_w > 2: - continue - - left = random.uniform(w - new_w) - top = random.uniform(h - new_h) - - patch = np.array( - (int(left), int(top), int(left + new_w), int(top + new_h))) - # Line or point crop is not allowed - if patch[2] == patch[0] or patch[3] == patch[1]: - continue - overlaps = bbox_overlaps( - patch.reshape(-1, 4), boxes.reshape(-1, 4)).reshape(-1) - if len(overlaps) > 0 and overlaps.min() < min_iou: - continue - - # center of boxes should inside the crop img - # only adjust boxes and instance masks when the gt is not empty - if len(overlaps) > 0: - # adjust boxes - def is_center_of_bboxes_in_patch(boxes, patch): - center = (boxes[:, :2] + boxes[:, 2:]) / 2 - mask = ((center[:, 0] > patch[0]) * - (center[:, 1] > patch[1]) * - (center[:, 0] < patch[2]) * - (center[:, 1] < patch[3])) - return mask - - mask = is_center_of_bboxes_in_patch(boxes, patch) - if not mask.any(): - continue - for key in results.get('bbox_fields', []): - boxes = results[key].copy() - mask = is_center_of_bboxes_in_patch(boxes, patch) - boxes = boxes[mask] - if self.bbox_clip_border: - boxes[:, 2:] = boxes[:, 2:].clip(max=patch[2:]) - boxes[:, :2] = boxes[:, :2].clip(min=patch[:2]) - boxes -= np.tile(patch[:2], 2) - - results[key] = boxes - # labels - label_key = self.bbox2label.get(key) - if label_key in results: - results[label_key] = results[label_key][mask] - - # mask fields - mask_key = self.bbox2mask.get(key) - if mask_key in results: - results[mask_key] = results[mask_key][ - mask.nonzero()[0]].crop(patch) - # adjust the img no matter whether the gt is empty before crop - img = img[patch[1]:patch[3], patch[0]:patch[2]] - results['img'] = img - results['img_shape'] = img.shape - - # seg fields - for key in results.get('seg_fields', []): - results[key] = results[key][patch[1]:patch[3], - patch[0]:patch[2]] - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(min_ious={self.min_ious}, ' - repr_str += f'min_crop_size={self.min_crop_size}, ' - repr_str += f'bbox_clip_border={self.bbox_clip_border})' - return repr_str - - -@PIPELINES.register_module() -class Corrupt(object): - """Corruption augmentation. - - Corruption transforms implemented based on - `imagecorruptions `_. - - Args: - corruption (str): Corruption name. - severity (int, optional): The severity of corruption. Default: 1. - """ - - def __init__(self, corruption, severity=1): - self.corruption = corruption - self.severity = severity - - def __call__(self, results): - """Call function to corrupt image. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with images corrupted. - """ - - if corrupt is None: - raise RuntimeError('imagecorruptions is not installed') - if 'img_fields' in results: - assert results['img_fields'] == ['img'], \ - 'Only single img_fields is allowed' - results['img'] = corrupt( - results['img'].astype(np.uint8), - corruption_name=self.corruption, - severity=self.severity) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(corruption={self.corruption}, ' - repr_str += f'severity={self.severity})' - return repr_str - - -@PIPELINES.register_module() -class Albu(object): - """Albumentation augmentation. - - Adds custom transformations from Albumentations library. - Please, visit `https://albumentations.readthedocs.io` - to get more information. - - An example of ``transforms`` is as followed: - - .. code-block:: - - [ - dict( - type='ShiftScaleRotate', - shift_limit=0.0625, - scale_limit=0.0, - rotate_limit=0, - interpolation=1, - p=0.5), - dict( - type='RandomBrightnessContrast', - brightness_limit=[0.1, 0.3], - contrast_limit=[0.1, 0.3], - p=0.2), - dict(type='ChannelShuffle', p=0.1), - dict( - type='OneOf', - transforms=[ - dict(type='Blur', blur_limit=3, p=1.0), - dict(type='MedianBlur', blur_limit=3, p=1.0) - ], - p=0.1), - ] - - Args: - transforms (list[dict]): A list of albu transformations - bbox_params (dict): Bbox_params for albumentation `Compose` - keymap (dict): Contains {'input key':'albumentation-style key'} - skip_img_without_anno (bool): Whether to skip the image if no ann left - after aug - """ - - def __init__(self, - transforms, - bbox_params=None, - keymap=None, - update_pad_shape=False, - skip_img_without_anno=False): - if Compose is None: - raise RuntimeError('albumentations is not installed') - - # Args will be modified later, copying it will be safer - transforms = copy.deepcopy(transforms) - if bbox_params is not None: - bbox_params = copy.deepcopy(bbox_params) - if keymap is not None: - keymap = copy.deepcopy(keymap) - self.transforms = transforms - self.filter_lost_elements = False - self.update_pad_shape = update_pad_shape - self.skip_img_without_anno = skip_img_without_anno - - # A simple workaround to remove masks without boxes - if (isinstance(bbox_params, dict) and 'label_fields' in bbox_params - and 'filter_lost_elements' in bbox_params): - self.filter_lost_elements = True - self.origin_label_fields = bbox_params['label_fields'] - bbox_params['label_fields'] = ['idx_mapper'] - del bbox_params['filter_lost_elements'] - - self.bbox_params = ( - self.albu_builder(bbox_params) if bbox_params else None) - self.aug = Compose([self.albu_builder(t) for t in self.transforms], - bbox_params=self.bbox_params) - - if not keymap: - self.keymap_to_albu = { - 'img': 'image', - 'gt_masks': 'masks', - 'gt_bboxes': 'bboxes' - } - else: - self.keymap_to_albu = keymap - self.keymap_back = {v: k for k, v in self.keymap_to_albu.items()} - - def albu_builder(self, cfg): - """Import a module from albumentations. - - It inherits some of :func:`build_from_cfg` logic. - - Args: - cfg (dict): Config dict. It should at least contain the key "type". - - Returns: - obj: The constructed object. - """ - - assert isinstance(cfg, dict) and 'type' in cfg - args = cfg.copy() - - obj_type = args.pop('type') - if mmcv.is_str(obj_type): - if albumentations is None: - raise RuntimeError('albumentations is not installed') - obj_cls = getattr(albumentations, obj_type) - elif inspect.isclass(obj_type): - obj_cls = obj_type - else: - raise TypeError( - f'type must be a str or valid type, but got {type(obj_type)}') - - if 'transforms' in args: - args['transforms'] = [ - self.albu_builder(transform) - for transform in args['transforms'] - ] - - return obj_cls(**args) - - @staticmethod - def mapper(d, keymap): - """Dictionary mapper. Renames keys according to keymap provided. - - Args: - d (dict): old dict - keymap (dict): {'old_key':'new_key'} - Returns: - dict: new dict. - """ - - updated_dict = {} - for k, v in zip(d.keys(), d.values()): - new_k = keymap.get(k, k) - updated_dict[new_k] = d[k] - return updated_dict - - def __call__(self, results): - # dict to albumentations format - results = self.mapper(results, self.keymap_to_albu) - # TODO: add bbox_fields - if 'bboxes' in results: - # to list of boxes - if isinstance(results['bboxes'], np.ndarray): - results['bboxes'] = [x for x in results['bboxes']] - # add pseudo-field for filtration - if self.filter_lost_elements: - results['idx_mapper'] = np.arange(len(results['bboxes'])) - - # TODO: Support mask structure in albu - if 'masks' in results: - if isinstance(results['masks'], PolygonMasks): - raise NotImplementedError( - 'Albu only supports BitMap masks now') - ori_masks = results['masks'] - if albumentations.__version__ < '0.5': - results['masks'] = results['masks'].masks - else: - results['masks'] = [mask for mask in results['masks'].masks] - - results = self.aug(**results) - - if 'bboxes' in results: - if isinstance(results['bboxes'], list): - results['bboxes'] = np.array( - results['bboxes'], dtype=np.float32) - results['bboxes'] = results['bboxes'].reshape(-1, 4) - - # filter label_fields - if self.filter_lost_elements: - - for label in self.origin_label_fields: - results[label] = np.array( - [results[label][i] for i in results['idx_mapper']]) - if 'masks' in results: - results['masks'] = np.array( - [results['masks'][i] for i in results['idx_mapper']]) - results['masks'] = ori_masks.__class__( - results['masks'], results['image'].shape[0], - results['image'].shape[1]) - - if (not len(results['idx_mapper']) - and self.skip_img_without_anno): - return None - - if 'gt_labels' in results: - if isinstance(results['gt_labels'], list): - results['gt_labels'] = np.array(results['gt_labels']) - results['gt_labels'] = results['gt_labels'].astype(np.int64) - - # back to the original format - results = self.mapper(results, self.keymap_back) - - # update final shape - if self.update_pad_shape: - results['pad_shape'] = results['img'].shape - - return results - - def __repr__(self): - repr_str = self.__class__.__name__ + f'(transforms={self.transforms})' - return repr_str - - -@PIPELINES.register_module() -class RandomCenterCropPad(object): - """Random center crop and random around padding for CornerNet. - - This operation generates randomly cropped image from the original image and - pads it simultaneously. Different from :class:`RandomCrop`, the output - shape may not equal to ``crop_size`` strictly. We choose a random value - from ``ratios`` and the output shape could be larger or smaller than - ``crop_size``. The padding operation is also different from :class:`Pad`, - here we use around padding instead of right-bottom padding. - - The relation between output image (padding image) and original image: - - .. code:: text - - output image - - +----------------------------+ - | padded area | - +------|----------------------------|----------+ - | | cropped area | | - | | +---------------+ | | - | | | . center | | | original image - | | | range | | | - | | +---------------+ | | - +------|----------------------------|----------+ - | padded area | - +----------------------------+ - - There are 5 main areas in the figure: - - - output image: output image of this operation, also called padding - image in following instruction. - - original image: input image of this operation. - - padded area: non-intersect area of output image and original image. - - cropped area: the overlap of output image and original image. - - center range: a smaller area where random center chosen from. - center range is computed by ``border`` and original image's shape - to avoid our random center is too close to original image's border. - - Also this operation act differently in train and test mode, the summary - pipeline is listed below. - - Train pipeline: - - 1. Choose a ``random_ratio`` from ``ratios``, the shape of padding image - will be ``random_ratio * crop_size``. - 2. Choose a ``random_center`` in center range. - 3. Generate padding image with center matches the ``random_center``. - 4. Initialize the padding image with pixel value equals to ``mean``. - 5. Copy the cropped area to padding image. - 6. Refine annotations. - - Test pipeline: - - 1. Compute output shape according to ``test_pad_mode``. - 2. Generate padding image with center matches the original image - center. - 3. Initialize the padding image with pixel value equals to ``mean``. - 4. Copy the ``cropped area`` to padding image. - - Args: - crop_size (tuple | None): expected size after crop, final size will - computed according to ratio. Requires (h, w) in train mode, and - None in test mode. - ratios (tuple): random select a ratio from tuple and crop image to - (crop_size[0] * ratio) * (crop_size[1] * ratio). - Only available in train mode. - border (int): max distance from center select area to image border. - Only available in train mode. - mean (sequence): Mean values of 3 channels. - std (sequence): Std values of 3 channels. - to_rgb (bool): Whether to convert the image from BGR to RGB. - test_mode (bool): whether involve random variables in transform. - In train mode, crop_size is fixed, center coords and ratio is - random selected from predefined lists. In test mode, crop_size - is image's original shape, center coords and ratio is fixed. - test_pad_mode (tuple): padding method and padding shape value, only - available in test mode. Default is using 'logical_or' with - 127 as padding shape value. - - - 'logical_or': final_shape = input_shape | padding_shape_value - - 'size_divisor': final_shape = int( - ceil(input_shape / padding_shape_value) * padding_shape_value) - bbox_clip_border (bool, optional): Whether clip the objects outside - the border of the image. Defaults to True. - """ - - def __init__(self, - crop_size=None, - ratios=(0.9, 1.0, 1.1), - border=128, - mean=None, - std=None, - to_rgb=None, - test_mode=False, - test_pad_mode=('logical_or', 127), - bbox_clip_border=True): - if test_mode: - assert crop_size is None, 'crop_size must be None in test mode' - assert ratios is None, 'ratios must be None in test mode' - assert border is None, 'border must be None in test mode' - assert isinstance(test_pad_mode, (list, tuple)) - assert test_pad_mode[0] in ['logical_or', 'size_divisor'] - else: - assert isinstance(crop_size, (list, tuple)) - assert crop_size[0] > 0 and crop_size[1] > 0, ( - 'crop_size must > 0 in train mode') - assert isinstance(ratios, (list, tuple)) - assert test_pad_mode is None, ( - 'test_pad_mode must be None in train mode') - - self.crop_size = crop_size - self.ratios = ratios - self.border = border - # We do not set default value to mean, std and to_rgb because these - # hyper-parameters are easy to forget but could affect the performance. - # Please use the same setting as Normalize for performance assurance. - assert mean is not None and std is not None and to_rgb is not None - self.to_rgb = to_rgb - self.input_mean = mean - self.input_std = std - if to_rgb: - self.mean = mean[::-1] - self.std = std[::-1] - else: - self.mean = mean - self.std = std - self.test_mode = test_mode - self.test_pad_mode = test_pad_mode - self.bbox_clip_border = bbox_clip_border - - def _get_border(self, border, size): - """Get final border for the target size. - - This function generates a ``final_border`` according to image's shape. - The area between ``final_border`` and ``size - final_border`` is the - ``center range``. We randomly choose center from the ``center range`` - to avoid our random center is too close to original image's border. - Also ``center range`` should be larger than 0. - - Args: - border (int): The initial border, default is 128. - size (int): The width or height of original image. - Returns: - int: The final border. - """ - k = 2 * border / size - i = pow(2, np.ceil(np.log2(np.ceil(k))) + (k == int(k))) - return border // i - - def _filter_boxes(self, patch, boxes): - """Check whether the center of each box is in the patch. - - Args: - patch (list[int]): The cropped area, [left, top, right, bottom]. - boxes (numpy array, (N x 4)): Ground truth boxes. - - Returns: - mask (numpy array, (N,)): Each box is inside or outside the patch. - """ - center = (boxes[:, :2] + boxes[:, 2:]) / 2 - mask = (center[:, 0] > patch[0]) * (center[:, 1] > patch[1]) * ( - center[:, 0] < patch[2]) * ( - center[:, 1] < patch[3]) - return mask - - def _crop_image_and_paste(self, image, center, size): - """Crop image with a given center and size, then paste the cropped - image to a blank image with two centers align. - - This function is equivalent to generating a blank image with ``size`` - as its shape. Then cover it on the original image with two centers ( - the center of blank image and the random center of original image) - aligned. The overlap area is paste from the original image and the - outside area is filled with ``mean pixel``. - - Args: - image (np array, H x W x C): Original image. - center (list[int]): Target crop center coord. - size (list[int]): Target crop size. [target_h, target_w] - - Returns: - cropped_img (np array, target_h x target_w x C): Cropped image. - border (np array, 4): The distance of four border of - ``cropped_img`` to the original image area, [top, bottom, - left, right] - patch (list[int]): The cropped area, [left, top, right, bottom]. - """ - center_y, center_x = center - target_h, target_w = size - img_h, img_w, img_c = image.shape - - x0 = max(0, center_x - target_w // 2) - x1 = min(center_x + target_w // 2, img_w) - y0 = max(0, center_y - target_h // 2) - y1 = min(center_y + target_h // 2, img_h) - patch = np.array((int(x0), int(y0), int(x1), int(y1))) - - left, right = center_x - x0, x1 - center_x - top, bottom = center_y - y0, y1 - center_y - - cropped_center_y, cropped_center_x = target_h // 2, target_w // 2 - cropped_img = np.zeros((target_h, target_w, img_c), dtype=image.dtype) - for i in range(img_c): - cropped_img[:, :, i] += self.mean[i] - y_slice = slice(cropped_center_y - top, cropped_center_y + bottom) - x_slice = slice(cropped_center_x - left, cropped_center_x + right) - cropped_img[y_slice, x_slice, :] = image[y0:y1, x0:x1, :] - - border = np.array([ - cropped_center_y - top, cropped_center_y + bottom, - cropped_center_x - left, cropped_center_x + right - ], - dtype=np.float32) - - return cropped_img, border, patch - - def _train_aug(self, results): - """Random crop and around padding the original image. - - Args: - results (dict): Image infomations in the augment pipeline. - - Returns: - results (dict): The updated dict. - """ - img = results['img'] - h, w, c = img.shape - boxes = results['gt_bboxes'] - while True: - scale = random.choice(self.ratios) - new_h = int(self.crop_size[0] * scale) - new_w = int(self.crop_size[1] * scale) - h_border = self._get_border(self.border, h) - w_border = self._get_border(self.border, w) - - for i in range(50): - center_x = random.randint(low=w_border, high=w - w_border) - center_y = random.randint(low=h_border, high=h - h_border) - - cropped_img, border, patch = self._crop_image_and_paste( - img, [center_y, center_x], [new_h, new_w]) - - mask = self._filter_boxes(patch, boxes) - # if image do not have valid bbox, any crop patch is valid. - if not mask.any() and len(boxes) > 0: - continue - - results['img'] = cropped_img - results['img_shape'] = cropped_img.shape - results['pad_shape'] = cropped_img.shape - - x0, y0, x1, y1 = patch - - left_w, top_h = center_x - x0, center_y - y0 - cropped_center_x, cropped_center_y = new_w // 2, new_h // 2 - - # crop bboxes accordingly and clip to the image boundary - for key in results.get('bbox_fields', []): - mask = self._filter_boxes(patch, results[key]) - bboxes = results[key][mask] - bboxes[:, 0:4:2] += cropped_center_x - left_w - x0 - bboxes[:, 1:4:2] += cropped_center_y - top_h - y0 - if self.bbox_clip_border: - bboxes[:, 0:4:2] = np.clip(bboxes[:, 0:4:2], 0, new_w) - bboxes[:, 1:4:2] = np.clip(bboxes[:, 1:4:2], 0, new_h) - keep = (bboxes[:, 2] > bboxes[:, 0]) & ( - bboxes[:, 3] > bboxes[:, 1]) - bboxes = bboxes[keep] - results[key] = bboxes - if key in ['gt_bboxes']: - if 'gt_labels' in results: - labels = results['gt_labels'][mask] - labels = labels[keep] - results['gt_labels'] = labels - if 'gt_masks' in results: - raise NotImplementedError( - 'RandomCenterCropPad only supports bbox.') - - # crop semantic seg - for key in results.get('seg_fields', []): - raise NotImplementedError( - 'RandomCenterCropPad only supports bbox.') - return results - - def _test_aug(self, results): - """Around padding the original image without cropping. - - The padding mode and value are from ``test_pad_mode``. - - Args: - results (dict): Image infomations in the augment pipeline. - - Returns: - results (dict): The updated dict. - """ - img = results['img'] - h, w, c = img.shape - results['img_shape'] = img.shape - if self.test_pad_mode[0] in ['logical_or']: - target_h = h | self.test_pad_mode[1] - target_w = w | self.test_pad_mode[1] - elif self.test_pad_mode[0] in ['size_divisor']: - divisor = self.test_pad_mode[1] - target_h = int(np.ceil(h / divisor)) * divisor - target_w = int(np.ceil(w / divisor)) * divisor - else: - raise NotImplementedError( - 'RandomCenterCropPad only support two testing pad mode:' - 'logical-or and size_divisor.') - - cropped_img, border, _ = self._crop_image_and_paste( - img, [h // 2, w // 2], [target_h, target_w]) - results['img'] = cropped_img - results['pad_shape'] = cropped_img.shape - results['border'] = border - return results - - def __call__(self, results): - img = results['img'] - assert img.dtype == np.float32, ( - 'RandomCenterCropPad needs the input image of dtype np.float32,' - ' please set "to_float32=True" in "LoadImageFromFile" pipeline') - h, w, c = img.shape - assert c == len(self.mean) - if self.test_mode: - return self._test_aug(results) - else: - return self._train_aug(results) - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(crop_size={self.crop_size}, ' - repr_str += f'ratios={self.ratios}, ' - repr_str += f'border={self.border}, ' - repr_str += f'mean={self.input_mean}, ' - repr_str += f'std={self.input_std}, ' - repr_str += f'to_rgb={self.to_rgb}, ' - repr_str += f'test_mode={self.test_mode}, ' - repr_str += f'test_pad_mode={self.test_pad_mode}, ' - repr_str += f'bbox_clip_border={self.bbox_clip_border})' - return repr_str - - -@PIPELINES.register_module() -class CutOut(object): - """CutOut operation. - - Randomly drop some regions of image used in - `Cutout `_. - - Args: - n_holes (int | tuple[int, int]): Number of regions to be dropped. - If it is given as a list, number of holes will be randomly - selected from the closed interval [`n_holes[0]`, `n_holes[1]`]. - cutout_shape (tuple[int, int] | list[tuple[int, int]]): The candidate - shape of dropped regions. It can be `tuple[int, int]` to use a - fixed cutout shape, or `list[tuple[int, int]]` to randomly choose - shape from the list. - cutout_ratio (tuple[float, float] | list[tuple[float, float]]): The - candidate ratio of dropped regions. It can be `tuple[float, float]` - to use a fixed ratio or `list[tuple[float, float]]` to randomly - choose ratio from the list. Please note that `cutout_shape` - and `cutout_ratio` cannot be both given at the same time. - fill_in (tuple[float, float, float] | tuple[int, int, int]): The value - of pixel to fill in the dropped regions. Default: (0, 0, 0). - """ - - def __init__(self, - n_holes, - cutout_shape=None, - cutout_ratio=None, - fill_in=(0, 0, 0)): - - assert (cutout_shape is None) ^ (cutout_ratio is None), \ - 'Either cutout_shape or cutout_ratio should be specified.' - assert (isinstance(cutout_shape, (list, tuple)) - or isinstance(cutout_ratio, (list, tuple))) - if isinstance(n_holes, tuple): - assert len(n_holes) == 2 and 0 <= n_holes[0] < n_holes[1] - else: - n_holes = (n_holes, n_holes) - self.n_holes = n_holes - self.fill_in = fill_in - self.with_ratio = cutout_ratio is not None - self.candidates = cutout_ratio if self.with_ratio else cutout_shape - if not isinstance(self.candidates, list): - self.candidates = [self.candidates] - - def __call__(self, results): - """Call function to drop some regions of image.""" - h, w, c = results['img'].shape - n_holes = np.random.randint(self.n_holes[0], self.n_holes[1] + 1) - for _ in range(n_holes): - x1 = np.random.randint(0, w) - y1 = np.random.randint(0, h) - index = np.random.randint(0, len(self.candidates)) - if not self.with_ratio: - cutout_w, cutout_h = self.candidates[index] - else: - cutout_w = int(self.candidates[index][0] * w) - cutout_h = int(self.candidates[index][1] * h) - - x2 = np.clip(x1 + cutout_w, 0, w) - y2 = np.clip(y1 + cutout_h, 0, h) - results['img'][y1:y2, x1:x2, :] = self.fill_in - - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(n_holes={self.n_holes}, ' - repr_str += (f'cutout_ratio={self.candidates}, ' if self.with_ratio - else f'cutout_shape={self.candidates}, ') - repr_str += f'fill_in={self.fill_in})' - return repr_str diff --git a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/_base_/models/dmnet_r50-d8.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/_base_/models/dmnet_r50-d8.py deleted file mode 100644 index d22ba52640bebd805b3b8d07025e276dfb023759..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/_base_/models/dmnet_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='DMHead', - in_channels=2048, - in_index=3, - channels=512, - filter_sizes=(1, 3, 5, 7), - dropout_ratio=0.1, - num_classes=19, - norm_cfg=dict(type='SyncBN', requires_grad=True), - 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/Gradio-Blocks/uniformer_image_segmentation/configs/_base_/schedules/schedule_20k.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/_base_/schedules/schedule_20k.py deleted file mode 100644 index bf780a1b6f6521833c6a5859675147824efa599d..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/_base_/schedules/schedule_20k.py +++ /dev/null @@ -1,9 +0,0 @@ -# optimizer -optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005) -optimizer_config = dict() -# learning policy -lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) -# runtime settings -runner = dict(type='IterBasedRunner', max_iters=20000) -checkpoint_config = dict(by_epoch=False, interval=2000) -evaluation = dict(interval=2000, metric='mIoU') diff --git a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/pspnet/pspnet_r101-d8_512x512_20k_voc12aug.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/pspnet/pspnet_r101-d8_512x512_20k_voc12aug.py deleted file mode 100644 index 2221b202d6c53c4b04f2431d3344379cbfe06dd7..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/pspnet/pspnet_r101-d8_512x512_20k_voc12aug.py +++ /dev/null @@ -1,2 +0,0 @@ -_base_ = './pspnet_r50-d8_512x512_20k_voc12aug.py' -model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101)) diff --git a/spaces/Gradio-Blocks/uniformer_image_segmentation/mmseg/models/decode_heads/__init__.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/mmseg/models/decode_heads/__init__.py deleted file mode 100644 index 662aae3c0022845bd173b71f48c4765767eef3e1..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/mmseg/models/decode_heads/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -from .ann_head import ANNHead -from .apc_head import APCHead -from .aspp_head import ASPPHead -from .cc_head import CCHead -from .da_head import DAHead -from .dm_head import DMHead -from .dnl_head import DNLHead -from .ema_head import EMAHead -from .enc_head import EncHead -from .fcn_head import FCNHead -from .fpn_head import FPNHead -from .gc_head import GCHead -from .lraspp_head import LRASPPHead -from .nl_head import NLHead -from .ocr_head import OCRHead -from .point_head import PointHead -from .psa_head import PSAHead -from .psp_head import PSPHead -from .sep_aspp_head import DepthwiseSeparableASPPHead -from .sep_fcn_head import DepthwiseSeparableFCNHead -from .uper_head import UPerHead - -__all__ = [ - 'FCNHead', 'PSPHead', 'ASPPHead', 'PSAHead', 'NLHead', 'GCHead', 'CCHead', - 'UPerHead', 'DepthwiseSeparableASPPHead', 'ANNHead', 'DAHead', 'OCRHead', - 'EncHead', 'DepthwiseSeparableFCNHead', 'FPNHead', 'EMAHead', 'DNLHead', - 'PointHead', 'APCHead', 'DMHead', 'LRASPPHead' -] diff --git a/spaces/GrandaddyShmax/AudioCraft_Plus/audiocraft/quantization/vq.py b/spaces/GrandaddyShmax/AudioCraft_Plus/audiocraft/quantization/vq.py deleted file mode 100644 index aa57bea59db95ddae35e0657f723ca3a29ee943b..0000000000000000000000000000000000000000 --- a/spaces/GrandaddyShmax/AudioCraft_Plus/audiocraft/quantization/vq.py +++ /dev/null @@ -1,115 +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 math -import typing as tp - -import torch - -from .base import BaseQuantizer, QuantizedResult -from .core_vq import ResidualVectorQuantization - - -class ResidualVectorQuantizer(BaseQuantizer): - """Residual Vector Quantizer. - - Args: - dimension (int): Dimension of the codebooks. - n_q (int): Number of residual vector quantizers used. - q_dropout (bool): Random quantizer drop out at train time. - bins (int): Codebook size. - decay (float): Decay for exponential moving average over the codebooks. - kmeans_init (bool): Whether to use kmeans to initialize the codebooks. - kmeans_iters (int): Number of iterations used for kmeans initialization. - threshold_ema_dead_code (int): Threshold for dead code expiration. Replace any codes - that have an exponential moving average cluster size less than the specified threshold with - randomly selected vector from the current batch. - orthogonal_reg_weight (float): Orthogonal regularization weights. - orthogonal_reg_active_codes_only (bool): Apply orthogonal regularization only on active codes. - orthogonal_reg_max_codes (optional int): Maximum number of codes to consider. - for orthogonal regularization. - """ - def __init__( - self, - dimension: int = 256, - n_q: int = 8, - q_dropout: bool = False, - bins: int = 1024, - decay: float = 0.99, - kmeans_init: bool = True, - kmeans_iters: int = 10, - threshold_ema_dead_code: int = 2, - orthogonal_reg_weight: float = 0.0, - orthogonal_reg_active_codes_only: bool = False, - orthogonal_reg_max_codes: tp.Optional[int] = None, - ): - super().__init__() - self.max_n_q = n_q - self.n_q = n_q - self.q_dropout = q_dropout - self.dimension = dimension - self.bins = bins - self.decay = decay - self.kmeans_init = kmeans_init - self.kmeans_iters = kmeans_iters - self.threshold_ema_dead_code = threshold_ema_dead_code - self.orthogonal_reg_weight = orthogonal_reg_weight - self.orthogonal_reg_active_codes_only = orthogonal_reg_active_codes_only - self.orthogonal_reg_max_codes = orthogonal_reg_max_codes - self.vq = ResidualVectorQuantization( - dim=self.dimension, - codebook_size=self.bins, - num_quantizers=self.n_q, - decay=self.decay, - kmeans_init=self.kmeans_init, - kmeans_iters=self.kmeans_iters, - threshold_ema_dead_code=self.threshold_ema_dead_code, - orthogonal_reg_weight=self.orthogonal_reg_weight, - orthogonal_reg_active_codes_only=self.orthogonal_reg_active_codes_only, - orthogonal_reg_max_codes=self.orthogonal_reg_max_codes, - channels_last=False - ) - - def forward(self, x: torch.Tensor, frame_rate: int): - n_q = self.n_q - if self.training and self.q_dropout: - n_q = int(torch.randint(1, self.n_q + 1, (1,)).item()) - bw_per_q = math.log2(self.bins) * frame_rate / 1000 - quantized, codes, commit_loss = self.vq(x, n_q=n_q) - codes = codes.transpose(0, 1) - # codes is [B, K, T], with T frames, K nb of codebooks. - bw = torch.tensor(n_q * bw_per_q).to(x) - return QuantizedResult(quantized, codes, bw, penalty=torch.mean(commit_loss)) - - def encode(self, x: torch.Tensor) -> torch.Tensor: - """Encode a given input tensor with the specified frame rate at the given bandwidth. - The RVQ encode method sets the appropriate number of quantizer to use - and returns indices for each quantizer. - """ - n_q = self.n_q - codes = self.vq.encode(x, n_q=n_q) - codes = codes.transpose(0, 1) - # codes is [B, K, T], with T frames, K nb of codebooks. - return codes - - def decode(self, codes: torch.Tensor) -> torch.Tensor: - """Decode the given codes to the quantized representation.""" - # codes is [B, K, T], with T frames, K nb of codebooks, vq.decode expects [K, B, T]. - codes = codes.transpose(0, 1) - quantized = self.vq.decode(codes) - return quantized - - @property - def total_codebooks(self): - return self.max_n_q - - @property - def num_codebooks(self): - return self.n_q - - def set_num_codebooks(self, n: int): - assert n > 0 and n <= self.max_n_q - self.n_q = n diff --git a/spaces/GrandaddyShmax/MusicGen_Plus_hfv2/tests/modules/test_conv.py b/spaces/GrandaddyShmax/MusicGen_Plus_hfv2/tests/modules/test_conv.py deleted file mode 100644 index 28fbc4f1a0ebaf41b56947b767958ae696e75eec..0000000000000000000000000000000000000000 --- a/spaces/GrandaddyShmax/MusicGen_Plus_hfv2/tests/modules/test_conv.py +++ /dev/null @@ -1,203 +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. - -from itertools import product -import math -import random - -import pytest -import torch -from torch import nn - -from audiocraft.modules import ( - NormConv1d, - NormConvTranspose1d, - StreamableConv1d, - StreamableConvTranspose1d, - pad1d, - unpad1d, -) - - -def test_get_extra_padding_for_conv1d(): - # TODO: Implement me! - pass - - -def test_pad1d_zeros(): - x = torch.randn(1, 1, 20) - - xp1 = pad1d(x, (0, 5), mode='constant', value=0.) - assert xp1.shape[-1] == 25 - xp2 = pad1d(x, (5, 5), mode='constant', value=0.) - assert xp2.shape[-1] == 30 - xp3 = pad1d(x, (0, 0), mode='constant', value=0.) - assert xp3.shape[-1] == 20 - xp4 = pad1d(x, (10, 30), mode='constant', value=0.) - assert xp4.shape[-1] == 60 - - with pytest.raises(AssertionError): - pad1d(x, (-1, 0), mode='constant', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (0, -1), mode='constant', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (-1, -1), mode='constant', value=0.) - - -def test_pad1d_reflect(): - x = torch.randn(1, 1, 20) - - xp1 = pad1d(x, (0, 5), mode='reflect', value=0.) - assert xp1.shape[-1] == 25 - xp2 = pad1d(x, (5, 5), mode='reflect', value=0.) - assert xp2.shape[-1] == 30 - xp3 = pad1d(x, (0, 0), mode='reflect', value=0.) - assert xp3.shape[-1] == 20 - xp4 = pad1d(x, (10, 30), mode='reflect', value=0.) - assert xp4.shape[-1] == 60 - - with pytest.raises(AssertionError): - pad1d(x, (-1, 0), mode='reflect', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (0, -1), mode='reflect', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (-1, -1), mode='reflect', value=0.) - - -def test_unpad1d(): - x = torch.randn(1, 1, 20) - - u1 = unpad1d(x, (5, 5)) - assert u1.shape[-1] == 10 - u2 = unpad1d(x, (0, 5)) - assert u2.shape[-1] == 15 - u3 = unpad1d(x, (5, 0)) - assert u3.shape[-1] == 15 - u4 = unpad1d(x, (0, 0)) - assert u4.shape[-1] == x.shape[-1] - - with pytest.raises(AssertionError): - unpad1d(x, (-1, 0)) - - with pytest.raises(AssertionError): - unpad1d(x, (0, -1)) - - with pytest.raises(AssertionError): - unpad1d(x, (-1, -1)) - - -class TestNormConv1d: - - def test_norm_conv1d_modules(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - - C_out, kernel_size, stride = 1, 4, 1 - expected_out_length = int((T - kernel_size) / stride + 1) - wn_conv = NormConv1d(C, 1, kernel_size=4, norm='weight_norm') - gn_conv = NormConv1d(C, 1, kernel_size=4, norm='time_group_norm') - nn_conv = NormConv1d(C, 1, kernel_size=4, norm='none') - - assert isinstance(wn_conv.norm, nn.Identity) - assert isinstance(wn_conv.conv, nn.Conv1d) - - assert isinstance(gn_conv.norm, nn.GroupNorm) - assert isinstance(gn_conv.conv, nn.Conv1d) - - assert isinstance(nn_conv.norm, nn.Identity) - assert isinstance(nn_conv.conv, nn.Conv1d) - - for conv_layer in [wn_conv, gn_conv, nn_conv]: - out = conv_layer(t0) - assert isinstance(out, torch.Tensor) - assert list(out.shape) == [N, C_out, expected_out_length] - - -class TestNormConvTranspose1d: - - def test_normalizations(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - - C_out, kernel_size, stride = 1, 4, 1 - expected_out_length = (T - 1) * stride + (kernel_size - 1) + 1 - - wn_convtr = NormConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, norm='weight_norm') - gn_convtr = NormConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, norm='time_group_norm') - nn_convtr = NormConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, norm='none') - - assert isinstance(wn_convtr.norm, nn.Identity) - assert isinstance(wn_convtr.convtr, nn.ConvTranspose1d) - - assert isinstance(gn_convtr.norm, nn.GroupNorm) - assert isinstance(gn_convtr.convtr, nn.ConvTranspose1d) - - assert isinstance(nn_convtr.norm, nn.Identity) - assert isinstance(nn_convtr.convtr, nn.ConvTranspose1d) - - for convtr_layer in [wn_convtr, gn_convtr, nn_convtr]: - out = convtr_layer(t0) - assert isinstance(out, torch.Tensor) - assert list(out.shape) == [N, C_out, expected_out_length] - - -class TestStreamableConv1d: - - def get_streamable_conv1d_output_length(self, length, kernel_size, stride, dilation): - # StreamableConv1d internally pads to make sure that the last window is full - padding_total = (kernel_size - 1) * dilation - (stride - 1) - n_frames = (length - kernel_size + padding_total) / stride + 1 - ideal_length = (math.ceil(n_frames) - 1) * stride + (kernel_size - padding_total) - return ideal_length // stride - - def test_streamable_conv1d(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - C_out = 1 - - # conv params are [(kernel_size, stride, dilation)] - conv_params = [(4, 1, 1), (4, 2, 1), (3, 1, 3), (10, 5, 1), (3, 2, 3)] - for causal, (kernel_size, stride, dilation) in product([False, True], conv_params): - expected_out_length = self.get_streamable_conv1d_output_length(T, kernel_size, stride, dilation) - sconv = StreamableConv1d(C, C_out, kernel_size=kernel_size, stride=stride, dilation=dilation, causal=causal) - out = sconv(t0) - assert isinstance(out, torch.Tensor) - print(list(out.shape), [N, C_out, expected_out_length]) - assert list(out.shape) == [N, C_out, expected_out_length] - - -class TestStreamableConvTranspose1d: - - def get_streamable_convtr1d_output_length(self, length, kernel_size, stride): - padding_total = (kernel_size - stride) - return (length - 1) * stride - padding_total + (kernel_size - 1) + 1 - - def test_streamable_convtr1d(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - - C_out = 1 - - with pytest.raises(AssertionError): - StreamableConvTranspose1d(C, C_out, kernel_size=4, causal=False, trim_right_ratio=0.5) - StreamableConvTranspose1d(C, C_out, kernel_size=4, causal=True, trim_right_ratio=-1.) - StreamableConvTranspose1d(C, C_out, kernel_size=4, causal=True, trim_right_ratio=2) - - # causal params are [(causal, trim_right)] - causal_params = [(False, 1.0), (True, 1.0), (True, 0.5), (True, 0.0)] - # conv params are [(kernel_size, stride)] - conv_params = [(4, 1), (4, 2), (3, 1), (10, 5)] - for ((causal, trim_right_ratio), (kernel_size, stride)) in product(causal_params, conv_params): - expected_out_length = self.get_streamable_convtr1d_output_length(T, kernel_size, stride) - sconvtr = StreamableConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, - causal=causal, trim_right_ratio=trim_right_ratio) - out = sconvtr(t0) - assert isinstance(out, torch.Tensor) - assert list(out.shape) == [N, C_out, expected_out_length] diff --git a/spaces/Guochun/THUDM-chatglm2-6b/app.py b/spaces/Guochun/THUDM-chatglm2-6b/app.py deleted file mode 100644 index 178500883f421fa82a74ed826246337066c7194a..0000000000000000000000000000000000000000 --- a/spaces/Guochun/THUDM-chatglm2-6b/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/THUDM/chatglm2-6b").launch() \ No newline at end of file diff --git a/spaces/Hallucinate/demo/ldm/models/diffusion/plms.py b/spaces/Hallucinate/demo/ldm/models/diffusion/plms.py deleted file mode 100644 index 78eeb1003aa45d27bdbfc6b4a1d7ccbff57cd2e3..0000000000000000000000000000000000000000 --- a/spaces/Hallucinate/demo/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/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/models/model_utils.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/models/model_utils.py deleted file mode 100644 index 732d66b1d5f695151c26d29eb7f6b53179c269f1..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/models/model_utils.py +++ /dev/null @@ -1,92 +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 typing import List, Optional - -import torch -from torch import Tensor - - -@torch.jit.script -def script_skip_tensor_list(x: List[Tensor], mask): - res = [xi[mask] if xi.size(0) == mask.size(0) else xi[:, mask] for xi in x] - outputs = [] - for i, t in enumerate(res): - if t.numel() != 0: - outputs.append(t) - else: - outputs.append(x[i]) - return outputs - - -@torch.jit.script -def script_skip_tensor(x: Tensor, mask): - # None case - if x.size(0) == 0: - return x - res = x[mask] if x.size(0) == mask.size(0) else x[:, mask] - if res.numel() == 0: - return x - else: - return res - - -@torch.jit.script -def expand_2d_or_3d_tensor(x, trg_dim: int, padding_idx: int): - """ - Expand 2D/3D tensor on dim=1 - """ - if x is None: - return None - - assert x.dim() == 2 or x.dim() == 3 - assert trg_dim >= x.size(1), (trg_dim, x.size()) - if trg_dim == x.size(1): - return x - - dims = [x.size(0), trg_dim - x.size(1)] - if x.dim() == 3: - dims.append(x.size(2)) - x = torch.cat([x, torch.zeros(dims).to(x).fill_(padding_idx)], 1) - - return x - - -@torch.jit.script -def coalesce(x: Optional[Tensor], y: Tensor) -> Tensor: - return x if x is not None else y - - -@torch.jit.script -def fill_tensors( - x: Optional[Tensor], mask, y: Optional[Tensor], padding_idx: int -) -> Optional[Tensor]: - """ - Filling tensor x with y at masked positions (dim=0). - """ - if x is None or x.size()[0] == 0 or y is None: - return x - assert x.dim() == y.dim() and mask.size(0) == x.size(0) - assert x.dim() == 2 or (x.dim() == 3 and x.size(2) == y.size(2)) - - n_selected = mask.sum() - if n_selected == 0: - return x - assert n_selected == y.size(0) - if n_selected == x.size(0): - return y - - if x.size(1) < y.size(1): - x = expand_2d_or_3d_tensor(x, y.size(1), padding_idx) - x[mask] = y - elif x.size(1) > y.size(1): - x[mask] = torch.tensor(padding_idx).type_as(x) - if x.dim() == 2: - x[mask, : y.size(1)] = y - else: - x[mask, : y.size(1), :] = y - else: - x[mask] = y - return x diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/optim/cpu_adam.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/optim/cpu_adam.py deleted file mode 100644 index b2f893aeda69ee1741e5e3af406ff4182b6f2416..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/optim/cpu_adam.py +++ /dev/null @@ -1,206 +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 importlib -from collections.abc import Collection -from dataclasses import dataclass, field -from typing import List - -import torch -from fairseq.dataclass import FairseqDataclass -from fairseq.optim import FairseqOptimizer, register_optimizer -from omegaconf import II, DictConfig - - -try: - import deepspeed - has_deepspeed = True -except ImportError as e: - has_deepspeed = False - - -def _get_cpu_adam(): - try: - from deepspeed.ops.op_builder import CPUAdamBuilder - return CPUAdamBuilder().load() - except ImportError: - # fbcode - from deepspeed.ops.adam import DeepSpeedCPUAdam as ds_opt_adam - return ds_opt_adam - -@dataclass -class FairseqCPUAdamConfig(FairseqDataclass): - adam_betas: str = field( - default="(0.9, 0.999)", metadata={"help": "betas for Adam optimizer"} - ) - adam_eps: float = field( - default=1e-8, metadata={"help": "epsilon for Adam optimizer"} - ) - weight_decay: float = field(default=0.0, metadata={"help": "weight decay"}) - fp16_adam_stats: bool = field( - default=False, metadata={"help": "use FP16 stats (with automatic scaling)"} - ) - # TODO common vars below in parent - lr: List[float] = II("optimization.lr") - - -@register_optimizer("cpu_adam", dataclass=FairseqCPUAdamConfig) -class FairseqCPUAdam(FairseqOptimizer): - """Adam optimizer for fairseq, optimized for CPU tensors. - - Important note: this optimizer corresponds to the "AdamW" variant of - Adam in its weight decay behavior. As such, it is most closely - analogous to torch.optim.AdamW from PyTorch. - """ - - def __init__(self, cfg: DictConfig, params): - super().__init__(cfg) - self._optimizer = CPUAdam(params, **self.optimizer_config) - - @property - def optimizer_config(self): - """ - Return a kwarg dictionary that will be used to override optimizer - args stored in checkpoints. This allows us to load a checkpoint and - resume training using a different set of optimizer args, e.g., with a - different learning rate. - """ - return { - "lr": self.cfg.lr[0] - if isinstance(self.cfg.lr, Collection) - else self.cfg.lr, - "betas": eval(self.cfg.adam_betas), - "eps": self.cfg.adam_eps, - "weight_decay": self.cfg.weight_decay, - "use_fp16_stats": self.cfg.fp16_adam_stats, - } - - -class CPUAdam(torch.optim.Optimizer): - - optimizer_id = 0 - - def __init__( - self, - params, - lr=1e-3, - bias_correction=True, - betas=(0.9, 0.999), - eps=1e-8, - weight_decay=0, - use_fp16_stats=False, - ): - defaults = { - "lr": lr, - "bias_correction": bias_correction, - "betas": betas, - "eps": eps, - "weight_decay": weight_decay, - } - super().__init__(params, defaults) - - self.use_fp16_stats = use_fp16_stats - self.FLOAT16_MAX = 65504.0 - - if not has_deepspeed: - raise ImportError("Please install DeepSpeed: pip install deepspeed") - - self.opt_id = CPUAdam.optimizer_id - CPUAdam.optimizer_id = CPUAdam.optimizer_id + 1 - - self.ds_opt_adam = _get_cpu_adam() - adamw_mode = True - self.ds_opt_adam.create_adam( - self.opt_id, lr, betas[0], betas[1], eps, weight_decay, adamw_mode - ) - - @property - def supports_memory_efficient_fp16(self): - return True - - @property - def supports_flat_params(self): - return True - - @torch.no_grad() - def step(self, closure=None): - loss = None - if closure is not None: - with torch.enable_grad(): - loss = closure() - - torch.cuda.synchronize() - - for group_id, group in enumerate(self.param_groups): - for param_id, p in enumerate(group["params"]): - if p.grad is None: - continue - - state = self.state[p] - if len(state) == 0: - state["step"] = 0 - dtype = torch.float16 if self.use_fp16_stats else p.data.dtype - # gradient momentums - state["exp_avg"] = torch.zeros_like( - p.data, dtype=dtype, device="cpu" - ) - # gradient variances - state["exp_avg_sq"] = torch.zeros_like( - p.data, dtype=dtype, device="cpu" - ) - if self.use_fp16_stats: - assert torch.is_floating_point(p.data) - state["exp_avg_scale"] = 1.0 - state["exp_avg_sq_scale"] = 1.0 - - exp_avg, exp_avg_sq = state["exp_avg"], state["exp_avg_sq"] - - p_data_bak = p.data # backup of the original data pointer - - p.data = p.data.to(dtype=torch.float32, device="cpu") - p.grad.data = p.grad.data.to(dtype=torch.float32, device="cpu") - - if self.use_fp16_stats: - exp_avg = exp_avg.float() * state["exp_avg_scale"] - exp_avg_sq = exp_avg_sq.float() * state["exp_avg_sq_scale"] - - state["step"] += 1 - beta1, beta2 = group["betas"] - - self.ds_opt_adam.adam_update( - self.opt_id, - state["step"], - group["lr"], - beta1, - beta2, - group["eps"], - group["weight_decay"], - group["bias_correction"], - p.data, - p.grad.data, - exp_avg, - exp_avg_sq, - ) - - if p_data_bak.data_ptr() != p.data.data_ptr(): - p_data_bak.copy_(p.data) - p.data = p_data_bak - - if self.use_fp16_stats: - - def inf_norm(t): - return torch.norm(t, float("inf")) - - # from github.com/openai/jukebox/blob/master/jukebox/utils/fp16.py - state["exp_avg_scale"], state["exp_avg_sq_scale"] = ( - 1e-8 + inf_norm(exp_avg) / self.FLOAT16_MAX, - 1e-8 + inf_norm(exp_avg_sq) / self.FLOAT16_MAX, - ) - state["exp_avg"], state["exp_avg_sq"] = ( - (exp_avg / state["exp_avg_scale"]).half(), - (exp_avg_sq / state["exp_avg_sq_scale"]).half(), - ) - - return loss diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq_cli/train.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq_cli/train.py deleted file mode 100644 index 83475873138c5d1bac288c234afb6b4a1a7882d7..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq_cli/train.py +++ /dev/null @@ -1,514 +0,0 @@ -#!/usr/bin/env python3 -u -# 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. -""" -Train a new model on one or across multiple GPUs. -""" - -import argparse -import logging -import math -import os -import sys -from typing import Dict, Optional, Any, List, Tuple, Callable - -# We need to setup root logger before importing any fairseq libraries. -logging.basicConfig( - format="%(asctime)s | %(levelname)s | %(name)s | %(message)s", - datefmt="%Y-%m-%d %H:%M:%S", - level=os.environ.get("LOGLEVEL", "INFO").upper(), - stream=sys.stdout, -) -logger = logging.getLogger("fairseq_cli.train") - -import numpy as np -import torch -from fairseq import ( - checkpoint_utils, - options, - quantization_utils, - tasks, - utils, -) -from fairseq.data import iterators, data_utils -from fairseq.data.plasma_utils import PlasmaStore -from fairseq.dataclass.configs import FairseqConfig -from fairseq.dataclass.utils import convert_namespace_to_omegaconf -from fairseq.distributed import fsdp_enable_wrap, fsdp_wrap, utils as distributed_utils -from fairseq.file_io import PathManager -from fairseq.logging import meters, metrics, progress_bar -from fairseq.model_parallel.megatron_trainer import MegatronTrainer -from fairseq.trainer import Trainer -from omegaconf import DictConfig, OmegaConf - - - - -def main(cfg: FairseqConfig) -> None: - if isinstance(cfg, argparse.Namespace): - cfg = convert_namespace_to_omegaconf(cfg) - - utils.import_user_module(cfg.common) - - if distributed_utils.is_master(cfg.distributed_training) and "job_logging_cfg" in cfg: - # make hydra logging work with ddp (see # see https://github.com/facebookresearch/hydra/issues/1126) - logging.config.dictConfig(OmegaConf.to_container(cfg.job_logging_cfg)) - - assert ( - cfg.dataset.max_tokens is not None or cfg.dataset.batch_size is not None - ), "Must specify batch size either with --max-tokens or --batch-size" - metrics.reset() - - if cfg.common.log_file is not None: - handler = logging.FileHandler(filename=cfg.common.log_file) - logger.addHandler(handler) - - np.random.seed(cfg.common.seed) - utils.set_torch_seed(cfg.common.seed) - - if distributed_utils.is_master(cfg.distributed_training): - checkpoint_utils.verify_checkpoint_directory(cfg.checkpoint.save_dir) - - # Print args - logger.info(cfg) - - if cfg.checkpoint.write_checkpoints_asynchronously: - try: - import iopath # noqa: F401 - except ImportError: - logging.exception( - "Asynchronous checkpoint writing is specified but iopath is " - "not installed: `pip install iopath`" - ) - return - - # Setup task, e.g., translation, language modeling, etc. - task = tasks.setup_task(cfg.task) - - assert cfg.criterion, "Please specify criterion to train a model" - - # Build model and criterion - if cfg.distributed_training.ddp_backend == "fully_sharded": - with fsdp_enable_wrap(cfg.distributed_training): - model = fsdp_wrap(task.build_model(cfg.model)) - else: - model = task.build_model(cfg.model) - criterion = task.build_criterion(cfg.criterion) - logger.info(model) - logger.info("task: {}".format(task.__class__.__name__)) - logger.info("model: {}".format(model.__class__.__name__)) - logger.info("criterion: {}".format(criterion.__class__.__name__)) - logger.info( - "num. shared model params: {:,} (num. trained: {:,})".format( - sum(p.numel() for p in model.parameters() if not getattr(p, "expert", False)), - sum(p.numel() for p in model.parameters() if not getattr(p, "expert", False) and p.requires_grad) - ) - ) - - logger.info( - "num. expert model params: {} (num. trained: {})".format( - sum(p.numel() for p in model.parameters() if getattr(p, "expert", False)), - sum(p.numel() for p in model.parameters() if getattr(p, "expert", False) and p.requires_grad), - ) - ) - - # Load valid dataset (we load training data below, based on the latest checkpoint) - # We load the valid dataset AFTER building the model - data_utils.raise_if_valid_subsets_unintentionally_ignored(cfg) - if cfg.dataset.combine_valid_subsets: - task.load_dataset("valid", combine=True, epoch=1) - else: - for valid_sub_split in cfg.dataset.valid_subset.split(","): - task.load_dataset(valid_sub_split, combine=False, epoch=1) - - # (optionally) Configure quantization - if cfg.common.quantization_config_path is not None: - quantizer = quantization_utils.Quantizer( - config_path=cfg.common.quantization_config_path, - max_epoch=cfg.optimization.max_epoch, - max_update=cfg.optimization.max_update, - ) - else: - quantizer = None - - # Build trainer - if cfg.common.model_parallel_size == 1: - trainer = Trainer(cfg, task, model, criterion, quantizer) - else: - trainer = MegatronTrainer(cfg, task, model, criterion) - logger.info( - "training on {} devices (GPUs/TPUs)".format( - cfg.distributed_training.distributed_world_size - ) - ) - logger.info( - "max tokens per device = {} and max sentences per device = {}".format( - cfg.dataset.max_tokens, - cfg.dataset.batch_size, - ) - ) - - # Load the latest checkpoint if one is available and restore the - # corresponding train iterator - extra_state, epoch_itr = checkpoint_utils.load_checkpoint( - cfg.checkpoint, - trainer, - # don't cache epoch iterators for sharded datasets - disable_iterator_cache=task.has_sharded_data("train"), - ) - if cfg.common.tpu: - import torch_xla.core.xla_model as xm - xm.rendezvous("load_checkpoint") # wait for all workers - - max_epoch = cfg.optimization.max_epoch or math.inf - lr = trainer.get_lr() - - train_meter = meters.StopwatchMeter() - train_meter.start() - while epoch_itr.next_epoch_idx <= max_epoch: - if lr <= cfg.optimization.stop_min_lr: - logger.info( - f"stopping training because current learning rate ({lr}) is smaller " - "than or equal to minimum learning rate " - f"(--stop-min-lr={cfg.optimization.stop_min_lr})" - ) - break - - # train for one epoch - valid_losses, should_stop = train(cfg, trainer, task, epoch_itr) - if should_stop: - break - - # only use first validation loss to update the learning rate - lr = trainer.lr_step(epoch_itr.epoch, valid_losses[0]) - - epoch_itr = trainer.get_train_iterator( - epoch_itr.next_epoch_idx, - # sharded data: get train iterator for next epoch - load_dataset=task.has_sharded_data("train"), - # don't cache epoch iterators for sharded datasets - disable_iterator_cache=task.has_sharded_data("train"), - ) - train_meter.stop() - logger.info("done training in {:.1f} seconds".format(train_meter.sum)) - - # ioPath implementation to wait for all asynchronous file writes to complete. - if cfg.checkpoint.write_checkpoints_asynchronously: - logger.info( - "ioPath PathManager waiting for all asynchronous checkpoint " - "writes to finish." - ) - PathManager.async_close() - logger.info("ioPath PathManager finished waiting.") - - -def should_stop_early(cfg: DictConfig, valid_loss: float) -> bool: - # skip check if no validation was done in the current epoch - if valid_loss is None: - return False - if cfg.checkpoint.patience <= 0: - return False - - def is_better(a, b): - return a > b if cfg.checkpoint.maximize_best_checkpoint_metric else a < b - - prev_best = getattr(should_stop_early, "best", None) - if prev_best is None or is_better(valid_loss, prev_best): - should_stop_early.best = valid_loss - should_stop_early.num_runs = 0 - return False - else: - should_stop_early.num_runs += 1 - if should_stop_early.num_runs >= cfg.checkpoint.patience: - logger.info( - "early stop since valid performance hasn't improved for last {} runs".format( - cfg.checkpoint.patience - ) - ) - return True - else: - return False - - -@metrics.aggregate("train") -def train( - cfg: DictConfig, trainer: Trainer, task: tasks.FairseqTask, epoch_itr -) -> Tuple[List[Optional[float]], bool]: - """Train the model for one epoch and return validation losses.""" - # Initialize data iterator - itr = epoch_itr.next_epoch_itr( - fix_batches_to_gpus=cfg.distributed_training.fix_batches_to_gpus, - shuffle=(epoch_itr.next_epoch_idx > cfg.dataset.curriculum), - ) - update_freq = ( - cfg.optimization.update_freq[epoch_itr.epoch - 1] - if epoch_itr.epoch <= len(cfg.optimization.update_freq) - else cfg.optimization.update_freq[-1] - ) - itr = iterators.GroupedIterator(itr, update_freq) - if cfg.common.tpu: - itr = utils.tpu_data_loader(itr) - progress = progress_bar.progress_bar( - itr, - log_format=cfg.common.log_format, - log_file=cfg.common.log_file, - log_interval=cfg.common.log_interval, - epoch=epoch_itr.epoch, - tensorboard_logdir=( - cfg.common.tensorboard_logdir - if distributed_utils.is_master(cfg.distributed_training) - else None - ), - default_log_format=("tqdm" if not cfg.common.no_progress_bar else "simple"), - wandb_project=( - cfg.common.wandb_project - if distributed_utils.is_master(cfg.distributed_training) - else None - ), - wandb_run_name=os.environ.get( - "WANDB_NAME", os.path.basename(cfg.checkpoint.save_dir) - ), - azureml_logging=( - cfg.common.azureml_logging - if distributed_utils.is_master(cfg.distributed_training) - else False - ), - ) - progress.update_config(_flatten_config(cfg)) - - trainer.begin_epoch(epoch_itr.epoch) - - valid_subsets = cfg.dataset.valid_subset.split(",") - should_stop = False - num_updates = trainer.get_num_updates() - logger.info("Start iterating over samples") - for i, samples in enumerate(progress): - with metrics.aggregate("train_inner"), torch.autograd.profiler.record_function( - "train_step-%d" % i - ): - log_output = trainer.train_step(samples) - - if log_output is not None: # not OOM, overflow, ... - # log mid-epoch stats - num_updates = trainer.get_num_updates() - if num_updates % cfg.common.log_interval == 0: - stats = get_training_stats(metrics.get_smoothed_values("train_inner")) - progress.log(stats, tag="train_inner", step=num_updates) - - # reset mid-epoch stats after each log interval - # the end-of-epoch stats will still be preserved - metrics.reset_meters("train_inner") - - end_of_epoch = not itr.has_next() - valid_losses, should_stop = validate_and_save( - cfg, trainer, task, epoch_itr, valid_subsets, end_of_epoch - ) - - if should_stop: - break - - # log end-of-epoch stats - logger.info("end of epoch {} (average epoch stats below)".format(epoch_itr.epoch)) - stats = get_training_stats(metrics.get_smoothed_values("train")) - progress.print(stats, tag="train", step=num_updates) - - # reset epoch-level meters - metrics.reset_meters("train") - return valid_losses, should_stop - - -def _flatten_config(cfg: DictConfig): - config = OmegaConf.to_container(cfg) - # remove any legacy Namespaces and replace with a single "args" - namespace = None - for k, v in list(config.items()): - if isinstance(v, argparse.Namespace): - namespace = v - del config[k] - if namespace is not None: - config["args"] = vars(namespace) - return config - - -def validate_and_save( - cfg: DictConfig, - trainer: Trainer, - task: tasks.FairseqTask, - epoch_itr, - valid_subsets: List[str], - end_of_epoch: bool, -) -> Tuple[List[Optional[float]], bool]: - num_updates = trainer.get_num_updates() - max_update = cfg.optimization.max_update or math.inf - - # Stopping conditions (and an additional one based on validation loss later - # on) - should_stop = False - if num_updates >= max_update: - should_stop = True - logger.info( - f"Stopping training due to " - f"num_updates: {num_updates} >= max_update: {max_update}" - ) - - training_time_hours = trainer.cumulative_training_time() / (60 * 60) - if ( - cfg.optimization.stop_time_hours > 0 - and training_time_hours > cfg.optimization.stop_time_hours - ): - should_stop = True - logger.info( - f"Stopping training due to " - f"cumulative_training_time: {training_time_hours} > " - f"stop_time_hours: {cfg.optimization.stop_time_hours} hour(s)" - ) - - do_save = ( - (end_of_epoch and epoch_itr.epoch % cfg.checkpoint.save_interval == 0) - or should_stop - or ( - cfg.checkpoint.save_interval_updates > 0 - and num_updates > 0 - and num_updates % cfg.checkpoint.save_interval_updates == 0 - and num_updates >= cfg.dataset.validate_after_updates - ) - ) - do_validate = ( - (not end_of_epoch and do_save) # validate during mid-epoch saves - or (end_of_epoch and epoch_itr.epoch % cfg.dataset.validate_interval == 0) - or should_stop - or ( - cfg.dataset.validate_interval_updates > 0 - and num_updates > 0 - and num_updates % cfg.dataset.validate_interval_updates == 0 - ) - ) and not cfg.dataset.disable_validation and num_updates >= cfg.dataset.validate_after_updates - - # Validate - valid_losses = [None] - if do_validate: - valid_losses = validate(cfg, trainer, task, epoch_itr, valid_subsets) - - should_stop |= should_stop_early(cfg, valid_losses[0]) - - # Save checkpoint - if do_save or should_stop: - checkpoint_utils.save_checkpoint( - cfg.checkpoint, trainer, epoch_itr, valid_losses[0] - ) - - return valid_losses, should_stop - - -def get_training_stats(stats: Dict[str, Any]) -> Dict[str, Any]: - stats["wall"] = round(metrics.get_meter("default", "wall").elapsed_time, 0) - return stats - - -def validate( - cfg: DictConfig, - trainer: Trainer, - task: tasks.FairseqTask, - epoch_itr, - subsets: List[str], -) -> List[Optional[float]]: - """Evaluate the model on the validation set(s) and return the losses.""" - - if cfg.dataset.fixed_validation_seed is not None: - # set fixed seed for every validation - utils.set_torch_seed(cfg.dataset.fixed_validation_seed) - - trainer.begin_valid_epoch(epoch_itr.epoch) - valid_losses = [] - for subset in subsets: - logger.info('begin validation on "{}" subset'.format(subset)) - - # Initialize data iterator - itr = trainer.get_valid_iterator(subset).next_epoch_itr( - shuffle=False, set_dataset_epoch=False # use a fixed valid set - ) - if cfg.common.tpu: - itr = utils.tpu_data_loader(itr) - progress = progress_bar.progress_bar( - itr, - log_format=cfg.common.log_format, - log_interval=cfg.common.log_interval, - epoch=epoch_itr.epoch, - prefix=f"valid on '{subset}' subset", - tensorboard_logdir=( - cfg.common.tensorboard_logdir - if distributed_utils.is_master(cfg.distributed_training) - else None - ), - default_log_format=("tqdm" if not cfg.common.no_progress_bar else "simple"), - wandb_project=( - cfg.common.wandb_project - if distributed_utils.is_master(cfg.distributed_training) - else None - ), - wandb_run_name=os.environ.get( - "WANDB_NAME", os.path.basename(cfg.checkpoint.save_dir) - ), - ) - - # create a new root metrics aggregator so validation metrics - # don't pollute other aggregators (e.g., train meters) - with metrics.aggregate(new_root=True) as agg: - for i, sample in enumerate(progress): - if cfg.dataset.max_valid_steps is not None and i > cfg.dataset.max_valid_steps: - break - trainer.valid_step(sample) - - # log validation stats - stats = get_valid_stats(cfg, trainer, agg.get_smoothed_values()) - - if hasattr(task, "post_validate"): - task.post_validate(trainer.get_model(), stats, agg) - - progress.print(stats, tag=subset, step=trainer.get_num_updates()) - - valid_losses.append(stats[cfg.checkpoint.best_checkpoint_metric]) - return valid_losses - - -def get_valid_stats( - cfg: DictConfig, trainer: Trainer, stats: Dict[str, Any] -) -> Dict[str, Any]: - stats["num_updates"] = trainer.get_num_updates() - if hasattr(checkpoint_utils.save_checkpoint, "best"): - key = "best_{0}".format(cfg.checkpoint.best_checkpoint_metric) - best_function = max if cfg.checkpoint.maximize_best_checkpoint_metric else min - stats[key] = best_function( - checkpoint_utils.save_checkpoint.best, - stats[cfg.checkpoint.best_checkpoint_metric], - ) - return stats - - -def cli_main( - modify_parser: Optional[Callable[[argparse.ArgumentParser], None]] = None -) -> None: - parser = options.get_training_parser() - args = options.parse_args_and_arch(parser, modify_parser=modify_parser) - - cfg = convert_namespace_to_omegaconf(args) - - if cfg.common.use_plasma_view: - server = PlasmaStore(path=cfg.common.plasma_path) - logger.info(f"Started plasma server pid {server.server.pid} {cfg.common.plasma_path}") - - if args.profile: - with torch.cuda.profiler.profile(): - with torch.autograd.profiler.emit_nvtx(): - distributed_utils.call_main(cfg, main) - else: - distributed_utils.call_main(cfg, main) - - # if cfg.common.use_plasma_view: - # server.server.kill() - - -if __name__ == "__main__": - cli_main() diff --git a/spaces/Harveenchadha/Vakyansh-Tamil-TTS/ttsv/src/glow_tts/text/cleaners.py b/spaces/Harveenchadha/Vakyansh-Tamil-TTS/ttsv/src/glow_tts/text/cleaners.py deleted file mode 100644 index a7d4e029baa436e88e4d68090e886afdd998a68d..0000000000000000000000000000000000000000 --- a/spaces/Harveenchadha/Vakyansh-Tamil-TTS/ttsv/src/glow_tts/text/cleaners.py +++ /dev/null @@ -1,78 +0,0 @@ -import re - -from unidecode import unidecode -from .numbers import normalize_numbers - - - - -# Regular expression matching whitespace: -_whitespace_re = re.compile(r"\s+") - -def lowercase(text): - return text.lower() - -def collapse_whitespace(text): - return re.sub(_whitespace_re, " ", text) - -def basic_indic_cleaners(text): - """Basic pipeline that collapses whitespace without transliteration.""" - text = collapse_whitespace(text) - return text - - -def english_cleaner(text): - text = text.lower().replace('‘','\'').replace('’','\'') - return text - - -def lowercase(text): - return text.lower() - -def convert_to_ascii(text): - return unidecode(text) - -def expand_numbers(text): - return normalize_numbers(text) - -def expand_abbreviations(text): - for regex, replacement in _abbreviations: - text = re.sub(regex, replacement, text) - return text - -_abbreviations = [(re.compile('\\b%s\\.' % x[0], re.IGNORECASE), x[1]) for x in [ - ('mrs', 'missus'), - ('mr', 'mister'), - ('dr', 'doctor'), - ('st', 'saint'), - ('co', 'company'), - ('jr', 'junior'), - ('maj', 'major'), - ('gen', 'general'), - ('drs', 'doctors'), - ('rev', 'reverend'), - ('lt', 'lieutenant'), - ('hon', 'honorable'), - ('sgt', 'sergeant'), - ('capt', 'captain'), - ('esq', 'esquire'), - ('ltd', 'limited'), - ('col', 'colonel'), - ('ft', 'fort'), - ('pvt', 'private'), - ('rs', 'Rupees') -]] - - - - - - -def english_cleaners(text): - '''Pipeline for English text, including number and abbreviation expansion.''' - text = convert_to_ascii(text) - text = lowercase(text) - text = expand_numbers(text) - text = expand_abbreviations(text) - text = collapse_whitespace(text) - return text diff --git a/spaces/HopeMan/Claude/README.md b/spaces/HopeMan/Claude/README.md deleted file mode 100644 index ca3553344fa3a379d7686165233589684ae6217a..0000000000000000000000000000000000000000 --- a/spaces/HopeMan/Claude/README.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Claude -emoji: 📚 -colorFrom: gray -colorTo: blue -sdk: docker -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/spaces/Hydrangea/computing/README.md b/spaces/Hydrangea/computing/README.md deleted file mode 100644 index f18d50955c94fcaff3272a067cb4837a66637c9c..0000000000000000000000000000000000000000 --- a/spaces/Hydrangea/computing/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Computing -emoji: 🐨 -colorFrom: green -colorTo: red -sdk: gradio -sdk_version: 3.15.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/ICML2022/OFA/fairseq/examples/adaptive_span/adaptive_span_loss.py b/spaces/ICML2022/OFA/fairseq/examples/adaptive_span/adaptive_span_loss.py deleted file mode 100644 index 056245807e5f8d313a8ad5be68aea4e285f4f580..0000000000000000000000000000000000000000 --- a/spaces/ICML2022/OFA/fairseq/examples/adaptive_span/adaptive_span_loss.py +++ /dev/null @@ -1,106 +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 math -from dataclasses import dataclass - -import torch.nn.functional as F -from fairseq import metrics, utils -from fairseq.criterions import register_criterion -from fairseq.criterions.cross_entropy import CrossEntropyCriterion -from fairseq.dataclass import FairseqDataclass -from omegaconf import II - - -@dataclass -class AdaptiveSpanCriterionConfig(FairseqDataclass): - sentence_avg: bool = II("optimization.sentence_avg") - - -@register_criterion("adaptive_span_loss", dataclass=AdaptiveSpanCriterionConfig) -class AdaptiveSpanCriterion(CrossEntropyCriterion): - def __init__(self, task, sentence_avg): - super().__init__(task, sentence_avg) - - def forward(self, model, sample, reduce=True): - """Compute the loss for the given sample. - - Returns a tuple with three elements: - 1) the loss here is summed, different from the adaptive span code - 2) the sample size, which is used as the denominator for the gradient - 3) logging outputs to display while training - """ - net_output = model(**sample["net_input"]) - loss, aux_loss, avg_span, max_span = self.compute_loss( - model, net_output, sample, reduce=reduce - ) - sample_size = ( - sample["target"].size(0) if self.sentence_avg else sample["ntokens"] - ) - loss /= sample_size - total_loss = loss + aux_loss - sample_size = 1 - - logging_output = { - "loss": loss.data, - "ntokens": sample["ntokens"], - "nsentences": sample["target"].size(0), - "sample_size": sample_size, - "total_loss": total_loss.data, - "avg_span": avg_span * sample_size, - "max_span": max_span * sample_size, - } - return total_loss, sample_size, logging_output - - def compute_loss(self, model, net_output, sample, reduce=True): - loss, _ = super().compute_loss(model, net_output, sample, reduce) - aux_loss = model.get_aux_loss() - avg_span = model.get_current_avg_span() - max_span = model.get_current_max_span() - return loss, aux_loss, avg_span, max_span - - @staticmethod - def reduce_metrics(logging_outputs) -> None: - """Aggregate logging outputs from data parallel training.""" - loss_sum = sum(log.get("loss", 0) for log in logging_outputs) - ntokens = sum(log.get("ntokens", 0) for log in logging_outputs) - sample_size = sum(log.get("sample_size", 0) for log in logging_outputs) - total_loss_sum = sum(log.get("total_loss", 0) for log in logging_outputs) - avg_span_sum = sum(log.get("avg_span", 0) for log in logging_outputs) - max_span_sum = sum(log.get("max_span", 0) for log in logging_outputs) - - # we divide by log(2) to convert the loss from base e to base 2 - metrics.log_scalar( - "loss", loss_sum / sample_size / math.log(2), sample_size, round=3 - ) - metrics.log_scalar("avg_span", avg_span_sum / sample_size, sample_size, round=3) - metrics.log_scalar("max_span", max_span_sum / sample_size, sample_size, round=3) - # total loss contains the L1 norm on adaptive-span - metrics.log_scalar( - "total_loss", - total_loss_sum / sample_size / math.log(2), - sample_size, - round=3, - ) - if sample_size != ntokens: - metrics.log_scalar( - "nll_loss", loss_sum / ntokens / math.log(2), ntokens, round=3 - ) - metrics.log_derived( - "ppl", lambda meters: utils.get_perplexity(meters["nll_loss"].avg) - ) - else: - metrics.log_derived( - "ppl", lambda meters: utils.get_perplexity(meters["loss"].avg) - ) - - @staticmethod - def logging_outputs_can_be_summed() -> bool: - """ - Whether the logging outputs returned by `forward` can be summed - across workers prior to calling `reduce_metrics`. Setting this - to True will improves distributed training speed. - """ - return True diff --git a/spaces/Illumotion/Koboldcpp/Makefile b/spaces/Illumotion/Koboldcpp/Makefile deleted file mode 100644 index 695a943eafb3708e79a8d0f516f7c9e05878db75..0000000000000000000000000000000000000000 --- a/spaces/Illumotion/Koboldcpp/Makefile +++ /dev/null @@ -1,506 +0,0 @@ -default: koboldcpp_default koboldcpp_failsafe koboldcpp_openblas koboldcpp_noavx2 koboldcpp_clblast koboldcpp_cublas koboldcpp_hipblas -tools: quantize_gpt2 quantize_gptj quantize_llama quantize_neox quantize_mpt -dev: koboldcpp_openblas -dev2: koboldcpp_clblast - - -ifndef UNAME_S -UNAME_S := $(shell uname -s) -endif - -ifndef UNAME_P -UNAME_P := $(shell uname -p) -endif - -ifndef UNAME_M -UNAME_M := $(shell uname -m) -endif - -ifneq ($(shell grep -e "Arch Linux" -e "ID_LIKE=arch" /etc/os-release 2>/dev/null),) -ARCH_ADD = -lcblas -endif - - -# Mac OS + Arm can report x86_64 -# ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789 -ifeq ($(UNAME_S),Darwin) - ifneq ($(UNAME_P),arm) - SYSCTL_M := $(shell sysctl -n hw.optional.arm64 2>/dev/null) - ifeq ($(SYSCTL_M),1) - # UNAME_P := arm - # UNAME_M := arm64 - warn := $(warning Your arch is announced as x86_64, but it seems to actually be ARM64. Not fixing that can lead to bad performance. For more info see: https://github.com/ggerganov/whisper.cpp/issues/66\#issuecomment-1282546789) - endif - endif -endif - -# -# Compile flags -# - -# keep standard at C11 and C++11 -CFLAGS = -I. -I./include -I./include/CL -I./otherarch -I./otherarch/tools -Ofast -DNDEBUG -std=c11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -CXXFLAGS = -I. -I./common -I./include -I./include/CL -I./otherarch -I./otherarch/tools -Ofast -DNDEBUG -std=c++11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -LDFLAGS = - -ifndef LLAMA_NO_K_QUANTS -CFLAGS += -DGGML_USE_K_QUANTS -CXXFLAGS += -DGGML_USE_K_QUANTS -endif - -# these are used on windows, to build some libraries with extra old device compatibility -SIMPLECFLAGS = -FULLCFLAGS = -NONECFLAGS = - -OPENBLAS_FLAGS = -DGGML_USE_OPENBLAS -I/usr/local/include/openblas -CLBLAST_FLAGS = -DGGML_USE_CLBLAST -FAILSAFE_FLAGS = -DUSE_FAILSAFE -ifdef LLAMA_CUBLAS - CUBLAS_FLAGS = -DGGML_USE_CUBLAS -else - CUBLAS_FLAGS = -endif -CUBLASLD_FLAGS = -CUBLAS_OBJS = - -#lets try enabling everything -CFLAGS += -pthread -s -CXXFLAGS += -pthread -s -Wno-multichar -Wno-write-strings - -# OS specific -# TODO: support Windows -ifeq ($(UNAME_S),Linux) - CFLAGS += -pthread - CXXFLAGS += -pthread -endif - -ifeq ($(UNAME_S),Darwin) - CFLAGS += -pthread - CXXFLAGS += -pthread -endif -ifeq ($(UNAME_S),FreeBSD) - CFLAGS += -pthread - CXXFLAGS += -pthread -endif -ifeq ($(UNAME_S),NetBSD) - CFLAGS += -pthread - CXXFLAGS += -pthread -endif -ifeq ($(UNAME_S),OpenBSD) - CFLAGS += -pthread - CXXFLAGS += -pthread -endif -ifeq ($(UNAME_S),Haiku) - CFLAGS += -pthread - CXXFLAGS += -pthread -endif - -ifdef LLAMA_GPROF - CFLAGS += -pg - CXXFLAGS += -pg -endif -ifdef LLAMA_PERF - CFLAGS += -DGGML_PERF - CXXFLAGS += -DGGML_PERF -endif - -# Architecture specific -# TODO: probably these flags need to be tweaked on some architectures -# feel free to update the Makefile for your architecture and send a pull request or issue -ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686)) - # Use all CPU extensions that are available: -# old library NEEDS mf16c to work. so we must build with it. new one doesnt - ifeq ($(OS),Windows_NT) - CFLAGS += - NONECFLAGS += -# -mno-sse3 - SIMPLECFLAGS += -mavx -msse3 - FULLCFLAGS += -mavx2 -msse3 -mfma -mf16c -mavx - else -# if not on windows, they are clearly building it themselves, so lets just use whatever is supported - CFLAGS += -march=native -mtune=native - endif -endif -ifneq ($(filter ppc64%,$(UNAME_M)),) - POWER9_M := $(shell grep "POWER9" /proc/cpuinfo) - ifneq (,$(findstring POWER9,$(POWER9_M))) - CFLAGS += -mcpu=power9 - CXXFLAGS += -mcpu=power9 - endif - # Require c++23's std::byteswap for big-endian support. - ifeq ($(UNAME_M),ppc64) - CXXFLAGS += -std=c++23 -DGGML_BIG_ENDIAN - endif -endif -ifndef LLAMA_NO_ACCELERATE - # Mac M1 - include Accelerate framework. - # `-framework Accelerate` works on Mac Intel as well, with negliable performance boost (as of the predict time). - ifeq ($(UNAME_S),Darwin) - CFLAGS += -DGGML_USE_ACCELERATE - LDFLAGS += -framework Accelerate - endif -endif - -# it is recommended to use the CMAKE file to build for cublas if you can - will likely work better -ifdef LLAMA_CUBLAS - CUBLAS_FLAGS = -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include - CUBLASLD_FLAGS = -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L/usr/local/cuda/lib64 -L/opt/cuda/lib64 -L$(CUDA_PATH)/targets/x86_64-linux/lib - CUBLAS_OBJS = ggml-cuda.o ggml_v2-cuda.o ggml_v2-cuda-legacy.o - NVCC = nvcc - NVCCFLAGS = --forward-unknown-to-host-compiler -use_fast_math -ifdef CUDA_DOCKER_ARCH - NVCCFLAGS += -Wno-deprecated-gpu-targets -arch=$(CUDA_DOCKER_ARCH) -else - NVCCFLAGS += -arch=native -endif # CUDA_DOCKER_ARCH -ifdef LLAMA_CUDA_FORCE_DMMV - NVCCFLAGS += -DGGML_CUDA_FORCE_DMMV -endif # LLAMA_CUDA_FORCE_DMMV -ifdef LLAMA_CUDA_DMMV_X - NVCCFLAGS += -DGGML_CUDA_DMMV_X=$(LLAMA_CUDA_DMMV_X) -else - NVCCFLAGS += -DGGML_CUDA_DMMV_X=32 -endif # LLAMA_CUDA_DMMV_X -ifdef LLAMA_CUDA_MMV_Y - NVCCFLAGS += -DGGML_CUDA_MMV_Y=$(LLAMA_CUDA_MMV_Y) -else ifdef LLAMA_CUDA_DMMV_Y - NVCCFLAGS += -DGGML_CUDA_MMV_Y=$(LLAMA_CUDA_DMMV_Y) # for backwards compatibility -else - NVCCFLAGS += -DGGML_CUDA_MMV_Y=1 -endif # LLAMA_CUDA_MMV_Y -ifdef LLAMA_CUDA_F16 - NVCCFLAGS += -DGGML_CUDA_F16 -endif # LLAMA_CUDA_F16 -ifdef LLAMA_CUDA_DMMV_F16 - NVCCFLAGS += -DGGML_CUDA_F16 -endif # LLAMA_CUDA_DMMV_F16 -ifdef LLAMA_CUDA_KQUANTS_ITER - NVCCFLAGS += -DK_QUANTS_PER_ITERATION=$(LLAMA_CUDA_KQUANTS_ITER) -else - NVCCFLAGS += -DK_QUANTS_PER_ITERATION=2 -endif -ifdef LLAMA_CUDA_MMQ_Y - NVCCFLAGS += -DGGML_CUDA_MMQ_Y=$(LLAMA_CUDA_MMQ_Y) -else - NVCCFLAGS += -DGGML_CUDA_MMQ_Y=64 -endif # LLAMA_CUDA_MMQ_Y -#ifdef LLAMA_CUDA_CUBLAS -# NVCCFLAGS += -DGGML_CUDA_CUBLAS -#endif # LLAMA_CUDA_CUBLAS -ifdef LLAMA_CUDA_CCBIN - NVCCFLAGS += -ccbin $(LLAMA_CUDA_CCBIN) -endif -ggml-cuda.o: ggml-cuda.cu ggml-cuda.h - $(NVCC) $(NVCCFLAGS) $(subst -Ofast,-O3,$(CXXFLAGS)) $(CUBLAS_FLAGS) $(CUBLAS_CXXFLAGS) -Wno-pedantic -c $< -o $@ -ggml_v2-cuda.o: otherarch/ggml_v2-cuda.cu otherarch/ggml_v2-cuda.h - $(NVCC) $(NVCCFLAGS) $(subst -Ofast,-O3,$(CXXFLAGS)) $(CUBLAS_FLAGS) $(CUBLAS_CXXFLAGS) -Wno-pedantic -c $< -o $@ -ggml_v2-cuda-legacy.o: otherarch/ggml_v2-cuda-legacy.cu otherarch/ggml_v2-cuda-legacy.h - $(NVCC) $(NVCCFLAGS) $(subst -Ofast,-O3,$(CXXFLAGS)) $(CUBLAS_FLAGS) $(CUBLAS_CXXFLAGS) -Wno-pedantic -c $< -o $@ -endif # LLAMA_CUBLAS - -ifdef LLAMA_HIPBLAS - ROCM_PATH ?= /opt/rocm - CC := $(ROCM_PATH)/llvm/bin/clang - CXX := $(ROCM_PATH)/llvm/bin/clang++ - GPU_TARGETS ?= gfx803 gfx900 gfx906 gfx908 gfx90a gfx1030 gfx1100 $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch) - LLAMA_CUDA_DMMV_X ?= 32 - LLAMA_CUDA_MMV_Y ?= 2 - LLAMA_CUDA_KQUANTS_ITER ?= 2 - HIPFLAGS += -DGGML_USE_HIPBLAS -DGGML_USE_CUBLAS $(shell $(ROCM_PATH)/bin/hipconfig -C) -ifdef LLAMA_CUDA_FORCE_DMMV - HIPFLAGS += -DGGML_CUDA_FORCE_DMMV -endif # LLAMA_CUDA_FORCE_DMMV - HIPLDFLAGS += -L$(ROCM_PATH)/lib -Wl,-rpath=$(ROCM_PATH)/lib -lhipblas -lamdhip64 -lrocblas - HIP_OBJS += ggml-cuda.o ggml_v2-cuda.o ggml_v2-cuda-legacy.o -ggml-cuda.o: HIPFLAGS += $(addprefix --offload-arch=,$(GPU_TARGETS)) \ - -DGGML_CUDA_DMMV_X=$(LLAMA_CUDA_DMMV_X) \ - -DGGML_CUDA_MMV_Y=$(LLAMA_CUDA_MMV_Y) \ - -DK_QUANTS_PER_ITERATION=$(LLAMA_CUDA_KQUANTS_ITER) -ggml_v2-cuda.o: HIPFLAGS += $(addprefix --offload-arch=,$(GPU_TARGETS)) \ - -DGGML_CUDA_DMMV_X=$(LLAMA_CUDA_DMMV_X) \ - -DGGML_CUDA_MMV_Y=$(LLAMA_CUDA_MMV_Y) \ - -DK_QUANTS_PER_ITERATION=$(LLAMA_CUDA_KQUANTS_ITER) -ggml_v2-cuda-legacy.o: HIPFLAGS += $(addprefix --offload-arch=,$(GPU_TARGETS)) \ - -DGGML_CUDA_DMMV_X=$(LLAMA_CUDA_DMMV_X) \ - -DGGML_CUDA_MMV_Y=$(LLAMA_CUDA_MMV_Y) \ - -DK_QUANTS_PER_ITERATION=$(LLAMA_CUDA_KQUANTS_ITER) -ggml-cuda.o: ggml-cuda.cu ggml-cuda.h - $(CXX) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $< -ggml_v2-cuda.o: otherarch/ggml_v2-cuda.cu otherarch/ggml_v2-cuda.h - $(CXX) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $< -ggml_v2-cuda-legacy.o: otherarch/ggml_v2-cuda-legacy.cu otherarch/ggml_v2-cuda-legacy.h - $(CXX) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $< -endif # LLAMA_HIPBLAS - - - -ifdef LLAMA_METAL - CFLAGS += -DGGML_USE_METAL -DGGML_METAL_NDEBUG - CXXFLAGS += -DGGML_USE_METAL - LDFLAGS += -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders - OBJS += ggml-metal.o - -ggml-metal.o: ggml-metal.m ggml-metal.h - $(CC) $(CFLAGS) -c $< -o $@ -endif # LLAMA_METAL - -ifneq ($(filter aarch64%,$(UNAME_M)),) - # Apple M1, M2, etc. - # Raspberry Pi 3, 4, Zero 2 (64-bit) - CFLAGS += - CXXFLAGS += -endif -ifneq ($(filter armv6%,$(UNAME_M)),) - # Raspberry Pi 1, Zero - CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -endif -ifneq ($(filter armv7%,$(UNAME_M)),) - # Raspberry Pi 2 - CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations -endif -ifneq ($(filter armv8%,$(UNAME_M)),) - # Raspberry Pi 3, 4, Zero 2 (32-bit) - CFLAGS += -mfp16-format=ieee -mno-unaligned-access -endif - -CCV := $(shell $(CC) --version | head -n 1) -CXXV := $(shell $(CXX) --version | head -n 1) - -DEFAULT_BUILD = -FAILSAFE_BUILD = -OPENBLAS_BUILD = -NOAVX2_BUILD = -CLBLAST_BUILD = -CUBLAS_BUILD = -HIPBLAS_BUILD = - -ifeq ($(OS),Windows_NT) - DEFAULT_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS) - FAILSAFE_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS) - OPENBLAS_BUILD = $(CXX) $(CXXFLAGS) $^ lib/libopenblas.lib -shared -o $@.dll $(LDFLAGS) - NOAVX2_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS) - CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ lib/OpenCL.lib lib/clblast.lib -shared -o $@.dll $(LDFLAGS) - - ifdef LLAMA_CUBLAS - CUBLAS_BUILD = $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $^ -shared -o $@.dll $(CUBLASLD_FLAGS) $(LDFLAGS) - endif - ifdef LLAMA_HIPBLAS - HIPBLAS_BUILD = $(CXX) $(CXXFLAGS) $(HIPFLAGS) $^ -shared -o $@.dll $(HIPLDFLAGS) $(LDFLAGS) - endif -else - DEFAULT_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS) - - ifdef LLAMA_OPENBLAS - OPENBLAS_BUILD = $(CXX) $(CXXFLAGS) $^ $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS) - endif - ifdef LLAMA_CLBLAST - ifeq ($(UNAME_S),Darwin) - CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -framework OpenCL $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS) - else - CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -lOpenCL $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS) - endif - endif - ifdef LLAMA_CUBLAS - CUBLAS_BUILD = $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $^ -shared -o $@.so $(CUBLASLD_FLAGS) $(LDFLAGS) - endif - ifdef LLAMA_HIPBLAS - HIPBLAS_BUILD = $(CXX) $(CXXFLAGS) $(HIPFLAGS) $^ -shared -o $@.so $(HIPLDFLAGS) $(LDFLAGS) - endif - - ifndef LLAMA_OPENBLAS - ifndef LLAMA_CLBLAST - ifndef LLAMA_CUBLAS - ifndef LLAMA_HIPBLAS - OPENBLAS_BUILD = @echo 'Your OS $(OS) does not appear to be Windows. For faster speeds, install and link a BLAS library. Set LLAMA_OPENBLAS=1 to compile with OpenBLAS support or LLAMA_CLBLAST=1 to compile with ClBlast support. This is just a reminder, not an error.' - endif - endif - endif - endif -endif - - - -# -# Print build information -# - -$(info I llama.cpp build info: ) -$(info I UNAME_S: $(UNAME_S)) -$(info I UNAME_P: $(UNAME_P)) -$(info I UNAME_M: $(UNAME_M)) -$(info I CFLAGS: $(CFLAGS)) -$(info I CXXFLAGS: $(CXXFLAGS)) -$(info I LDFLAGS: $(LDFLAGS)) -$(info I CC: $(CCV)) -$(info I CXX: $(CXXV)) -$(info ) - -# -# Build library -# - -ggml.o: ggml.c ggml.h ggml-cuda.h k_quants.h - $(CC) $(CFLAGS) $(FULLCFLAGS) -c $< -o $@ -ggml_openblas.o: ggml.c ggml.h ggml-cuda.h k_quants.h - $(CC) $(CFLAGS) $(FULLCFLAGS) $(OPENBLAS_FLAGS) -c $< -o $@ -ggml_failsafe.o: ggml.c ggml.h ggml-cuda.h k_quants.h - $(CC) $(CFLAGS) $(NONECFLAGS) -c $< -o $@ -ggml_noavx2.o: ggml.c ggml.h ggml-cuda.h k_quants.h - $(CC) $(CFLAGS) $(SIMPLECFLAGS) -c $< -o $@ -ggml_clblast.o: ggml.c ggml.h ggml-cuda.h k_quants.h - $(CC) $(CFLAGS) $(FULLCFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ -ggml_cublas.o: ggml.c ggml.h ggml-cuda.h k_quants.h - $(CC) $(CFLAGS) $(FULLCFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@ - -#quants K -KQ1 = -KQ2 = -KQ3 = -ifndef LLAMA_NO_K_QUANTS -KQ1 = k_quants.o -KQ2 = k_quants_noavx2.o -KQ3 = k_quants_failsafe.o -k_quants.o: k_quants.c k_quants.h ggml.h ggml-cuda.h - $(CC) $(CFLAGS) $(FULLCFLAGS) -c $< -o $@ -k_quants_noavx2.o: k_quants.c k_quants.h ggml.h ggml-cuda.h - $(CC) $(CFLAGS) $(SIMPLECFLAGS) -c $< -o $@ -k_quants_failsafe.o: k_quants.c k_quants.h ggml.h ggml-cuda.h - $(CC) $(CFLAGS) $(NONECFLAGS) -c $< -o $@ -endif # LLAMA_NO_K_QUANTS - -#there's no intrinsics or special gpu ops used here, so we can have a universal object -ggml-alloc.o: ggml-alloc.c ggml.h ggml-alloc.h - $(CC) $(CFLAGS) -c $< -o $@ - -#version 2 libs -ggml_v2.o: otherarch/ggml_v2.c otherarch/ggml_v2.h - $(CC) $(CFLAGS) $(FULLCFLAGS) -c $< -o $@ -ggml_v2_openblas.o: otherarch/ggml_v2.c otherarch/ggml_v2.h - $(CC) $(CFLAGS) $(FULLCFLAGS) $(OPENBLAS_FLAGS) -c $< -o $@ -ggml_v2_failsafe.o: otherarch/ggml_v2.c otherarch/ggml_v2.h - $(CC) $(CFLAGS) $(NONECFLAGS) -c $< -o $@ -ggml_v2_noavx2.o: otherarch/ggml_v2.c otherarch/ggml_v2.h - $(CC) $(CFLAGS) $(SIMPLECFLAGS) -c $< -o $@ -ggml_v2_clblast.o: otherarch/ggml_v2.c otherarch/ggml_v2.h - $(CC) $(CFLAGS) $(FULLCFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ -ggml_v2_cublas.o: otherarch/ggml_v2.c otherarch/ggml_v2.h - $(CC) $(CFLAGS) $(FULLCFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@ - -#extreme old version compat -ggml_v1.o: otherarch/ggml_v1.c otherarch/ggml_v1.h - $(CC) $(CFLAGS) $(FULLCFLAGS) -c $< -o $@ -ggml_v1_failsafe.o: otherarch/ggml_v1.c otherarch/ggml_v1.h - $(CC) $(CFLAGS) $(NONECFLAGS) -c $< -o $@ - -#opencl -ggml-opencl.o: ggml-opencl.cpp ggml-opencl.h - $(CXX) $(CXXFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ -ggml_v2-opencl.o: otherarch/ggml_v2-opencl.cpp otherarch/ggml_v2-opencl.h - $(CXX) $(CXXFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ -ggml_v2-opencl-legacy.o: otherarch/ggml_v2-opencl-legacy.c otherarch/ggml_v2-opencl-legacy.h - $(CC) $(CFLAGS) -c $< -o $@ - -# intermediate objects -llama.o: llama.cpp ggml.h ggml-alloc.h ggml-cuda.h ggml-metal.h llama.h otherarch/llama-util.h - $(CXX) $(CXXFLAGS) -c $< -o $@ -common.o: common/common.cpp common/common.h common/log.h - $(CXX) $(CXXFLAGS) -c $< -o $@ -console.o: common/console.cpp common/console.h - $(CXX) $(CXXFLAGS) -c $< -o $@ -grammar-parser.o: common/grammar-parser.cpp common/grammar-parser.h - $(CXX) $(CXXFLAGS) -c $< -o $@ -expose.o: expose.cpp expose.h - $(CXX) $(CXXFLAGS) -c $< -o $@ - -# idiotic "for easier compilation" -GPTTYPE_ADAPTER = gpttype_adapter.cpp otherarch/llama_v2.cpp otherarch/llama_v3.cpp llama.cpp otherarch/utils.cpp otherarch/gptj_v1.cpp otherarch/gptj_v2.cpp otherarch/gptj_v3.cpp otherarch/gpt2_v1.cpp otherarch/gpt2_v2.cpp otherarch/gpt2_v3.cpp otherarch/rwkv_v2.cpp otherarch/rwkv_v3.cpp otherarch/neox_v2.cpp otherarch/neox_v3.cpp otherarch/mpt_v3.cpp ggml.h ggml-cuda.h llama.h otherarch/llama-util.h -gpttype_adapter_failsafe.o: $(GPTTYPE_ADAPTER) - $(CXX) $(CXXFLAGS) $(FAILSAFE_FLAGS) -c $< -o $@ -gpttype_adapter.o: $(GPTTYPE_ADAPTER) - $(CXX) $(CXXFLAGS) -c $< -o $@ -gpttype_adapter_clblast.o: $(GPTTYPE_ADAPTER) - $(CXX) $(CXXFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ -gpttype_adapter_cublas.o: $(GPTTYPE_ADAPTER) - $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@ - -clean: - rm -vf *.o main quantize_llama quantize_gpt2 quantize_gptj quantize_neox quantize_mpt quantize-stats perplexity embedding benchmark-matmult save-load-state gguf gguf.exe main.exe quantize_llama.exe quantize_gptj.exe quantize_gpt2.exe quantize_neox.exe quantize_mpt.exe koboldcpp_default.dll koboldcpp_openblas.dll koboldcpp_failsafe.dll koboldcpp_noavx2.dll koboldcpp_clblast.dll koboldcpp_cublas.dll koboldcpp_hipblas.dll koboldcpp_default.so koboldcpp_openblas.so koboldcpp_failsafe.so koboldcpp_noavx2.so koboldcpp_clblast.so koboldcpp_cublas.so koboldcpp_hipblas.so - -main: examples/main/main.cpp build-info.h ggml.o $(KQ1) ggml-alloc.o llama.o common.o console.o grammar-parser.o $(OBJS) - $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) - @echo - @echo '==== Run ./main -h for help. ====' - @echo - -gguf: examples/gguf/gguf.cpp build-info.h ggml.o llama.o $(OBJS) - $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) - - -#generated libraries -koboldcpp_default: ggml.o ggml_v2.o ggml_v1.o expose.o common.o gpttype_adapter.o $(KQ1) ggml-alloc.o grammar-parser.o $(OBJS) - $(DEFAULT_BUILD) - -ifdef OPENBLAS_BUILD -koboldcpp_openblas: ggml_openblas.o ggml_v2_openblas.o ggml_v1.o expose.o common.o gpttype_adapter.o $(KQ1) ggml-alloc.o grammar-parser.o $(OBJS) - $(OPENBLAS_BUILD) -else -koboldcpp_openblas: - $(DONOTHING) -endif - -ifdef FAILSAFE_BUILD -koboldcpp_failsafe: ggml_failsafe.o ggml_v2_failsafe.o ggml_v1_failsafe.o expose.o common.o gpttype_adapter_failsafe.o $(KQ3) ggml-alloc.o grammar-parser.o $(OBJS) - $(FAILSAFE_BUILD) -else -koboldcpp_failsafe: - $(DONOTHING) -endif - -ifdef NOAVX2_BUILD -koboldcpp_noavx2: ggml_noavx2.o ggml_v2_noavx2.o ggml_v1_failsafe.o expose.o common.o gpttype_adapter_failsafe.o $(KQ2) ggml-alloc.o grammar-parser.o $(OBJS) - $(NOAVX2_BUILD) -else -koboldcpp_noavx2: - $(DONOTHING) -endif - -ifdef CLBLAST_BUILD -koboldcpp_clblast: ggml_clblast.o ggml_v2_clblast.o ggml_v1.o expose.o common.o gpttype_adapter_clblast.o ggml-opencl.o ggml_v2-opencl.o ggml_v2-opencl-legacy.o $(KQ1) ggml-alloc.o grammar-parser.o $(OBJS) - $(CLBLAST_BUILD) -else -koboldcpp_clblast: - $(DONOTHING) -endif - -ifdef CUBLAS_BUILD -koboldcpp_cublas: ggml_cublas.o ggml_v2_cublas.o ggml_v1.o expose.o common.o gpttype_adapter_cublas.o $(KQ1) ggml-alloc.o grammar-parser.o $(CUBLAS_OBJS) $(OBJS) - $(CUBLAS_BUILD) -else -koboldcpp_cublas: - $(DONOTHING) -endif - -ifdef HIPBLAS_BUILD -koboldcpp_hipblas: ggml_cublas.o ggml_v2_cublas.o ggml_v1.o expose.o common.o gpttype_adapter_cublas.o $(KQ1) ggml-alloc.o grammar-parser.o $(HIP_OBJS) $(OBJS) - $(HIPBLAS_BUILD) -else -koboldcpp_hipblas: - $(DONOTHING) -endif - -# tools -quantize_llama: examples/quantize/quantize.cpp ggml.o llama.o $(KQ1) ggml-alloc.o - $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -quantize_gptj: ggml.o llama.o $(KQ1) ggml-alloc.o otherarch/tools/gptj_quantize.cpp otherarch/tools/common-ggml.cpp - $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -quantize_gpt2: ggml.o llama.o $(KQ1) ggml-alloc.o otherarch/tools/gpt2_quantize.cpp otherarch/tools/common-ggml.cpp - $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -quantize_neox: ggml.o llama.o $(KQ1) ggml-alloc.o otherarch/tools/neox_quantize.cpp otherarch/tools/common-ggml.cpp - $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -quantize_mpt: ggml.o llama.o $(KQ1) ggml-alloc.o otherarch/tools/mpt_quantize.cpp otherarch/tools/common-ggml.cpp - $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) - - -build-info.h: - $(DONOTHING) diff --git a/spaces/Jamel887/Rvc-tio887/lib/infer_pack/models_onnx.py b/spaces/Jamel887/Rvc-tio887/lib/infer_pack/models_onnx.py deleted file mode 100644 index 963e67b29f828e9fdd096397952054fe77cf3d10..0000000000000000000000000000000000000000 --- a/spaces/Jamel887/Rvc-tio887/lib/infer_pack/models_onnx.py +++ /dev/null @@ -1,819 +0,0 @@ -import math, pdb, os -from time import time as ttime -import torch -from torch import nn -from torch.nn import functional as F -from lib.infer_pack import modules -from lib.infer_pack import attentions -from lib.infer_pack import commons -from lib.infer_pack.commons import init_weights, get_padding -from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d -from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm -from lib.infer_pack.commons import init_weights -import numpy as np -from lib.infer_pack import commons - - -class TextEncoder256(nn.Module): - def __init__( - self, - out_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - f0=True, - ): - super().__init__() - self.out_channels = out_channels - 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.emb_phone = nn.Linear(256, hidden_channels) - self.lrelu = nn.LeakyReLU(0.1, inplace=True) - if f0 == True: - self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256 - self.encoder = attentions.Encoder( - hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout - ) - self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1) - - def forward(self, phone, pitch, lengths): - if pitch == None: - x = self.emb_phone(phone) - else: - x = self.emb_phone(phone) + self.emb_pitch(pitch) - x = x * math.sqrt(self.hidden_channels) # [b, t, h] - x = self.lrelu(x) - x = torch.transpose(x, 1, -1) # [b, h, t] - x_mask = torch.unsqueeze(commons.sequence_mask(lengths, x.size(2)), 1).to( - x.dtype - ) - x = self.encoder(x * x_mask, x_mask) - stats = self.proj(x) * x_mask - - m, logs = torch.split(stats, self.out_channels, dim=1) - return m, logs, x_mask - - -class TextEncoder768(nn.Module): - def __init__( - self, - out_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - f0=True, - ): - super().__init__() - self.out_channels = out_channels - 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.emb_phone = nn.Linear(768, hidden_channels) - self.lrelu = nn.LeakyReLU(0.1, inplace=True) - if f0 == True: - self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256 - self.encoder = attentions.Encoder( - hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout - ) - self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1) - - def forward(self, phone, pitch, lengths): - if pitch == None: - x = self.emb_phone(phone) - else: - x = self.emb_phone(phone) + self.emb_pitch(pitch) - x = x * math.sqrt(self.hidden_channels) # [b, t, h] - x = self.lrelu(x) - x = torch.transpose(x, 1, -1) # [b, h, t] - x_mask = torch.unsqueeze(commons.sequence_mask(lengths, x.size(2)), 1).to( - x.dtype - ) - x = self.encoder(x * x_mask, x_mask) - stats = self.proj(x) * x_mask - - m, logs = torch.split(stats, self.out_channels, dim=1) - return m, logs, x_mask - - -class ResidualCouplingBlock(nn.Module): - def __init__( - self, - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - n_flows=4, - gin_channels=0, - ): - 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.n_flows = n_flows - self.gin_channels = gin_channels - - self.flows = nn.ModuleList() - for i in range(n_flows): - self.flows.append( - modules.ResidualCouplingLayer( - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=gin_channels, - mean_only=True, - ) - ) - self.flows.append(modules.Flip()) - - def forward(self, x, x_mask, g=None, reverse=False): - if not reverse: - for flow in self.flows: - x, _ = flow(x, x_mask, g=g, reverse=reverse) - else: - for flow in reversed(self.flows): - x = flow(x, x_mask, g=g, reverse=reverse) - return x - - def remove_weight_norm(self): - for i in range(self.n_flows): - self.flows[i * 2].remove_weight_norm() - - -class PosteriorEncoder(nn.Module): - def __init__( - self, - in_channels, - out_channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=0, - ): - super().__init__() - self.in_channels = in_channels - self.out_channels = out_channels - 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.pre = nn.Conv1d(in_channels, hidden_channels, 1) - self.enc = modules.WN( - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=gin_channels, - ) - self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1) - - def forward(self, x, x_lengths, g=None): - x_mask = torch.unsqueeze(commons.sequence_mask(x_lengths, x.size(2)), 1).to( - x.dtype - ) - x = self.pre(x) * x_mask - x = self.enc(x, x_mask, g=g) - stats = self.proj(x) * x_mask - m, logs = torch.split(stats, self.out_channels, dim=1) - z = (m + torch.randn_like(m) * torch.exp(logs)) * x_mask - return z, m, logs, x_mask - - def remove_weight_norm(self): - self.enc.remove_weight_norm() - - -class Generator(torch.nn.Module): - def __init__( - self, - initial_channel, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels=0, - ): - super(Generator, self).__init__() - self.num_kernels = len(resblock_kernel_sizes) - self.num_upsamples = len(upsample_rates) - self.conv_pre = Conv1d( - initial_channel, upsample_initial_channel, 7, 1, padding=3 - ) - resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2 - - self.ups = nn.ModuleList() - for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)): - self.ups.append( - weight_norm( - ConvTranspose1d( - upsample_initial_channel // (2**i), - upsample_initial_channel // (2 ** (i + 1)), - k, - u, - padding=(k - u) // 2, - ) - ) - ) - - self.resblocks = nn.ModuleList() - for i in range(len(self.ups)): - ch = upsample_initial_channel // (2 ** (i + 1)) - for j, (k, d) in enumerate( - zip(resblock_kernel_sizes, resblock_dilation_sizes) - ): - self.resblocks.append(resblock(ch, k, d)) - - self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False) - self.ups.apply(init_weights) - - if gin_channels != 0: - self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1) - - def forward(self, x, g=None): - x = self.conv_pre(x) - if g is not None: - x = x + self.cond(g) - - for i in range(self.num_upsamples): - x = F.leaky_relu(x, modules.LRELU_SLOPE) - x = self.ups[i](x) - xs = None - for j in range(self.num_kernels): - if xs is None: - xs = self.resblocks[i * self.num_kernels + j](x) - else: - xs += self.resblocks[i * self.num_kernels + j](x) - x = xs / self.num_kernels - x = F.leaky_relu(x) - x = self.conv_post(x) - x = torch.tanh(x) - - return x - - def remove_weight_norm(self): - for l in self.ups: - remove_weight_norm(l) - for l in self.resblocks: - l.remove_weight_norm() - - -class SineGen(torch.nn.Module): - """Definition of sine generator - SineGen(samp_rate, harmonic_num = 0, - sine_amp = 0.1, noise_std = 0.003, - voiced_threshold = 0, - flag_for_pulse=False) - samp_rate: sampling rate in Hz - harmonic_num: number of harmonic overtones (default 0) - sine_amp: amplitude of sine-wavefrom (default 0.1) - noise_std: std of Gaussian noise (default 0.003) - voiced_thoreshold: F0 threshold for U/V classification (default 0) - flag_for_pulse: this SinGen is used inside PulseGen (default False) - Note: when flag_for_pulse is True, the first time step of a voiced - segment is always sin(np.pi) or cos(0) - """ - - def __init__( - self, - samp_rate, - harmonic_num=0, - sine_amp=0.1, - noise_std=0.003, - voiced_threshold=0, - flag_for_pulse=False, - ): - super(SineGen, self).__init__() - self.sine_amp = sine_amp - self.noise_std = noise_std - self.harmonic_num = harmonic_num - self.dim = self.harmonic_num + 1 - self.sampling_rate = samp_rate - self.voiced_threshold = voiced_threshold - - def _f02uv(self, f0): - # generate uv signal - uv = torch.ones_like(f0) - uv = uv * (f0 > self.voiced_threshold) - return uv - - def forward(self, f0, upp): - """sine_tensor, uv = forward(f0) - input F0: tensor(batchsize=1, length, dim=1) - f0 for unvoiced steps should be 0 - output sine_tensor: tensor(batchsize=1, length, dim) - output uv: tensor(batchsize=1, length, 1) - """ - with torch.no_grad(): - f0 = f0[:, None].transpose(1, 2) - f0_buf = torch.zeros(f0.shape[0], f0.shape[1], self.dim, device=f0.device) - # fundamental component - f0_buf[:, :, 0] = f0[:, :, 0] - for idx in np.arange(self.harmonic_num): - f0_buf[:, :, idx + 1] = f0_buf[:, :, 0] * ( - idx + 2 - ) # idx + 2: the (idx+1)-th overtone, (idx+2)-th harmonic - rad_values = (f0_buf / self.sampling_rate) % 1 ###%1意味着n_har的乘积无法后处理优化 - rand_ini = torch.rand( - f0_buf.shape[0], f0_buf.shape[2], device=f0_buf.device - ) - rand_ini[:, 0] = 0 - rad_values[:, 0, :] = rad_values[:, 0, :] + rand_ini - tmp_over_one = torch.cumsum(rad_values, 1) # % 1 #####%1意味着后面的cumsum无法再优化 - tmp_over_one *= upp - tmp_over_one = F.interpolate( - tmp_over_one.transpose(2, 1), - scale_factor=upp, - mode="linear", - align_corners=True, - ).transpose(2, 1) - rad_values = F.interpolate( - rad_values.transpose(2, 1), scale_factor=upp, mode="nearest" - ).transpose( - 2, 1 - ) ####### - tmp_over_one %= 1 - tmp_over_one_idx = (tmp_over_one[:, 1:, :] - tmp_over_one[:, :-1, :]) < 0 - cumsum_shift = torch.zeros_like(rad_values) - cumsum_shift[:, 1:, :] = tmp_over_one_idx * -1.0 - sine_waves = torch.sin( - torch.cumsum(rad_values + cumsum_shift, dim=1) * 2 * np.pi - ) - sine_waves = sine_waves * self.sine_amp - uv = self._f02uv(f0) - uv = F.interpolate( - uv.transpose(2, 1), scale_factor=upp, mode="nearest" - ).transpose(2, 1) - noise_amp = uv * self.noise_std + (1 - uv) * self.sine_amp / 3 - noise = noise_amp * torch.randn_like(sine_waves) - sine_waves = sine_waves * uv + noise - return sine_waves, uv, noise - - -class SourceModuleHnNSF(torch.nn.Module): - """SourceModule for hn-nsf - SourceModule(sampling_rate, harmonic_num=0, sine_amp=0.1, - add_noise_std=0.003, voiced_threshod=0) - sampling_rate: sampling_rate in Hz - harmonic_num: number of harmonic above F0 (default: 0) - sine_amp: amplitude of sine source signal (default: 0.1) - add_noise_std: std of additive Gaussian noise (default: 0.003) - note that amplitude of noise in unvoiced is decided - by sine_amp - voiced_threshold: threhold to set U/V given F0 (default: 0) - Sine_source, noise_source = SourceModuleHnNSF(F0_sampled) - F0_sampled (batchsize, length, 1) - Sine_source (batchsize, length, 1) - noise_source (batchsize, length 1) - uv (batchsize, length, 1) - """ - - def __init__( - self, - sampling_rate, - harmonic_num=0, - sine_amp=0.1, - add_noise_std=0.003, - voiced_threshod=0, - is_half=True, - ): - super(SourceModuleHnNSF, self).__init__() - - self.sine_amp = sine_amp - self.noise_std = add_noise_std - self.is_half = is_half - # to produce sine waveforms - self.l_sin_gen = SineGen( - sampling_rate, harmonic_num, sine_amp, add_noise_std, voiced_threshod - ) - - # to merge source harmonics into a single excitation - self.l_linear = torch.nn.Linear(harmonic_num + 1, 1) - self.l_tanh = torch.nn.Tanh() - - def forward(self, x, upp=None): - sine_wavs, uv, _ = self.l_sin_gen(x, upp) - if self.is_half: - sine_wavs = sine_wavs.half() - sine_merge = self.l_tanh(self.l_linear(sine_wavs)) - return sine_merge, None, None # noise, uv - - -class GeneratorNSF(torch.nn.Module): - def __init__( - self, - initial_channel, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels, - sr, - is_half=False, - ): - super(GeneratorNSF, self).__init__() - self.num_kernels = len(resblock_kernel_sizes) - self.num_upsamples = len(upsample_rates) - - self.f0_upsamp = torch.nn.Upsample(scale_factor=np.prod(upsample_rates)) - self.m_source = SourceModuleHnNSF( - sampling_rate=sr, harmonic_num=0, is_half=is_half - ) - self.noise_convs = nn.ModuleList() - self.conv_pre = Conv1d( - initial_channel, upsample_initial_channel, 7, 1, padding=3 - ) - resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2 - - self.ups = nn.ModuleList() - for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)): - c_cur = upsample_initial_channel // (2 ** (i + 1)) - self.ups.append( - weight_norm( - ConvTranspose1d( - upsample_initial_channel // (2**i), - upsample_initial_channel // (2 ** (i + 1)), - k, - u, - padding=(k - u) // 2, - ) - ) - ) - if i + 1 < len(upsample_rates): - stride_f0 = np.prod(upsample_rates[i + 1 :]) - self.noise_convs.append( - Conv1d( - 1, - c_cur, - kernel_size=stride_f0 * 2, - stride=stride_f0, - padding=stride_f0 // 2, - ) - ) - else: - self.noise_convs.append(Conv1d(1, c_cur, kernel_size=1)) - - self.resblocks = nn.ModuleList() - for i in range(len(self.ups)): - ch = upsample_initial_channel // (2 ** (i + 1)) - for j, (k, d) in enumerate( - zip(resblock_kernel_sizes, resblock_dilation_sizes) - ): - self.resblocks.append(resblock(ch, k, d)) - - self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False) - self.ups.apply(init_weights) - - if gin_channels != 0: - self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1) - - self.upp = np.prod(upsample_rates) - - def forward(self, x, f0, g=None): - har_source, noi_source, uv = self.m_source(f0, self.upp) - har_source = har_source.transpose(1, 2) - x = self.conv_pre(x) - if g is not None: - x = x + self.cond(g) - - for i in range(self.num_upsamples): - x = F.leaky_relu(x, modules.LRELU_SLOPE) - x = self.ups[i](x) - x_source = self.noise_convs[i](har_source) - x = x + x_source - xs = None - for j in range(self.num_kernels): - if xs is None: - xs = self.resblocks[i * self.num_kernels + j](x) - else: - xs += self.resblocks[i * self.num_kernels + j](x) - x = xs / self.num_kernels - x = F.leaky_relu(x) - x = self.conv_post(x) - x = torch.tanh(x) - return x - - def remove_weight_norm(self): - for l in self.ups: - remove_weight_norm(l) - for l in self.resblocks: - l.remove_weight_norm() - - -sr2sr = { - "32k": 32000, - "40k": 40000, - "48k": 48000, -} - - -class SynthesizerTrnMsNSFsidM(nn.Module): - def __init__( - self, - spec_channels, - segment_size, - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - spk_embed_dim, - gin_channels, - sr, - version, - **kwargs - ): - super().__init__() - if type(sr) == type("strr"): - sr = sr2sr[sr] - self.spec_channels = spec_channels - self.inter_channels = inter_channels - 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.resblock = resblock - self.resblock_kernel_sizes = resblock_kernel_sizes - self.resblock_dilation_sizes = resblock_dilation_sizes - self.upsample_rates = upsample_rates - self.upsample_initial_channel = upsample_initial_channel - self.upsample_kernel_sizes = upsample_kernel_sizes - self.segment_size = segment_size - self.gin_channels = gin_channels - # self.hop_length = hop_length# - self.spk_embed_dim = spk_embed_dim - if version == "v1": - self.enc_p = TextEncoder256( - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - ) - else: - self.enc_p = TextEncoder768( - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - ) - self.dec = GeneratorNSF( - inter_channels, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels=gin_channels, - sr=sr, - is_half=kwargs["is_half"], - ) - self.enc_q = PosteriorEncoder( - spec_channels, - inter_channels, - hidden_channels, - 5, - 1, - 16, - gin_channels=gin_channels, - ) - self.flow = ResidualCouplingBlock( - inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels - ) - self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels) - self.speaker_map = None - print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim) - - def remove_weight_norm(self): - self.dec.remove_weight_norm() - self.flow.remove_weight_norm() - self.enc_q.remove_weight_norm() - - def construct_spkmixmap(self, n_speaker): - self.speaker_map = torch.zeros((n_speaker, 1, 1, self.gin_channels)) - for i in range(n_speaker): - self.speaker_map[i] = self.emb_g(torch.LongTensor([[i]])) - self.speaker_map = self.speaker_map.unsqueeze(0) - - def forward(self, phone, phone_lengths, pitch, nsff0, g, rnd, max_len=None): - if self.speaker_map is not None: # [N, S] * [S, B, 1, H] - g = g.reshape((g.shape[0], g.shape[1], 1, 1, 1)) # [N, S, B, 1, 1] - g = g * self.speaker_map # [N, S, B, 1, H] - g = torch.sum(g, dim=1) # [N, 1, B, 1, H] - g = g.transpose(0, -1).transpose(0, -2).squeeze(0) # [B, H, N] - else: - g = g.unsqueeze(0) - g = self.emb_g(g).transpose(1, 2) - - m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths) - z_p = (m_p + torch.exp(logs_p) * rnd) * x_mask - z = self.flow(z_p, x_mask, g=g, reverse=True) - o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g) - return o - - -class MultiPeriodDiscriminator(torch.nn.Module): - def __init__(self, use_spectral_norm=False): - super(MultiPeriodDiscriminator, self).__init__() - periods = [2, 3, 5, 7, 11, 17] - # periods = [3, 5, 7, 11, 17, 23, 37] - - discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)] - discs = discs + [ - DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods - ] - self.discriminators = nn.ModuleList(discs) - - def forward(self, y, y_hat): - y_d_rs = [] # - y_d_gs = [] - fmap_rs = [] - fmap_gs = [] - for i, d in enumerate(self.discriminators): - y_d_r, fmap_r = d(y) - y_d_g, fmap_g = d(y_hat) - # for j in range(len(fmap_r)): - # print(i,j,y.shape,y_hat.shape,fmap_r[j].shape,fmap_g[j].shape) - y_d_rs.append(y_d_r) - y_d_gs.append(y_d_g) - fmap_rs.append(fmap_r) - fmap_gs.append(fmap_g) - - return y_d_rs, y_d_gs, fmap_rs, fmap_gs - - -class MultiPeriodDiscriminatorV2(torch.nn.Module): - def __init__(self, use_spectral_norm=False): - super(MultiPeriodDiscriminatorV2, self).__init__() - # periods = [2, 3, 5, 7, 11, 17] - periods = [2, 3, 5, 7, 11, 17, 23, 37] - - discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)] - discs = discs + [ - DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods - ] - self.discriminators = nn.ModuleList(discs) - - def forward(self, y, y_hat): - y_d_rs = [] # - y_d_gs = [] - fmap_rs = [] - fmap_gs = [] - for i, d in enumerate(self.discriminators): - y_d_r, fmap_r = d(y) - y_d_g, fmap_g = d(y_hat) - # for j in range(len(fmap_r)): - # print(i,j,y.shape,y_hat.shape,fmap_r[j].shape,fmap_g[j].shape) - y_d_rs.append(y_d_r) - y_d_gs.append(y_d_g) - fmap_rs.append(fmap_r) - fmap_gs.append(fmap_g) - - return y_d_rs, y_d_gs, fmap_rs, fmap_gs - - -class DiscriminatorS(torch.nn.Module): - def __init__(self, use_spectral_norm=False): - super(DiscriminatorS, self).__init__() - norm_f = weight_norm if use_spectral_norm == False else spectral_norm - self.convs = nn.ModuleList( - [ - norm_f(Conv1d(1, 16, 15, 1, padding=7)), - norm_f(Conv1d(16, 64, 41, 4, groups=4, padding=20)), - norm_f(Conv1d(64, 256, 41, 4, groups=16, padding=20)), - norm_f(Conv1d(256, 1024, 41, 4, groups=64, padding=20)), - norm_f(Conv1d(1024, 1024, 41, 4, groups=256, padding=20)), - norm_f(Conv1d(1024, 1024, 5, 1, padding=2)), - ] - ) - self.conv_post = norm_f(Conv1d(1024, 1, 3, 1, padding=1)) - - def forward(self, x): - fmap = [] - - for l in self.convs: - x = l(x) - x = F.leaky_relu(x, modules.LRELU_SLOPE) - fmap.append(x) - x = self.conv_post(x) - fmap.append(x) - x = torch.flatten(x, 1, -1) - - return x, fmap - - -class DiscriminatorP(torch.nn.Module): - def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=False): - super(DiscriminatorP, self).__init__() - self.period = period - self.use_spectral_norm = use_spectral_norm - norm_f = weight_norm if use_spectral_norm == False else spectral_norm - self.convs = nn.ModuleList( - [ - norm_f( - Conv2d( - 1, - 32, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 32, - 128, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 128, - 512, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 512, - 1024, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 1024, - 1024, - (kernel_size, 1), - 1, - padding=(get_padding(kernel_size, 1), 0), - ) - ), - ] - ) - self.conv_post = norm_f(Conv2d(1024, 1, (3, 1), 1, padding=(1, 0))) - - def forward(self, x): - fmap = [] - - # 1d to 2d - b, c, t = x.shape - if t % self.period != 0: # pad first - n_pad = self.period - (t % self.period) - x = F.pad(x, (0, n_pad), "reflect") - t = t + n_pad - x = x.view(b, c, t // self.period, self.period) - - for l in self.convs: - x = l(x) - x = F.leaky_relu(x, modules.LRELU_SLOPE) - fmap.append(x) - x = self.conv_post(x) - fmap.append(x) - x = torch.flatten(x, 1, -1) - - return x, fmap diff --git a/spaces/Joabutt/test/index.html b/spaces/Joabutt/test/index.html deleted file mode 100644 index 918e851d9dd1baf9e4fb4f067fd979d432472161..0000000000000000000000000000000000000000 --- a/spaces/Joabutt/test/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - My static Space - - - -
    -

    Welcome to your static Space!

    -

    - You can modify this app directly by editing index.html in the - Files and versions tab. -

    -

    - Also don't forget to check the - Spaces documentation. -

    -
    - - diff --git a/spaces/Kreaols/ChuanhuChatGPT/modules/overwrites.py b/spaces/Kreaols/ChuanhuChatGPT/modules/overwrites.py deleted file mode 100644 index e029f4a50285c64dcb286a34cb1c3b2680880e05..0000000000000000000000000000000000000000 --- a/spaces/Kreaols/ChuanhuChatGPT/modules/overwrites.py +++ /dev/null @@ -1,93 +0,0 @@ -from __future__ import annotations -import logging - -from typing import List, Tuple -from gradio_client import utils as client_utils -from gradio import utils -import inspect - -from modules.presets import * -from modules.index_func import * - - -def postprocess( - self, - y: List[List[str | Tuple[str] | Tuple[str, str] | None] | Tuple], - ) -> List[List[str | Dict | None]]: - """ - Parameters: - y: List of lists representing the message and response pairs. Each message and response should be a string, which may be in Markdown format. It can also be a tuple whose first element is a string filepath or URL to an image/video/audio, and second (optional) element is the alt text, in which case the media file is displayed. It can also be None, in which case that message is not displayed. - Returns: - List of lists representing the message and response. Each message and response will be a string of HTML, or a dictionary with media information. Or None if the message is not to be displayed. - """ - if y is None: - return [] - processed_messages = [] - for message_pair in y: - assert isinstance( - message_pair, (tuple, list) - ), f"Expected a list of lists or list of tuples. Received: {message_pair}" - assert ( - len(message_pair) == 2 - ), f"Expected a list of lists of length 2 or list of tuples of length 2. Received: {message_pair}" - - processed_messages.append( - [ - self._postprocess_chat_messages(message_pair[0], "user"), - self._postprocess_chat_messages(message_pair[1], "bot"), - ] - ) - return processed_messages - -def postprocess_chat_messages( - self, chat_message: str | tuple | list | None, role: str - ) -> str | dict | None: - if chat_message is None: - return None - elif isinstance(chat_message, (tuple, list)): - file_uri = chat_message[0] - if utils.validate_url(file_uri): - filepath = file_uri - else: - filepath = self.make_temp_copy_if_needed(file_uri) - - mime_type = client_utils.get_mimetype(filepath) - return { - "name": filepath, - "mime_type": mime_type, - "alt_text": chat_message[1] if len(chat_message) > 1 else None, - "data": None, # These last two fields are filled in by the frontend - "is_file": True, - } - elif isinstance(chat_message, str): - # chat_message = inspect.cleandoc(chat_message) - # escape html spaces - # chat_message = chat_message.replace(" ", " ") - if role == "bot": - chat_message = convert_bot_before_marked(chat_message) - elif role == "user": - chat_message = convert_user_before_marked(chat_message) - return chat_message - else: - raise ValueError(f"Invalid message for Chatbot component: {chat_message}") - -with open("./assets/custom.js", "r", encoding="utf-8") as f, \ - open("./assets/external-scripts.js", "r", encoding="utf-8") as f1: - customJS = f.read() - externalScripts = f1.read() - - -def reload_javascript(): - print("Reloading javascript...") - js = f'' - # if render_latex: - # js += """\""" - def template_response(*args, **kwargs): - res = GradioTemplateResponseOriginal(*args, **kwargs) - res.body = res.body.replace(b'', f'{js}'.encode("utf8")) - res.init_headers() - return res - - gr.routes.templates.TemplateResponse = template_response - -GradioTemplateResponseOriginal = gr.routes.templates.TemplateResponse \ No newline at end of file diff --git a/spaces/KyanChen/RSPrompter/mmdet/engine/schedulers/__init__.py b/spaces/KyanChen/RSPrompter/mmdet/engine/schedulers/__init__.py deleted file mode 100644 index 01261646fa8255c643e86ba0517019760a50d387..0000000000000000000000000000000000000000 --- a/spaces/KyanChen/RSPrompter/mmdet/engine/schedulers/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -from .quadratic_warmup import (QuadraticWarmupLR, QuadraticWarmupMomentum, - QuadraticWarmupParamScheduler) - -__all__ = [ - 'QuadraticWarmupParamScheduler', 'QuadraticWarmupMomentum', - 'QuadraticWarmupLR' -] diff --git a/spaces/KyanChen/RSPrompter/mmdet/models/detectors/faster_rcnn.py b/spaces/KyanChen/RSPrompter/mmdet/models/detectors/faster_rcnn.py deleted file mode 100644 index 36109e3200a2d8e7d8a1032f7028e47a7699fb6a..0000000000000000000000000000000000000000 --- a/spaces/KyanChen/RSPrompter/mmdet/models/detectors/faster_rcnn.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -from mmdet.registry import MODELS -from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig -from .two_stage import TwoStageDetector - - -@MODELS.register_module() -class FasterRCNN(TwoStageDetector): - """Implementation of `Faster R-CNN `_""" - - def __init__(self, - backbone: ConfigType, - rpn_head: ConfigType, - roi_head: ConfigType, - train_cfg: ConfigType, - test_cfg: ConfigType, - neck: OptConfigType = None, - data_preprocessor: OptConfigType = None, - init_cfg: OptMultiConfig = None) -> None: - super().__init__( - backbone=backbone, - neck=neck, - rpn_head=rpn_head, - roi_head=roi_head, - train_cfg=train_cfg, - test_cfg=test_cfg, - init_cfg=init_cfg, - data_preprocessor=data_preprocessor) diff --git a/spaces/LaynzKunz/Model-RCV/vc_infer_pipeline.py b/spaces/LaynzKunz/Model-RCV/vc_infer_pipeline.py deleted file mode 100644 index 167dc0d4ac25f75e0b1ce96cab5688b51b349ee7..0000000000000000000000000000000000000000 --- a/spaces/LaynzKunz/Model-RCV/vc_infer_pipeline.py +++ /dev/null @@ -1,443 +0,0 @@ -import numpy as np, parselmouth, torch, pdb, sys, os -from time import time as ttime -import torch.nn.functional as F -import scipy.signal as signal -import pyworld, os, traceback, faiss, librosa, torchcrepe -from scipy import signal -from functools import lru_cache - -now_dir = os.getcwd() -sys.path.append(now_dir) - -bh, ah = signal.butter(N=5, Wn=48, btype="high", fs=16000) - -input_audio_path2wav = {} - - -@lru_cache -def cache_harvest_f0(input_audio_path, fs, f0max, f0min, frame_period): - audio = input_audio_path2wav[input_audio_path] - f0, t = pyworld.harvest( - audio, - fs=fs, - f0_ceil=f0max, - f0_floor=f0min, - frame_period=frame_period, - ) - f0 = pyworld.stonemask(audio, f0, t, fs) - return f0 - - -def change_rms(data1, sr1, data2, sr2, rate): # 1是输入音频,2是输出音频,rate是2的占比 - # print(data1.max(),data2.max()) - rms1 = librosa.feature.rms( - y=data1, frame_length=sr1 // 2 * 2, hop_length=sr1 // 2 - ) # 每半秒一个点 - rms2 = librosa.feature.rms(y=data2, frame_length=sr2 // 2 * 2, hop_length=sr2 // 2) - rms1 = torch.from_numpy(rms1) - rms1 = F.interpolate( - rms1.unsqueeze(0), size=data2.shape[0], mode="linear" - ).squeeze() - rms2 = torch.from_numpy(rms2) - rms2 = F.interpolate( - rms2.unsqueeze(0), size=data2.shape[0], mode="linear" - ).squeeze() - rms2 = torch.max(rms2, torch.zeros_like(rms2) + 1e-6) - data2 *= ( - torch.pow(rms1, torch.tensor(1 - rate)) - * torch.pow(rms2, torch.tensor(rate - 1)) - ).numpy() - return data2 - - -class VC(object): - def __init__(self, tgt_sr, config): - self.x_pad, self.x_query, self.x_center, self.x_max, self.is_half = ( - config.x_pad, - config.x_query, - config.x_center, - config.x_max, - config.is_half, - ) - self.sr = 16000 # hubert输入采样率 - self.window = 160 # 每帧点数 - self.t_pad = self.sr * self.x_pad # 每条前后pad时间 - self.t_pad_tgt = tgt_sr * self.x_pad - self.t_pad2 = self.t_pad * 2 - self.t_query = self.sr * self.x_query # 查询切点前后查询时间 - self.t_center = self.sr * self.x_center # 查询切点位置 - self.t_max = self.sr * self.x_max # 免查询时长阈值 - self.device = config.device - - def get_f0( - self, - input_audio_path, - x, - p_len, - f0_up_key, - f0_method, - filter_radius, - inp_f0=None, - ): - global input_audio_path2wav - time_step = self.window / self.sr * 1000 - f0_min = 50 - f0_max = 1100 - f0_mel_min = 1127 * np.log(1 + f0_min / 700) - f0_mel_max = 1127 * np.log(1 + f0_max / 700) - if f0_method == "pm": - f0 = ( - parselmouth.Sound(x, self.sr) - .to_pitch_ac( - time_step=time_step / 1000, - voicing_threshold=0.6, - pitch_floor=f0_min, - pitch_ceiling=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" - ) - elif f0_method == "harvest": - input_audio_path2wav[input_audio_path] = x.astype(np.double) - f0 = cache_harvest_f0(input_audio_path, self.sr, f0_max, f0_min, 10) - if filter_radius > 2: - f0 = signal.medfilt(f0, 3) - elif f0_method == "crepe": - model = "full" - # Pick a batch size that doesn't cause memory errors on your gpu - batch_size = 512 - # Compute pitch using first gpu - audio = torch.tensor(np.copy(x))[None].float() - f0, pd = torchcrepe.predict( - audio, - self.sr, - self.window, - f0_min, - f0_max, - model, - batch_size=batch_size, - 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() - elif f0_method == "rmvpe": - if hasattr(self, "model_rmvpe") == False: - from rmvpe import RMVPE - - print("loading rmvpe model") - self.model_rmvpe = RMVPE( - "rmvpe.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) - # with open("test.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()])) - tf0 = self.sr // self.window # 每秒f0点数 - if inp_f0 is not None: - delta_t = np.round( - (inp_f0[:, 0].max() - inp_f0[:, 0].min()) * tf0 + 1 - ).astype("int16") - replace_f0 = np.interp( - list(range(delta_t)), inp_f0[:, 0] * 100, inp_f0[:, 1] - ) - shape = f0[self.x_pad * tf0 : self.x_pad * tf0 + len(replace_f0)].shape[0] - f0[self.x_pad * tf0 : self.x_pad * tf0 + len(replace_f0)] = replace_f0[ - :shape - ] - # with open("test_opt.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()])) - 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 # 1-0 - - def vc( - self, - model, - net_g, - sid, - audio0, - pitch, - pitchf, - times, - index, - big_npy, - index_rate, - version, - protect, - ): # ,file_index,file_big_npy - feats = torch.from_numpy(audio0) - if self.is_half: - feats = feats.half() - else: - feats = feats.float() - if feats.dim() == 2: # double channels - feats = feats.mean(-1) - assert feats.dim() == 1, feats.dim() - feats = feats.view(1, -1) - padding_mask = torch.BoolTensor(feats.shape).to(self.device).fill_(False) - - inputs = { - "source": feats.to(self.device), - "padding_mask": padding_mask, - "output_layer": 9 if version == "v1" else 12, - } - t0 = ttime() - with torch.no_grad(): - logits = model.extract_features(**inputs) - feats = model.final_proj(logits[0]) if version == "v1" else logits[0] - if protect < 0.5 and pitch != None and pitchf != None: - feats0 = feats.clone() - if ( - isinstance(index, type(None)) == False - and isinstance(big_npy, type(None)) == False - and index_rate != 0 - ): - npy = feats[0].cpu().numpy() - if self.is_half: - npy = npy.astype("float32") - - # _, I = index.search(npy, 1) - # npy = big_npy[I.squeeze()] - - score, ix = index.search(npy, k=8) - weight = np.square(1 / score) - weight /= weight.sum(axis=1, keepdims=True) - npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1) - - if self.is_half: - npy = npy.astype("float16") - feats = ( - torch.from_numpy(npy).unsqueeze(0).to(self.device) * index_rate - + (1 - index_rate) * feats - ) - - feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1) - if protect < 0.5 and pitch != None and pitchf != None: - feats0 = F.interpolate(feats0.permute(0, 2, 1), scale_factor=2).permute( - 0, 2, 1 - ) - t1 = ttime() - p_len = audio0.shape[0] // self.window - if feats.shape[1] < p_len: - p_len = feats.shape[1] - if pitch != None and pitchf != None: - pitch = pitch[:, :p_len] - pitchf = pitchf[:, :p_len] - - if protect < 0.5 and pitch != None and pitchf != None: - pitchff = pitchf.clone() - pitchff[pitchf > 0] = 1 - pitchff[pitchf < 1] = protect - pitchff = pitchff.unsqueeze(-1) - feats = feats * pitchff + feats0 * (1 - pitchff) - feats = feats.to(feats0.dtype) - p_len = torch.tensor([p_len], device=self.device).long() - with torch.no_grad(): - if pitch != None and pitchf != None: - audio1 = ( - (net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0]) - .data.cpu() - .float() - .numpy() - ) - else: - audio1 = ( - (net_g.infer(feats, p_len, sid)[0][0, 0]).data.cpu().float().numpy() - ) - del feats, p_len, padding_mask - if torch.cuda.is_available(): - torch.cuda.empty_cache() - t2 = ttime() - times[0] += t1 - t0 - times[2] += t2 - t1 - return audio1 - - def pipeline( - self, - model, - net_g, - sid, - audio, - input_audio_path, - times, - f0_up_key, - f0_method, - file_index, - # file_big_npy, - index_rate, - if_f0, - filter_radius, - tgt_sr, - resample_sr, - rms_mix_rate, - version, - protect, - f0_file=None, - ): - if ( - file_index != "" - # and file_big_npy != "" - # and os.path.exists(file_big_npy) == True - and os.path.exists(file_index) == True - and index_rate != 0 - ): - try: - index = faiss.read_index(file_index) - # big_npy = np.load(file_big_npy) - big_npy = index.reconstruct_n(0, index.ntotal) - except: - traceback.print_exc() - index = big_npy = None - else: - index = big_npy = None - audio = signal.filtfilt(bh, ah, audio) - audio_pad = np.pad(audio, (self.window // 2, self.window // 2), mode="reflect") - opt_ts = [] - if audio_pad.shape[0] > self.t_max: - audio_sum = np.zeros_like(audio) - for i in range(self.window): - audio_sum += audio_pad[i : i - self.window] - for t in range(self.t_center, audio.shape[0], self.t_center): - opt_ts.append( - t - - self.t_query - + np.where( - np.abs(audio_sum[t - self.t_query : t + self.t_query]) - == np.abs(audio_sum[t - self.t_query : t + self.t_query]).min() - )[0][0] - ) - s = 0 - audio_opt = [] - t = None - t1 = ttime() - audio_pad = np.pad(audio, (self.t_pad, self.t_pad), mode="reflect") - p_len = audio_pad.shape[0] // self.window - inp_f0 = None - if hasattr(f0_file, "name") == True: - try: - with open(f0_file.name, "r") as f: - lines = f.read().strip("\n").split("\n") - inp_f0 = [] - for line in lines: - inp_f0.append([float(i) for i in line.split(",")]) - inp_f0 = np.array(inp_f0, dtype="float32") - except: - traceback.print_exc() - sid = torch.tensor(sid, device=self.device).unsqueeze(0).long() - pitch, pitchf = None, None - if if_f0 == 1: - pitch, pitchf = self.get_f0( - input_audio_path, - audio_pad, - p_len, - f0_up_key, - f0_method, - filter_radius, - inp_f0, - ) - pitch = pitch[:p_len] - pitchf = pitchf[:p_len] - if self.device == "mps": - pitchf = pitchf.astype(np.float32) - pitch = torch.tensor(pitch, device=self.device).unsqueeze(0).long() - pitchf = torch.tensor(pitchf, device=self.device).unsqueeze(0).float() - t2 = ttime() - times[1] += t2 - t1 - for t in opt_ts: - t = t // self.window * self.window - if if_f0 == 1: - audio_opt.append( - self.vc( - model, - net_g, - sid, - audio_pad[s : t + self.t_pad2 + self.window], - pitch[:, s // self.window : (t + self.t_pad2) // self.window], - pitchf[:, s // self.window : (t + self.t_pad2) // self.window], - times, - index, - big_npy, - index_rate, - version, - protect, - )[self.t_pad_tgt : -self.t_pad_tgt] - ) - else: - audio_opt.append( - self.vc( - model, - net_g, - sid, - audio_pad[s : t + self.t_pad2 + self.window], - None, - None, - times, - index, - big_npy, - index_rate, - version, - protect, - )[self.t_pad_tgt : -self.t_pad_tgt] - ) - s = t - if if_f0 == 1: - audio_opt.append( - self.vc( - model, - net_g, - sid, - audio_pad[t:], - pitch[:, t // self.window :] if t is not None else pitch, - pitchf[:, t // self.window :] if t is not None else pitchf, - times, - index, - big_npy, - index_rate, - version, - protect, - )[self.t_pad_tgt : -self.t_pad_tgt] - ) - else: - audio_opt.append( - self.vc( - model, - net_g, - sid, - audio_pad[t:], - None, - None, - times, - index, - big_npy, - index_rate, - version, - protect, - )[self.t_pad_tgt : -self.t_pad_tgt] - ) - audio_opt = np.concatenate(audio_opt) - if rms_mix_rate != 1: - audio_opt = change_rms(audio, 16000, audio_opt, tgt_sr, rms_mix_rate) - if resample_sr >= 16000 and tgt_sr != resample_sr: - audio_opt = librosa.resample( - audio_opt, orig_sr=tgt_sr, target_sr=resample_sr - ) - audio_max = np.abs(audio_opt).max() / 0.99 - max_int16 = 32768 - if audio_max > 1: - max_int16 /= audio_max - audio_opt = (audio_opt * max_int16).astype(np.int16) - del pitch, pitchf, sid - if torch.cuda.is_available(): - torch.cuda.empty_cache() - return audio_opt \ No newline at end of file diff --git a/spaces/LeeroyVonJenkins/hard-hat-detection/README.md b/spaces/LeeroyVonJenkins/hard-hat-detection/README.md deleted file mode 100644 index 3191a36ab7677823a09aae4ae68d64d268db4200..0000000000000000000000000000000000000000 --- a/spaces/LeeroyVonJenkins/hard-hat-detection/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Hard Hat Detection -emoji: ⚡ -colorFrom: purple -colorTo: indigo -sdk: gradio -sdk_version: 3.18.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/LeoLeoLeo1/ChuanhuChatGPT/chatgpt - macOS.command b/spaces/LeoLeoLeo1/ChuanhuChatGPT/chatgpt - macOS.command deleted file mode 100644 index fa015edca9e6916f24394813ce8ba77d2072e296..0000000000000000000000000000000000000000 --- a/spaces/LeoLeoLeo1/ChuanhuChatGPT/chatgpt - macOS.command +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -echo Opening ChuanhuChatGPT... -cd "$(dirname "${BASH_SOURCE[0]}")" -nohup python3 ChuanhuChatbot.py >/dev/null 2>&1 & -sleep 5 -open http://127.0.0.1:7860 -echo Finished opening ChuanhuChatGPT (http://127.0.0.1:7860/). If you kill ChuanhuChatbot, Use "pkill -f 'ChuanhuChatbot'" command in terminal. \ No newline at end of file diff --git a/spaces/Lianjd/stock_dashboard/backtrader/studies/contrib/fractal.py b/spaces/Lianjd/stock_dashboard/backtrader/studies/contrib/fractal.py deleted file mode 100644 index c18714236ff1cecb4e1966d466073e1e5476d614..0000000000000000000000000000000000000000 --- a/spaces/Lianjd/stock_dashboard/backtrader/studies/contrib/fractal.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8; py-indent-offset:4 -*- - -############################################################################### -# -# Copyright (C) 2015-2020 Daniel Rodriguez -# (based on backtrader from Daniel Rodriguez) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################### - -import backtrader as bt - - -__all__ = ['Fractal'] - - -class Fractal(bt.ind.PeriodN): - ''' - References: - [Ref 1] http://www.investopedia.com/articles/trading/06/fractals.asp - - ''' - lines = ('fractal_bearish', 'fractal_bullish') - - plotinfo = dict(subplot=False, plotlinelabels=False, plot=True) - - plotlines = dict( - fractal_bearish=dict(marker='^', markersize=4.0, color='lightblue', - fillstyle='full', ls=''), - fractal_bullish=dict(marker='v', markersize=4.0, color='lightblue', - fillstyle='full', ls='') - ) - params = ( - ('period', 5), - ('bardist', 0.015), # distance to max/min in absolute perc - ('shift_to_potential_fractal', 2), - ) - - def next(self): - # A bearish turning point occurs when there is a pattern with the - # highest high in the middle and two lower highs on each side. [Ref 1] - - last_five_highs = self.data.high.get(size=self.p.period) - max_val = max(last_five_highs) - max_idx = last_five_highs.index(max_val) - - if max_idx == self.p.shift_to_potential_fractal: - self.lines.fractal_bearish[-2] = max_val * (1 + self.p.bardist) - - # A bullish turning point occurs when there is a pattern with the - # lowest low in the middle and two higher lowers on each side. [Ref 1] - last_five_lows = self.data.low.get(size=self.p.period) - min_val = min(last_five_lows) - min_idx = last_five_lows.index(min_val) - - if min_idx == self.p.shift_to_potential_fractal: - self.l.fractal_bullish[-2] = min_val * (1 - self.p.bardist) diff --git a/spaces/LuxOAI/ChatGpt-Web/app/global.d.ts b/spaces/LuxOAI/ChatGpt-Web/app/global.d.ts deleted file mode 100644 index bd1c062def60f16d3eaa34560dd27408df851ec8..0000000000000000000000000000000000000000 --- a/spaces/LuxOAI/ChatGpt-Web/app/global.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.woff2"; -declare module "*.woff"; -declare module "*.ttf"; -declare module "*.scss" { - const content: Record; - export default content; -} - -declare module "*.svg"; diff --git a/spaces/MKFMIKU/Bi-Noising.Diffusion/app.py b/spaces/MKFMIKU/Bi-Noising.Diffusion/app.py deleted file mode 100644 index 0f9b2d4d265f93b17ed29962925616186cd25ed1..0000000000000000000000000000000000000000 --- a/spaces/MKFMIKU/Bi-Noising.Diffusion/app.py +++ /dev/null @@ -1,82 +0,0 @@ -import gradio as gr -import os -import torch -from diffusion import DiffusionPipeline - -auth_token = os.environ.get("API_TOKEN") or True - -device = "cuda" if torch.cuda.is_available() else "cpu" - -pipe = DiffusionPipeline(device) - -def predict(input, diffusion_step, binoising_step, grid_size): - for output in pipe(input, diffusion_step, binoising_step, grid_size): - yield output[0], output[1] - -def read_content(file_path: str) -> str: - """read the content of target file - """ - with open(file_path, 'r', encoding='utf-8') as f: - content = f.read() - - return content - - -css = ''' -.container {max-width: 1150px;margin: auto;padding-top: 1.5rem} -#image_upload{min-height:256px} -#image_upload [data-testid="image"], #image_upload [data-testid="image"] > div{min-height: 256px} -#mask_radio .gr-form{background:transparent; border: none} -#word_mask{margin-top: .75em !important} -#word_mask textarea:disabled{opacity: 0.3} -.footer {margin-bottom: 45px;margin-top: 35px;text-align: center;border-bottom: 1px solid #e5e5e5} -.footer>p {font-size: .8rem; display: inline-block; padding: 0 10px;transform: translateY(10px);background: white} -.dark .footer {border-color: #303030} -.dark .footer>p {background: #0b0f19} -.acknowledgments h4{margin: 1.25em 0 .25em 0;font-weight: bold;font-size: 115%} -#image_upload .touch-none{display: flex} -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} -''' - -image_blocks = gr.Blocks(css=css) -with image_blocks as demo: - gr.HTML(read_content("header.html")) - with gr.Group(): - with gr.Box(): - with gr.Row(): - with gr.Column(): - image = gr.Image(source='upload', elem_id="image_upload", type="pil", image_mode="L", label="Gray Image").style(height=256) - - diffusion_step = gr.Slider(minimum=10, maximum=200, step=5, value=50, label="Diffusion Time Step") - binoising_step = gr.Slider(minimum=1, maximum=50, step=1, value=50, label="Bi-Noising Start Step") - grid_size = gr.Slider(minimum=1, maximum=16, step=1, value=2, label="Grid Size") - - with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True): - btn = gr.Button("Colorization").style( - margin=False, - full_width=True, - ) - with gr.Column(): - diffusion_result = gr.Image(elem_id="output-simg", label="Diffusion Result").style(height=256) - bidiffusion_result = gr.Image(elem_id="output-bimg", label="Bi-Noising Diffsuion Result").style(height=256) - - # with gr.Column(): - - - with gr.Row(): - gr.Examples(examples=[ - 'examples/00015.jpg', - 'examples/00065.jpg' - ], inputs=[image]) - - btn.click(fn=predict, inputs=[image, diffusion_step, binoising_step, grid_size], outputs=[diffusion_result, bidiffusion_result]) - -image_blocks.queue() -image_blocks.launch(enable_queue=True, share=False, debug=False) diff --git a/spaces/MMYang/microsoft-BioGPT-Large/app.py b/spaces/MMYang/microsoft-BioGPT-Large/app.py deleted file mode 100644 index fc639d08afd8af5d583dfded7b1b1a6384f6e7dc..0000000000000000000000000000000000000000 --- a/spaces/MMYang/microsoft-BioGPT-Large/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/microsoft/BioGPT-Large").launch() \ No newline at end of file diff --git a/spaces/Madhes/GradioLangChainBota/README.md b/spaces/Madhes/GradioLangChainBota/README.md deleted file mode 100644 index 97dc0b004b2cc48300ca53c617792458e03402c9..0000000000000000000000000000000000000000 --- a/spaces/Madhes/GradioLangChainBota/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: GradioLangChainBota -emoji: 😻 -colorFrom: yellow -colorTo: gray -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/Manjushri/MusicGen/tests/modules/test_conv.py b/spaces/Manjushri/MusicGen/tests/modules/test_conv.py deleted file mode 100644 index 28fbc4f1a0ebaf41b56947b767958ae696e75eec..0000000000000000000000000000000000000000 --- a/spaces/Manjushri/MusicGen/tests/modules/test_conv.py +++ /dev/null @@ -1,203 +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. - -from itertools import product -import math -import random - -import pytest -import torch -from torch import nn - -from audiocraft.modules import ( - NormConv1d, - NormConvTranspose1d, - StreamableConv1d, - StreamableConvTranspose1d, - pad1d, - unpad1d, -) - - -def test_get_extra_padding_for_conv1d(): - # TODO: Implement me! - pass - - -def test_pad1d_zeros(): - x = torch.randn(1, 1, 20) - - xp1 = pad1d(x, (0, 5), mode='constant', value=0.) - assert xp1.shape[-1] == 25 - xp2 = pad1d(x, (5, 5), mode='constant', value=0.) - assert xp2.shape[-1] == 30 - xp3 = pad1d(x, (0, 0), mode='constant', value=0.) - assert xp3.shape[-1] == 20 - xp4 = pad1d(x, (10, 30), mode='constant', value=0.) - assert xp4.shape[-1] == 60 - - with pytest.raises(AssertionError): - pad1d(x, (-1, 0), mode='constant', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (0, -1), mode='constant', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (-1, -1), mode='constant', value=0.) - - -def test_pad1d_reflect(): - x = torch.randn(1, 1, 20) - - xp1 = pad1d(x, (0, 5), mode='reflect', value=0.) - assert xp1.shape[-1] == 25 - xp2 = pad1d(x, (5, 5), mode='reflect', value=0.) - assert xp2.shape[-1] == 30 - xp3 = pad1d(x, (0, 0), mode='reflect', value=0.) - assert xp3.shape[-1] == 20 - xp4 = pad1d(x, (10, 30), mode='reflect', value=0.) - assert xp4.shape[-1] == 60 - - with pytest.raises(AssertionError): - pad1d(x, (-1, 0), mode='reflect', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (0, -1), mode='reflect', value=0.) - - with pytest.raises(AssertionError): - pad1d(x, (-1, -1), mode='reflect', value=0.) - - -def test_unpad1d(): - x = torch.randn(1, 1, 20) - - u1 = unpad1d(x, (5, 5)) - assert u1.shape[-1] == 10 - u2 = unpad1d(x, (0, 5)) - assert u2.shape[-1] == 15 - u3 = unpad1d(x, (5, 0)) - assert u3.shape[-1] == 15 - u4 = unpad1d(x, (0, 0)) - assert u4.shape[-1] == x.shape[-1] - - with pytest.raises(AssertionError): - unpad1d(x, (-1, 0)) - - with pytest.raises(AssertionError): - unpad1d(x, (0, -1)) - - with pytest.raises(AssertionError): - unpad1d(x, (-1, -1)) - - -class TestNormConv1d: - - def test_norm_conv1d_modules(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - - C_out, kernel_size, stride = 1, 4, 1 - expected_out_length = int((T - kernel_size) / stride + 1) - wn_conv = NormConv1d(C, 1, kernel_size=4, norm='weight_norm') - gn_conv = NormConv1d(C, 1, kernel_size=4, norm='time_group_norm') - nn_conv = NormConv1d(C, 1, kernel_size=4, norm='none') - - assert isinstance(wn_conv.norm, nn.Identity) - assert isinstance(wn_conv.conv, nn.Conv1d) - - assert isinstance(gn_conv.norm, nn.GroupNorm) - assert isinstance(gn_conv.conv, nn.Conv1d) - - assert isinstance(nn_conv.norm, nn.Identity) - assert isinstance(nn_conv.conv, nn.Conv1d) - - for conv_layer in [wn_conv, gn_conv, nn_conv]: - out = conv_layer(t0) - assert isinstance(out, torch.Tensor) - assert list(out.shape) == [N, C_out, expected_out_length] - - -class TestNormConvTranspose1d: - - def test_normalizations(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - - C_out, kernel_size, stride = 1, 4, 1 - expected_out_length = (T - 1) * stride + (kernel_size - 1) + 1 - - wn_convtr = NormConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, norm='weight_norm') - gn_convtr = NormConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, norm='time_group_norm') - nn_convtr = NormConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, norm='none') - - assert isinstance(wn_convtr.norm, nn.Identity) - assert isinstance(wn_convtr.convtr, nn.ConvTranspose1d) - - assert isinstance(gn_convtr.norm, nn.GroupNorm) - assert isinstance(gn_convtr.convtr, nn.ConvTranspose1d) - - assert isinstance(nn_convtr.norm, nn.Identity) - assert isinstance(nn_convtr.convtr, nn.ConvTranspose1d) - - for convtr_layer in [wn_convtr, gn_convtr, nn_convtr]: - out = convtr_layer(t0) - assert isinstance(out, torch.Tensor) - assert list(out.shape) == [N, C_out, expected_out_length] - - -class TestStreamableConv1d: - - def get_streamable_conv1d_output_length(self, length, kernel_size, stride, dilation): - # StreamableConv1d internally pads to make sure that the last window is full - padding_total = (kernel_size - 1) * dilation - (stride - 1) - n_frames = (length - kernel_size + padding_total) / stride + 1 - ideal_length = (math.ceil(n_frames) - 1) * stride + (kernel_size - padding_total) - return ideal_length // stride - - def test_streamable_conv1d(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - C_out = 1 - - # conv params are [(kernel_size, stride, dilation)] - conv_params = [(4, 1, 1), (4, 2, 1), (3, 1, 3), (10, 5, 1), (3, 2, 3)] - for causal, (kernel_size, stride, dilation) in product([False, True], conv_params): - expected_out_length = self.get_streamable_conv1d_output_length(T, kernel_size, stride, dilation) - sconv = StreamableConv1d(C, C_out, kernel_size=kernel_size, stride=stride, dilation=dilation, causal=causal) - out = sconv(t0) - assert isinstance(out, torch.Tensor) - print(list(out.shape), [N, C_out, expected_out_length]) - assert list(out.shape) == [N, C_out, expected_out_length] - - -class TestStreamableConvTranspose1d: - - def get_streamable_convtr1d_output_length(self, length, kernel_size, stride): - padding_total = (kernel_size - stride) - return (length - 1) * stride - padding_total + (kernel_size - 1) + 1 - - def test_streamable_convtr1d(self): - N, C, T = 2, 2, random.randrange(1, 100_000) - t0 = torch.randn(N, C, T) - - C_out = 1 - - with pytest.raises(AssertionError): - StreamableConvTranspose1d(C, C_out, kernel_size=4, causal=False, trim_right_ratio=0.5) - StreamableConvTranspose1d(C, C_out, kernel_size=4, causal=True, trim_right_ratio=-1.) - StreamableConvTranspose1d(C, C_out, kernel_size=4, causal=True, trim_right_ratio=2) - - # causal params are [(causal, trim_right)] - causal_params = [(False, 1.0), (True, 1.0), (True, 0.5), (True, 0.0)] - # conv params are [(kernel_size, stride)] - conv_params = [(4, 1), (4, 2), (3, 1), (10, 5)] - for ((causal, trim_right_ratio), (kernel_size, stride)) in product(causal_params, conv_params): - expected_out_length = self.get_streamable_convtr1d_output_length(T, kernel_size, stride) - sconvtr = StreamableConvTranspose1d(C, C_out, kernel_size=kernel_size, stride=stride, - causal=causal, trim_right_ratio=trim_right_ratio) - out = sconvtr(t0) - assert isinstance(out, torch.Tensor) - assert list(out.shape) == [N, C_out, expected_out_length] diff --git a/spaces/MashiroSA/sovits-emu-voice-transform/inference/__init__.py b/spaces/MashiroSA/sovits-emu-voice-transform/inference/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Meena/table-question-answering-space/app/__init__.py b/spaces/Meena/table-question-answering-space/app/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmcv/ops/pixel_group.py b/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmcv/ops/pixel_group.py deleted file mode 100644 index 2143c75f835a467c802fc3c37ecd3ac0f85bcda4..0000000000000000000000000000000000000000 --- a/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmcv/ops/pixel_group.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import numpy as np -import torch - -from ..utils import ext_loader - -ext_module = ext_loader.load_ext('_ext', ['pixel_group']) - - -def pixel_group(score, mask, embedding, kernel_label, kernel_contour, - kernel_region_num, distance_threshold): - """Group pixels into text instances, which is widely used text detection - methods. - - Arguments: - score (np.array or Tensor): The foreground score with size hxw. - mask (np.array or Tensor): The foreground mask with size hxw. - embedding (np.array or Tensor): The embedding with size hxwxc to - distinguish instances. - kernel_label (np.array or Tensor): The instance kernel index with - size hxw. - kernel_contour (np.array or Tensor): The kernel contour with size hxw. - kernel_region_num (int): The instance kernel region number. - distance_threshold (float): The embedding distance threshold between - kernel and pixel in one instance. - - Returns: - pixel_assignment (List[List[float]]): The instance coordinate list. - Each element consists of averaged confidence, pixel number, and - coordinates (x_i, y_i for all pixels) in order. - """ - assert isinstance(score, (torch.Tensor, np.ndarray)) - assert isinstance(mask, (torch.Tensor, np.ndarray)) - assert isinstance(embedding, (torch.Tensor, np.ndarray)) - assert isinstance(kernel_label, (torch.Tensor, np.ndarray)) - assert isinstance(kernel_contour, (torch.Tensor, np.ndarray)) - assert isinstance(kernel_region_num, int) - assert isinstance(distance_threshold, float) - - if isinstance(score, np.ndarray): - score = torch.from_numpy(score) - if isinstance(mask, np.ndarray): - mask = torch.from_numpy(mask) - if isinstance(embedding, np.ndarray): - embedding = torch.from_numpy(embedding) - if isinstance(kernel_label, np.ndarray): - kernel_label = torch.from_numpy(kernel_label) - if isinstance(kernel_contour, np.ndarray): - kernel_contour = torch.from_numpy(kernel_contour) - - if torch.__version__ == 'parrots': - label = ext_module.pixel_group( - score, - mask, - embedding, - kernel_label, - kernel_contour, - kernel_region_num=kernel_region_num, - distance_threshold=distance_threshold) - label = label.tolist() - label = label[0] - list_index = kernel_region_num - pixel_assignment = [] - for x in range(kernel_region_num): - pixel_assignment.append( - np.array( - label[list_index:list_index + int(label[x])], - dtype=np.float)) - list_index = list_index + int(label[x]) - else: - pixel_assignment = ext_module.pixel_group(score, mask, embedding, - kernel_label, kernel_contour, - kernel_region_num, - distance_threshold) - return pixel_assignment diff --git a/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmcv/runner/hooks/momentum_updater.py b/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmcv/runner/hooks/momentum_updater.py deleted file mode 100644 index 60437756ceedf06055ec349df69a25465738d3f0..0000000000000000000000000000000000000000 --- a/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmcv/runner/hooks/momentum_updater.py +++ /dev/null @@ -1,493 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import annotator.uniformer.mmcv as mmcv -from .hook import HOOKS, Hook -from .lr_updater import annealing_cos, annealing_linear, format_param - - -class MomentumUpdaterHook(Hook): - - def __init__(self, - by_epoch=True, - warmup=None, - warmup_iters=0, - warmup_ratio=0.9): - # validate the "warmup" argument - if warmup is not None: - if warmup not in ['constant', 'linear', 'exp']: - raise ValueError( - f'"{warmup}" is not a supported type for warming up, valid' - ' types are "constant" and "linear"') - if warmup is not None: - assert warmup_iters > 0, \ - '"warmup_iters" must be a positive integer' - assert 0 < warmup_ratio <= 1.0, \ - '"warmup_momentum" must be in range (0,1]' - - self.by_epoch = by_epoch - self.warmup = warmup - self.warmup_iters = warmup_iters - self.warmup_ratio = warmup_ratio - - self.base_momentum = [] # initial momentum for all param groups - self.regular_momentum = [ - ] # expected momentum if no warming up is performed - - def _set_momentum(self, runner, momentum_groups): - if isinstance(runner.optimizer, dict): - for k, optim in runner.optimizer.items(): - for param_group, mom in zip(optim.param_groups, - momentum_groups[k]): - if 'momentum' in param_group.keys(): - param_group['momentum'] = mom - elif 'betas' in param_group.keys(): - param_group['betas'] = (mom, param_group['betas'][1]) - else: - for param_group, mom in zip(runner.optimizer.param_groups, - momentum_groups): - if 'momentum' in param_group.keys(): - param_group['momentum'] = mom - elif 'betas' in param_group.keys(): - param_group['betas'] = (mom, param_group['betas'][1]) - - def get_momentum(self, runner, base_momentum): - raise NotImplementedError - - def get_regular_momentum(self, runner): - if isinstance(runner.optimizer, dict): - momentum_groups = {} - for k in runner.optimizer.keys(): - _momentum_group = [ - self.get_momentum(runner, _base_momentum) - for _base_momentum in self.base_momentum[k] - ] - momentum_groups.update({k: _momentum_group}) - return momentum_groups - else: - return [ - self.get_momentum(runner, _base_momentum) - for _base_momentum in self.base_momentum - ] - - def get_warmup_momentum(self, cur_iters): - - def _get_warmup_momentum(cur_iters, regular_momentum): - if self.warmup == 'constant': - warmup_momentum = [ - _momentum / self.warmup_ratio - for _momentum in self.regular_momentum - ] - elif self.warmup == 'linear': - k = (1 - cur_iters / self.warmup_iters) * (1 - - self.warmup_ratio) - warmup_momentum = [ - _momentum / (1 - k) for _momentum in self.regular_mom - ] - elif self.warmup == 'exp': - k = self.warmup_ratio**(1 - cur_iters / self.warmup_iters) - warmup_momentum = [ - _momentum / k for _momentum in self.regular_mom - ] - return warmup_momentum - - if isinstance(self.regular_momentum, dict): - momentum_groups = {} - for key, regular_momentum in self.regular_momentum.items(): - momentum_groups[key] = _get_warmup_momentum( - cur_iters, regular_momentum) - return momentum_groups - else: - return _get_warmup_momentum(cur_iters, self.regular_momentum) - - def before_run(self, runner): - # NOTE: when resuming from a checkpoint, - # if 'initial_momentum' is not saved, - # it will be set according to the optimizer params - if isinstance(runner.optimizer, dict): - self.base_momentum = {} - for k, optim in runner.optimizer.items(): - for group in optim.param_groups: - if 'momentum' in group.keys(): - group.setdefault('initial_momentum', group['momentum']) - else: - group.setdefault('initial_momentum', group['betas'][0]) - _base_momentum = [ - group['initial_momentum'] for group in optim.param_groups - ] - self.base_momentum.update({k: _base_momentum}) - else: - for group in runner.optimizer.param_groups: - if 'momentum' in group.keys(): - group.setdefault('initial_momentum', group['momentum']) - else: - group.setdefault('initial_momentum', group['betas'][0]) - self.base_momentum = [ - group['initial_momentum'] - for group in runner.optimizer.param_groups - ] - - def before_train_epoch(self, runner): - if not self.by_epoch: - return - self.regular_mom = self.get_regular_momentum(runner) - self._set_momentum(runner, self.regular_mom) - - def before_train_iter(self, runner): - cur_iter = runner.iter - if not self.by_epoch: - self.regular_mom = self.get_regular_momentum(runner) - if self.warmup is None or cur_iter >= self.warmup_iters: - self._set_momentum(runner, self.regular_mom) - else: - warmup_momentum = self.get_warmup_momentum(cur_iter) - self._set_momentum(runner, warmup_momentum) - elif self.by_epoch: - if self.warmup is None or cur_iter > self.warmup_iters: - return - elif cur_iter == self.warmup_iters: - self._set_momentum(runner, self.regular_mom) - else: - warmup_momentum = self.get_warmup_momentum(cur_iter) - self._set_momentum(runner, warmup_momentum) - - -@HOOKS.register_module() -class StepMomentumUpdaterHook(MomentumUpdaterHook): - """Step momentum scheduler with min value clipping. - - Args: - step (int | list[int]): Step to decay the momentum. If an int value is - given, regard it as the decay interval. If a list is given, decay - momentum at these steps. - gamma (float, optional): Decay momentum ratio. Default: 0.5. - min_momentum (float, optional): Minimum momentum value to keep. If - momentum after decay is lower than this value, it will be clipped - accordingly. If None is given, we don't perform lr clipping. - Default: None. - """ - - def __init__(self, step, gamma=0.5, min_momentum=None, **kwargs): - if isinstance(step, list): - assert mmcv.is_list_of(step, int) - assert all([s > 0 for s in step]) - elif isinstance(step, int): - assert step > 0 - else: - raise TypeError('"step" must be a list or integer') - self.step = step - self.gamma = gamma - self.min_momentum = min_momentum - super(StepMomentumUpdaterHook, self).__init__(**kwargs) - - def get_momentum(self, runner, base_momentum): - progress = runner.epoch if self.by_epoch else runner.iter - - # calculate exponential term - if isinstance(self.step, int): - exp = progress // self.step - else: - exp = len(self.step) - for i, s in enumerate(self.step): - if progress < s: - exp = i - break - - momentum = base_momentum * (self.gamma**exp) - if self.min_momentum is not None: - # clip to a minimum value - momentum = max(momentum, self.min_momentum) - return momentum - - -@HOOKS.register_module() -class CosineAnnealingMomentumUpdaterHook(MomentumUpdaterHook): - - def __init__(self, min_momentum=None, min_momentum_ratio=None, **kwargs): - assert (min_momentum is None) ^ (min_momentum_ratio is None) - self.min_momentum = min_momentum - self.min_momentum_ratio = min_momentum_ratio - super(CosineAnnealingMomentumUpdaterHook, self).__init__(**kwargs) - - def get_momentum(self, runner, base_momentum): - if self.by_epoch: - progress = runner.epoch - max_progress = runner.max_epochs - else: - progress = runner.iter - max_progress = runner.max_iters - if self.min_momentum_ratio is not None: - target_momentum = base_momentum * self.min_momentum_ratio - else: - target_momentum = self.min_momentum - return annealing_cos(base_momentum, target_momentum, - progress / max_progress) - - -@HOOKS.register_module() -class CyclicMomentumUpdaterHook(MomentumUpdaterHook): - """Cyclic momentum Scheduler. - - Implement the cyclical momentum scheduler policy described in - https://arxiv.org/pdf/1708.07120.pdf - - This momentum scheduler usually used together with the CyclicLRUpdater - to improve the performance in the 3D detection area. - - Attributes: - target_ratio (tuple[float]): Relative ratio of the lowest momentum and - the highest momentum to the initial momentum. - cyclic_times (int): Number of cycles during training - step_ratio_up (float): The ratio of the increasing process of momentum - in the total cycle. - by_epoch (bool): Whether to update momentum by epoch. - """ - - def __init__(self, - by_epoch=False, - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, - **kwargs): - if isinstance(target_ratio, float): - target_ratio = (target_ratio, target_ratio / 1e5) - elif isinstance(target_ratio, tuple): - target_ratio = (target_ratio[0], target_ratio[0] / 1e5) \ - if len(target_ratio) == 1 else target_ratio - else: - raise ValueError('target_ratio should be either float ' - f'or tuple, got {type(target_ratio)}') - - assert len(target_ratio) == 2, \ - '"target_ratio" must be list or tuple of two floats' - assert 0 <= step_ratio_up < 1.0, \ - '"step_ratio_up" must be in range [0,1)' - - self.target_ratio = target_ratio - self.cyclic_times = cyclic_times - self.step_ratio_up = step_ratio_up - self.momentum_phases = [] # init momentum_phases - # currently only support by_epoch=False - assert not by_epoch, \ - 'currently only support "by_epoch" = False' - super(CyclicMomentumUpdaterHook, self).__init__(by_epoch, **kwargs) - - def before_run(self, runner): - super(CyclicMomentumUpdaterHook, self).before_run(runner) - # initiate momentum_phases - # total momentum_phases are separated as up and down - max_iter_per_phase = runner.max_iters // self.cyclic_times - iter_up_phase = int(self.step_ratio_up * max_iter_per_phase) - self.momentum_phases.append( - [0, iter_up_phase, max_iter_per_phase, 1, self.target_ratio[0]]) - self.momentum_phases.append([ - iter_up_phase, max_iter_per_phase, max_iter_per_phase, - self.target_ratio[0], self.target_ratio[1] - ]) - - def get_momentum(self, runner, base_momentum): - curr_iter = runner.iter - for (start_iter, end_iter, max_iter_per_phase, start_ratio, - end_ratio) in self.momentum_phases: - curr_iter %= max_iter_per_phase - if start_iter <= curr_iter < end_iter: - progress = curr_iter - start_iter - return annealing_cos(base_momentum * start_ratio, - base_momentum * end_ratio, - progress / (end_iter - start_iter)) - - -@HOOKS.register_module() -class OneCycleMomentumUpdaterHook(MomentumUpdaterHook): - """OneCycle momentum Scheduler. - - This momentum scheduler usually used together with the OneCycleLrUpdater - to improve the performance. - - Args: - base_momentum (float or list): Lower momentum boundaries in the cycle - for each parameter group. Note that momentum is cycled inversely - to learning rate; at the peak of a cycle, momentum is - 'base_momentum' and learning rate is 'max_lr'. - Default: 0.85 - max_momentum (float or list): Upper momentum boundaries in the cycle - for each parameter group. Functionally, - it defines the cycle amplitude (max_momentum - base_momentum). - Note that momentum is cycled inversely - to learning rate; at the start of a cycle, momentum is - 'max_momentum' and learning rate is 'base_lr' - Default: 0.95 - pct_start (float): The percentage of the cycle (in number of steps) - spent increasing the learning rate. - Default: 0.3 - anneal_strategy (str): {'cos', 'linear'} - Specifies the annealing strategy: 'cos' for cosine annealing, - 'linear' for linear annealing. - Default: 'cos' - three_phase (bool): If three_phase is True, use a third phase of the - schedule to annihilate the learning rate according to - final_div_factor instead of modifying the second phase (the first - two phases will be symmetrical about the step indicated by - pct_start). - Default: False - """ - - def __init__(self, - base_momentum=0.85, - max_momentum=0.95, - pct_start=0.3, - anneal_strategy='cos', - three_phase=False, - **kwargs): - # validate by_epoch, currently only support by_epoch=False - if 'by_epoch' not in kwargs: - kwargs['by_epoch'] = False - else: - assert not kwargs['by_epoch'], \ - 'currently only support "by_epoch" = False' - if not isinstance(base_momentum, (float, list, dict)): - raise ValueError('base_momentum must be the type among of float,' - 'list or dict.') - self._base_momentum = base_momentum - if not isinstance(max_momentum, (float, list, dict)): - raise ValueError('max_momentum must be the type among of float,' - 'list or dict.') - self._max_momentum = max_momentum - # validate pct_start - if pct_start < 0 or pct_start > 1 or not isinstance(pct_start, float): - raise ValueError('Expected float between 0 and 1 pct_start, but ' - f'got {pct_start}') - self.pct_start = pct_start - # validate anneal_strategy - if anneal_strategy not in ['cos', 'linear']: - raise ValueError('anneal_strategy must by one of "cos" or ' - f'"linear", instead got {anneal_strategy}') - elif anneal_strategy == 'cos': - self.anneal_func = annealing_cos - elif anneal_strategy == 'linear': - self.anneal_func = annealing_linear - self.three_phase = three_phase - self.momentum_phases = [] # init momentum_phases - super(OneCycleMomentumUpdaterHook, self).__init__(**kwargs) - - def before_run(self, runner): - if isinstance(runner.optimizer, dict): - for k, optim in runner.optimizer.items(): - if ('momentum' not in optim.defaults - and 'betas' not in optim.defaults): - raise ValueError('optimizer must support momentum with' - 'option enabled') - self.use_beta1 = 'betas' in optim.defaults - _base_momentum = format_param(k, optim, self._base_momentum) - _max_momentum = format_param(k, optim, self._max_momentum) - for group, b_momentum, m_momentum in zip( - optim.param_groups, _base_momentum, _max_momentum): - if self.use_beta1: - _, beta2 = group['betas'] - group['betas'] = (m_momentum, beta2) - else: - group['momentum'] = m_momentum - group['base_momentum'] = b_momentum - group['max_momentum'] = m_momentum - else: - optim = runner.optimizer - if ('momentum' not in optim.defaults - and 'betas' not in optim.defaults): - raise ValueError('optimizer must support momentum with' - 'option enabled') - self.use_beta1 = 'betas' in optim.defaults - k = type(optim).__name__ - _base_momentum = format_param(k, optim, self._base_momentum) - _max_momentum = format_param(k, optim, self._max_momentum) - for group, b_momentum, m_momentum in zip(optim.param_groups, - _base_momentum, - _max_momentum): - if self.use_beta1: - _, beta2 = group['betas'] - group['betas'] = (m_momentum, beta2) - else: - group['momentum'] = m_momentum - group['base_momentum'] = b_momentum - group['max_momentum'] = m_momentum - - if self.three_phase: - self.momentum_phases.append({ - 'end_iter': - float(self.pct_start * runner.max_iters) - 1, - 'start_momentum': - 'max_momentum', - 'end_momentum': - 'base_momentum' - }) - self.momentum_phases.append({ - 'end_iter': - float(2 * self.pct_start * runner.max_iters) - 2, - 'start_momentum': - 'base_momentum', - 'end_momentum': - 'max_momentum' - }) - self.momentum_phases.append({ - 'end_iter': runner.max_iters - 1, - 'start_momentum': 'max_momentum', - 'end_momentum': 'max_momentum' - }) - else: - self.momentum_phases.append({ - 'end_iter': - float(self.pct_start * runner.max_iters) - 1, - 'start_momentum': - 'max_momentum', - 'end_momentum': - 'base_momentum' - }) - self.momentum_phases.append({ - 'end_iter': runner.max_iters - 1, - 'start_momentum': 'base_momentum', - 'end_momentum': 'max_momentum' - }) - - def _set_momentum(self, runner, momentum_groups): - if isinstance(runner.optimizer, dict): - for k, optim in runner.optimizer.items(): - for param_group, mom in zip(optim.param_groups, - momentum_groups[k]): - if 'momentum' in param_group.keys(): - param_group['momentum'] = mom - elif 'betas' in param_group.keys(): - param_group['betas'] = (mom, param_group['betas'][1]) - else: - for param_group, mom in zip(runner.optimizer.param_groups, - momentum_groups): - if 'momentum' in param_group.keys(): - param_group['momentum'] = mom - elif 'betas' in param_group.keys(): - param_group['betas'] = (mom, param_group['betas'][1]) - - def get_momentum(self, runner, param_group): - curr_iter = runner.iter - start_iter = 0 - for i, phase in enumerate(self.momentum_phases): - end_iter = phase['end_iter'] - if curr_iter <= end_iter or i == len(self.momentum_phases) - 1: - pct = (curr_iter - start_iter) / (end_iter - start_iter) - momentum = self.anneal_func( - param_group[phase['start_momentum']], - param_group[phase['end_momentum']], pct) - break - start_iter = end_iter - return momentum - - def get_regular_momentum(self, runner): - if isinstance(runner.optimizer, dict): - momentum_groups = {} - for k, optim in runner.optimizer.items(): - _momentum_group = [ - self.get_momentum(runner, param_group) - for param_group in optim.param_groups - ] - momentum_groups.update({k: _momentum_group}) - return momentum_groups - else: - momentum_groups = [] - for param_group in runner.optimizer.param_groups: - momentum_groups.append(self.get_momentum(runner, param_group)) - return momentum_groups diff --git a/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmseg/datasets/pipelines/transforms.py b/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmseg/datasets/pipelines/transforms.py deleted file mode 100644 index 94e869b252ef6d8b43604add2bbc02f034614bfb..0000000000000000000000000000000000000000 --- a/spaces/Mellow-ai/PhotoAI_Mellow/annotator/uniformer/mmseg/datasets/pipelines/transforms.py +++ /dev/null @@ -1,889 +0,0 @@ -import annotator.uniformer.mmcv as mmcv -import numpy as np -from annotator.uniformer.mmcv.utils import deprecated_api_warning, is_tuple_of -from numpy import random - -from ..builder import PIPELINES - - -@PIPELINES.register_module() -class Resize(object): - """Resize images & seg. - - This transform resizes the input image to some scale. If the input dict - contains the key "scale", then the scale in the input dict is used, - otherwise the specified scale in the init method is used. - - ``img_scale`` can be None, a tuple (single-scale) or a list of tuple - (multi-scale). There are 4 multiscale modes: - - - ``ratio_range is not None``: - 1. When img_scale is None, img_scale is the shape of image in results - (img_scale = results['img'].shape[:2]) and the image is resized based - on the original size. (mode 1) - 2. When img_scale is a tuple (single-scale), randomly sample a ratio from - the ratio range and multiply it with the image scale. (mode 2) - - - ``ratio_range is None and multiscale_mode == "range"``: randomly sample a - scale from the a range. (mode 3) - - - ``ratio_range is None and multiscale_mode == "value"``: randomly sample a - scale from multiple scales. (mode 4) - - Args: - img_scale (tuple or list[tuple]): Images scales for resizing. - multiscale_mode (str): Either "range" or "value". - ratio_range (tuple[float]): (min_ratio, max_ratio) - keep_ratio (bool): Whether to keep the aspect ratio when resizing the - image. - """ - - def __init__(self, - img_scale=None, - multiscale_mode='range', - ratio_range=None, - keep_ratio=True): - if img_scale is None: - self.img_scale = None - else: - if isinstance(img_scale, list): - self.img_scale = img_scale - else: - self.img_scale = [img_scale] - assert mmcv.is_list_of(self.img_scale, tuple) - - if ratio_range is not None: - # mode 1: given img_scale=None and a range of image ratio - # mode 2: given a scale and a range of image ratio - assert self.img_scale is None or len(self.img_scale) == 1 - else: - # mode 3 and 4: given multiple scales or a range of scales - assert multiscale_mode in ['value', 'range'] - - self.multiscale_mode = multiscale_mode - self.ratio_range = ratio_range - self.keep_ratio = keep_ratio - - @staticmethod - def random_select(img_scales): - """Randomly select an img_scale from given candidates. - - Args: - img_scales (list[tuple]): Images scales for selection. - - Returns: - (tuple, int): Returns a tuple ``(img_scale, scale_dix)``, - where ``img_scale`` is the selected image scale and - ``scale_idx`` is the selected index in the given candidates. - """ - - assert mmcv.is_list_of(img_scales, tuple) - scale_idx = np.random.randint(len(img_scales)) - img_scale = img_scales[scale_idx] - return img_scale, scale_idx - - @staticmethod - def random_sample(img_scales): - """Randomly sample an img_scale when ``multiscale_mode=='range'``. - - Args: - img_scales (list[tuple]): Images scale range for sampling. - There must be two tuples in img_scales, which specify the lower - and upper bound of image scales. - - Returns: - (tuple, None): Returns a tuple ``(img_scale, None)``, where - ``img_scale`` is sampled scale and None is just a placeholder - to be consistent with :func:`random_select`. - """ - - assert mmcv.is_list_of(img_scales, tuple) and len(img_scales) == 2 - img_scale_long = [max(s) for s in img_scales] - img_scale_short = [min(s) for s in img_scales] - long_edge = np.random.randint( - min(img_scale_long), - max(img_scale_long) + 1) - short_edge = np.random.randint( - min(img_scale_short), - max(img_scale_short) + 1) - img_scale = (long_edge, short_edge) - return img_scale, None - - @staticmethod - def random_sample_ratio(img_scale, ratio_range): - """Randomly sample an img_scale when ``ratio_range`` is specified. - - A ratio will be randomly sampled from the range specified by - ``ratio_range``. Then it would be multiplied with ``img_scale`` to - generate sampled scale. - - Args: - img_scale (tuple): Images scale base to multiply with ratio. - ratio_range (tuple[float]): The minimum and maximum ratio to scale - the ``img_scale``. - - Returns: - (tuple, None): Returns a tuple ``(scale, None)``, where - ``scale`` is sampled ratio multiplied with ``img_scale`` and - None is just a placeholder to be consistent with - :func:`random_select`. - """ - - assert isinstance(img_scale, tuple) and len(img_scale) == 2 - min_ratio, max_ratio = ratio_range - assert min_ratio <= max_ratio - ratio = np.random.random_sample() * (max_ratio - min_ratio) + min_ratio - scale = int(img_scale[0] * ratio), int(img_scale[1] * ratio) - return scale, None - - def _random_scale(self, results): - """Randomly sample an img_scale according to ``ratio_range`` and - ``multiscale_mode``. - - If ``ratio_range`` is specified, a ratio will be sampled and be - multiplied with ``img_scale``. - If multiple scales are specified by ``img_scale``, a scale will be - sampled according to ``multiscale_mode``. - Otherwise, single scale will be used. - - Args: - results (dict): Result dict from :obj:`dataset`. - - Returns: - dict: Two new keys 'scale` and 'scale_idx` are added into - ``results``, which would be used by subsequent pipelines. - """ - - if self.ratio_range is not None: - if self.img_scale is None: - h, w = results['img'].shape[:2] - scale, scale_idx = self.random_sample_ratio((w, h), - self.ratio_range) - else: - scale, scale_idx = self.random_sample_ratio( - self.img_scale[0], self.ratio_range) - elif len(self.img_scale) == 1: - scale, scale_idx = self.img_scale[0], 0 - elif self.multiscale_mode == 'range': - scale, scale_idx = self.random_sample(self.img_scale) - elif self.multiscale_mode == 'value': - scale, scale_idx = self.random_select(self.img_scale) - else: - raise NotImplementedError - - results['scale'] = scale - results['scale_idx'] = scale_idx - - def _resize_img(self, results): - """Resize images with ``results['scale']``.""" - if self.keep_ratio: - img, scale_factor = mmcv.imrescale( - results['img'], results['scale'], return_scale=True) - # the w_scale and h_scale has minor difference - # a real fix should be done in the mmcv.imrescale in the future - new_h, new_w = img.shape[:2] - h, w = results['img'].shape[:2] - w_scale = new_w / w - h_scale = new_h / h - else: - img, w_scale, h_scale = mmcv.imresize( - results['img'], results['scale'], return_scale=True) - scale_factor = np.array([w_scale, h_scale, w_scale, h_scale], - dtype=np.float32) - results['img'] = img - results['img_shape'] = img.shape - results['pad_shape'] = img.shape # in case that there is no padding - results['scale_factor'] = scale_factor - results['keep_ratio'] = self.keep_ratio - - def _resize_seg(self, results): - """Resize semantic segmentation map with ``results['scale']``.""" - for key in results.get('seg_fields', []): - if self.keep_ratio: - gt_seg = mmcv.imrescale( - results[key], results['scale'], interpolation='nearest') - else: - gt_seg = mmcv.imresize( - results[key], results['scale'], interpolation='nearest') - results[key] = gt_seg - - def __call__(self, results): - """Call function to resize images, bounding boxes, masks, semantic - segmentation map. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Resized results, 'img_shape', 'pad_shape', 'scale_factor', - 'keep_ratio' keys are added into result dict. - """ - - if 'scale' not in results: - self._random_scale(results) - self._resize_img(results) - self._resize_seg(results) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += (f'(img_scale={self.img_scale}, ' - f'multiscale_mode={self.multiscale_mode}, ' - f'ratio_range={self.ratio_range}, ' - f'keep_ratio={self.keep_ratio})') - return repr_str - - -@PIPELINES.register_module() -class RandomFlip(object): - """Flip the image & seg. - - If the input dict contains the key "flip", then the flag will be used, - otherwise it will be randomly decided by a ratio specified in the init - method. - - Args: - prob (float, optional): The flipping probability. Default: None. - direction(str, optional): The flipping direction. Options are - 'horizontal' and 'vertical'. Default: 'horizontal'. - """ - - @deprecated_api_warning({'flip_ratio': 'prob'}, cls_name='RandomFlip') - def __init__(self, prob=None, direction='horizontal'): - self.prob = prob - self.direction = direction - if prob is not None: - assert prob >= 0 and prob <= 1 - assert direction in ['horizontal', 'vertical'] - - def __call__(self, results): - """Call function to flip bounding boxes, masks, semantic segmentation - maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Flipped results, 'flip', 'flip_direction' keys are added into - result dict. - """ - - if 'flip' not in results: - flip = True if np.random.rand() < self.prob else False - results['flip'] = flip - if 'flip_direction' not in results: - results['flip_direction'] = self.direction - if results['flip']: - # flip image - results['img'] = mmcv.imflip( - results['img'], direction=results['flip_direction']) - - # flip segs - for key in results.get('seg_fields', []): - # use copy() to make numpy stride positive - results[key] = mmcv.imflip( - results[key], direction=results['flip_direction']).copy() - return results - - def __repr__(self): - return self.__class__.__name__ + f'(prob={self.prob})' - - -@PIPELINES.register_module() -class Pad(object): - """Pad the image & mask. - - There are two padding modes: (1) pad to a fixed size and (2) pad to the - minimum size that is divisible by some number. - Added keys are "pad_shape", "pad_fixed_size", "pad_size_divisor", - - Args: - size (tuple, optional): Fixed padding size. - size_divisor (int, optional): The divisor of padded size. - pad_val (float, optional): Padding value. Default: 0. - seg_pad_val (float, optional): Padding value of segmentation map. - Default: 255. - """ - - def __init__(self, - size=None, - size_divisor=None, - pad_val=0, - seg_pad_val=255): - self.size = size - self.size_divisor = size_divisor - self.pad_val = pad_val - self.seg_pad_val = seg_pad_val - # only one of size and size_divisor should be valid - assert size is not None or size_divisor is not None - assert size is None or size_divisor is None - - def _pad_img(self, results): - """Pad images according to ``self.size``.""" - if self.size is not None: - padded_img = mmcv.impad( - results['img'], shape=self.size, pad_val=self.pad_val) - elif self.size_divisor is not None: - padded_img = mmcv.impad_to_multiple( - results['img'], self.size_divisor, pad_val=self.pad_val) - results['img'] = padded_img - results['pad_shape'] = padded_img.shape - results['pad_fixed_size'] = self.size - results['pad_size_divisor'] = self.size_divisor - - def _pad_seg(self, results): - """Pad masks according to ``results['pad_shape']``.""" - for key in results.get('seg_fields', []): - results[key] = mmcv.impad( - results[key], - shape=results['pad_shape'][:2], - pad_val=self.seg_pad_val) - - def __call__(self, results): - """Call function to pad images, masks, semantic segmentation maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Updated result dict. - """ - - self._pad_img(results) - self._pad_seg(results) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(size={self.size}, size_divisor={self.size_divisor}, ' \ - f'pad_val={self.pad_val})' - return repr_str - - -@PIPELINES.register_module() -class Normalize(object): - """Normalize the image. - - Added key is "img_norm_cfg". - - Args: - mean (sequence): Mean values of 3 channels. - std (sequence): Std values of 3 channels. - to_rgb (bool): Whether to convert the image from BGR to RGB, - default is true. - """ - - def __init__(self, mean, std, to_rgb=True): - self.mean = np.array(mean, dtype=np.float32) - self.std = np.array(std, dtype=np.float32) - self.to_rgb = to_rgb - - def __call__(self, results): - """Call function to normalize images. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Normalized results, 'img_norm_cfg' key is added into - result dict. - """ - - results['img'] = mmcv.imnormalize(results['img'], self.mean, self.std, - self.to_rgb) - results['img_norm_cfg'] = dict( - mean=self.mean, std=self.std, to_rgb=self.to_rgb) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(mean={self.mean}, std={self.std}, to_rgb=' \ - f'{self.to_rgb})' - return repr_str - - -@PIPELINES.register_module() -class Rerange(object): - """Rerange the image pixel value. - - Args: - min_value (float or int): Minimum value of the reranged image. - Default: 0. - max_value (float or int): Maximum value of the reranged image. - Default: 255. - """ - - def __init__(self, min_value=0, max_value=255): - assert isinstance(min_value, float) or isinstance(min_value, int) - assert isinstance(max_value, float) or isinstance(max_value, int) - assert min_value < max_value - self.min_value = min_value - self.max_value = max_value - - def __call__(self, results): - """Call function to rerange images. - - Args: - results (dict): Result dict from loading pipeline. - Returns: - dict: Reranged results. - """ - - img = results['img'] - img_min_value = np.min(img) - img_max_value = np.max(img) - - assert img_min_value < img_max_value - # rerange to [0, 1] - img = (img - img_min_value) / (img_max_value - img_min_value) - # rerange to [min_value, max_value] - img = img * (self.max_value - self.min_value) + self.min_value - results['img'] = img - - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(min_value={self.min_value}, max_value={self.max_value})' - return repr_str - - -@PIPELINES.register_module() -class CLAHE(object): - """Use CLAHE method to process the image. - - See `ZUIDERVELD,K. Contrast Limited Adaptive Histogram Equalization[J]. - Graphics Gems, 1994:474-485.` for more information. - - Args: - clip_limit (float): Threshold for contrast limiting. Default: 40.0. - tile_grid_size (tuple[int]): Size of grid for histogram equalization. - Input image will be divided into equally sized rectangular tiles. - It defines the number of tiles in row and column. Default: (8, 8). - """ - - def __init__(self, clip_limit=40.0, tile_grid_size=(8, 8)): - assert isinstance(clip_limit, (float, int)) - self.clip_limit = clip_limit - assert is_tuple_of(tile_grid_size, int) - assert len(tile_grid_size) == 2 - self.tile_grid_size = tile_grid_size - - def __call__(self, results): - """Call function to Use CLAHE method process images. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Processed results. - """ - - for i in range(results['img'].shape[2]): - results['img'][:, :, i] = mmcv.clahe( - np.array(results['img'][:, :, i], dtype=np.uint8), - self.clip_limit, self.tile_grid_size) - - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(clip_limit={self.clip_limit}, '\ - f'tile_grid_size={self.tile_grid_size})' - return repr_str - - -@PIPELINES.register_module() -class RandomCrop(object): - """Random crop the image & seg. - - Args: - crop_size (tuple): Expected size after cropping, (h, w). - cat_max_ratio (float): The maximum ratio that single category could - occupy. - """ - - def __init__(self, crop_size, cat_max_ratio=1., ignore_index=255): - assert crop_size[0] > 0 and crop_size[1] > 0 - self.crop_size = crop_size - self.cat_max_ratio = cat_max_ratio - self.ignore_index = ignore_index - - def get_crop_bbox(self, img): - """Randomly get a crop bounding box.""" - margin_h = max(img.shape[0] - self.crop_size[0], 0) - margin_w = max(img.shape[1] - self.crop_size[1], 0) - offset_h = np.random.randint(0, margin_h + 1) - offset_w = np.random.randint(0, margin_w + 1) - crop_y1, crop_y2 = offset_h, offset_h + self.crop_size[0] - crop_x1, crop_x2 = offset_w, offset_w + self.crop_size[1] - - return crop_y1, crop_y2, crop_x1, crop_x2 - - def crop(self, img, crop_bbox): - """Crop from ``img``""" - crop_y1, crop_y2, crop_x1, crop_x2 = crop_bbox - img = img[crop_y1:crop_y2, crop_x1:crop_x2, ...] - return img - - def __call__(self, results): - """Call function to randomly crop images, semantic segmentation maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Randomly cropped results, 'img_shape' key in result dict is - updated according to crop size. - """ - - img = results['img'] - crop_bbox = self.get_crop_bbox(img) - if self.cat_max_ratio < 1.: - # Repeat 10 times - for _ in range(10): - seg_temp = self.crop(results['gt_semantic_seg'], crop_bbox) - labels, cnt = np.unique(seg_temp, return_counts=True) - cnt = cnt[labels != self.ignore_index] - if len(cnt) > 1 and np.max(cnt) / np.sum( - cnt) < self.cat_max_ratio: - break - crop_bbox = self.get_crop_bbox(img) - - # crop the image - img = self.crop(img, crop_bbox) - img_shape = img.shape - results['img'] = img - results['img_shape'] = img_shape - - # crop semantic seg - for key in results.get('seg_fields', []): - results[key] = self.crop(results[key], crop_bbox) - - return results - - def __repr__(self): - return self.__class__.__name__ + f'(crop_size={self.crop_size})' - - -@PIPELINES.register_module() -class RandomRotate(object): - """Rotate the image & seg. - - Args: - prob (float): The rotation probability. - degree (float, tuple[float]): Range of degrees to select from. If - degree is a number instead of tuple like (min, max), - the range of degree will be (``-degree``, ``+degree``) - pad_val (float, optional): Padding value of image. Default: 0. - seg_pad_val (float, optional): Padding value of segmentation map. - Default: 255. - center (tuple[float], optional): Center point (w, h) of the rotation in - the source image. If not specified, the center of the image will be - used. Default: None. - auto_bound (bool): Whether to adjust the image size to cover the whole - rotated image. Default: False - """ - - def __init__(self, - prob, - degree, - pad_val=0, - seg_pad_val=255, - center=None, - auto_bound=False): - self.prob = prob - assert prob >= 0 and prob <= 1 - if isinstance(degree, (float, int)): - assert degree > 0, f'degree {degree} should be positive' - self.degree = (-degree, degree) - else: - self.degree = degree - assert len(self.degree) == 2, f'degree {self.degree} should be a ' \ - f'tuple of (min, max)' - self.pal_val = pad_val - self.seg_pad_val = seg_pad_val - self.center = center - self.auto_bound = auto_bound - - def __call__(self, results): - """Call function to rotate image, semantic segmentation maps. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Rotated results. - """ - - rotate = True if np.random.rand() < self.prob else False - degree = np.random.uniform(min(*self.degree), max(*self.degree)) - if rotate: - # rotate image - results['img'] = mmcv.imrotate( - results['img'], - angle=degree, - border_value=self.pal_val, - center=self.center, - auto_bound=self.auto_bound) - - # rotate segs - for key in results.get('seg_fields', []): - results[key] = mmcv.imrotate( - results[key], - angle=degree, - border_value=self.seg_pad_val, - center=self.center, - auto_bound=self.auto_bound, - interpolation='nearest') - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(prob={self.prob}, ' \ - f'degree={self.degree}, ' \ - f'pad_val={self.pal_val}, ' \ - f'seg_pad_val={self.seg_pad_val}, ' \ - f'center={self.center}, ' \ - f'auto_bound={self.auto_bound})' - return repr_str - - -@PIPELINES.register_module() -class RGB2Gray(object): - """Convert RGB image to grayscale image. - - This transform calculate the weighted mean of input image channels with - ``weights`` and then expand the channels to ``out_channels``. When - ``out_channels`` is None, the number of output channels is the same as - input channels. - - Args: - out_channels (int): Expected number of output channels after - transforming. Default: None. - weights (tuple[float]): The weights to calculate the weighted mean. - Default: (0.299, 0.587, 0.114). - """ - - def __init__(self, out_channels=None, weights=(0.299, 0.587, 0.114)): - assert out_channels is None or out_channels > 0 - self.out_channels = out_channels - assert isinstance(weights, tuple) - for item in weights: - assert isinstance(item, (float, int)) - self.weights = weights - - def __call__(self, results): - """Call function to convert RGB image to grayscale image. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with grayscale image. - """ - img = results['img'] - assert len(img.shape) == 3 - assert img.shape[2] == len(self.weights) - weights = np.array(self.weights).reshape((1, 1, -1)) - img = (img * weights).sum(2, keepdims=True) - if self.out_channels is None: - img = img.repeat(weights.shape[2], axis=2) - else: - img = img.repeat(self.out_channels, axis=2) - - results['img'] = img - results['img_shape'] = img.shape - - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(out_channels={self.out_channels}, ' \ - f'weights={self.weights})' - return repr_str - - -@PIPELINES.register_module() -class AdjustGamma(object): - """Using gamma correction to process the image. - - Args: - gamma (float or int): Gamma value used in gamma correction. - Default: 1.0. - """ - - def __init__(self, gamma=1.0): - assert isinstance(gamma, float) or isinstance(gamma, int) - assert gamma > 0 - self.gamma = gamma - inv_gamma = 1.0 / gamma - self.table = np.array([(i / 255.0)**inv_gamma * 255 - for i in np.arange(256)]).astype('uint8') - - def __call__(self, results): - """Call function to process the image with gamma correction. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Processed results. - """ - - results['img'] = mmcv.lut_transform( - np.array(results['img'], dtype=np.uint8), self.table) - - return results - - def __repr__(self): - return self.__class__.__name__ + f'(gamma={self.gamma})' - - -@PIPELINES.register_module() -class SegRescale(object): - """Rescale semantic segmentation maps. - - Args: - scale_factor (float): The scale factor of the final output. - """ - - def __init__(self, scale_factor=1): - self.scale_factor = scale_factor - - def __call__(self, results): - """Call function to scale the semantic segmentation map. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with semantic segmentation map scaled. - """ - for key in results.get('seg_fields', []): - if self.scale_factor != 1: - results[key] = mmcv.imrescale( - results[key], self.scale_factor, interpolation='nearest') - return results - - def __repr__(self): - return self.__class__.__name__ + f'(scale_factor={self.scale_factor})' - - -@PIPELINES.register_module() -class PhotoMetricDistortion(object): - """Apply photometric distortion to image sequentially, every transformation - is applied with a probability of 0.5. The position of random contrast is in - second or second to last. - - 1. random brightness - 2. random contrast (mode 0) - 3. convert color from BGR to HSV - 4. random saturation - 5. random hue - 6. convert color from HSV to BGR - 7. random contrast (mode 1) - - Args: - brightness_delta (int): delta of brightness. - contrast_range (tuple): range of contrast. - saturation_range (tuple): range of saturation. - hue_delta (int): delta of hue. - """ - - def __init__(self, - brightness_delta=32, - contrast_range=(0.5, 1.5), - saturation_range=(0.5, 1.5), - hue_delta=18): - self.brightness_delta = brightness_delta - self.contrast_lower, self.contrast_upper = contrast_range - self.saturation_lower, self.saturation_upper = saturation_range - self.hue_delta = hue_delta - - def convert(self, img, alpha=1, beta=0): - """Multiple with alpha and add beat with clip.""" - img = img.astype(np.float32) * alpha + beta - img = np.clip(img, 0, 255) - return img.astype(np.uint8) - - def brightness(self, img): - """Brightness distortion.""" - if random.randint(2): - return self.convert( - img, - beta=random.uniform(-self.brightness_delta, - self.brightness_delta)) - return img - - def contrast(self, img): - """Contrast distortion.""" - if random.randint(2): - return self.convert( - img, - alpha=random.uniform(self.contrast_lower, self.contrast_upper)) - return img - - def saturation(self, img): - """Saturation distortion.""" - if random.randint(2): - img = mmcv.bgr2hsv(img) - img[:, :, 1] = self.convert( - img[:, :, 1], - alpha=random.uniform(self.saturation_lower, - self.saturation_upper)) - img = mmcv.hsv2bgr(img) - return img - - def hue(self, img): - """Hue distortion.""" - if random.randint(2): - img = mmcv.bgr2hsv(img) - img[:, :, - 0] = (img[:, :, 0].astype(int) + - random.randint(-self.hue_delta, self.hue_delta)) % 180 - img = mmcv.hsv2bgr(img) - return img - - def __call__(self, results): - """Call function to perform photometric distortion on images. - - Args: - results (dict): Result dict from loading pipeline. - - Returns: - dict: Result dict with images distorted. - """ - - img = results['img'] - # random brightness - img = self.brightness(img) - - # mode == 0 --> do random contrast first - # mode == 1 --> do random contrast last - mode = random.randint(2) - if mode == 1: - img = self.contrast(img) - - # random saturation - img = self.saturation(img) - - # random hue - img = self.hue(img) - - # random contrast - if mode == 0: - img = self.contrast(img) - - results['img'] = img - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += (f'(brightness_delta={self.brightness_delta}, ' - f'contrast_range=({self.contrast_lower}, ' - f'{self.contrast_upper}), ' - f'saturation_range=({self.saturation_lower}, ' - f'{self.saturation_upper}), ' - f'hue_delta={self.hue_delta})') - return repr_str diff --git a/spaces/MirageML/sjc/sd1/ldm/modules/losses/vqperceptual.py b/spaces/MirageML/sjc/sd1/ldm/modules/losses/vqperceptual.py deleted file mode 100644 index f69981769e4bd5462600458c4fcf26620f7e4306..0000000000000000000000000000000000000000 --- a/spaces/MirageML/sjc/sd1/ldm/modules/losses/vqperceptual.py +++ /dev/null @@ -1,167 +0,0 @@ -import torch -from torch import nn -import torch.nn.functional as F -from einops import repeat - -from taming.modules.discriminator.model import NLayerDiscriminator, weights_init -from taming.modules.losses.lpips import LPIPS -from taming.modules.losses.vqperceptual import hinge_d_loss, vanilla_d_loss - - -def hinge_d_loss_with_exemplar_weights(logits_real, logits_fake, weights): - assert weights.shape[0] == logits_real.shape[0] == logits_fake.shape[0] - loss_real = torch.mean(F.relu(1. - logits_real), dim=[1,2,3]) - loss_fake = torch.mean(F.relu(1. + logits_fake), dim=[1,2,3]) - loss_real = (weights * loss_real).sum() / weights.sum() - loss_fake = (weights * loss_fake).sum() / weights.sum() - d_loss = 0.5 * (loss_real + loss_fake) - return d_loss - -def adopt_weight(weight, global_step, threshold=0, value=0.): - if global_step < threshold: - weight = value - return weight - - -def measure_perplexity(predicted_indices, n_embed): - # src: https://github.com/karpathy/deep-vector-quantization/blob/main/model.py - # eval cluster perplexity. when perplexity == num_embeddings then all clusters are used exactly equally - encodings = F.one_hot(predicted_indices, n_embed).float().reshape(-1, n_embed) - avg_probs = encodings.mean(0) - perplexity = (-(avg_probs * torch.log(avg_probs + 1e-10)).sum()).exp() - cluster_use = torch.sum(avg_probs > 0) - return perplexity, cluster_use - -def l1(x, y): - return torch.abs(x-y) - - -def l2(x, y): - return torch.pow((x-y), 2) - - -class VQLPIPSWithDiscriminator(nn.Module): - def __init__(self, disc_start, codebook_weight=1.0, pixelloss_weight=1.0, - disc_num_layers=3, disc_in_channels=3, disc_factor=1.0, disc_weight=1.0, - perceptual_weight=1.0, use_actnorm=False, disc_conditional=False, - disc_ndf=64, disc_loss="hinge", n_classes=None, perceptual_loss="lpips", - pixel_loss="l1"): - super().__init__() - assert disc_loss in ["hinge", "vanilla"] - assert perceptual_loss in ["lpips", "clips", "dists"] - assert pixel_loss in ["l1", "l2"] - self.codebook_weight = codebook_weight - self.pixel_weight = pixelloss_weight - if perceptual_loss == "lpips": - print(f"{self.__class__.__name__}: Running with LPIPS.") - self.perceptual_loss = LPIPS().eval() - else: - raise ValueError(f"Unknown perceptual loss: >> {perceptual_loss} <<") - self.perceptual_weight = perceptual_weight - - if pixel_loss == "l1": - self.pixel_loss = l1 - else: - self.pixel_loss = l2 - - self.discriminator = NLayerDiscriminator(input_nc=disc_in_channels, - n_layers=disc_num_layers, - use_actnorm=use_actnorm, - ndf=disc_ndf - ).apply(weights_init) - self.discriminator_iter_start = disc_start - if disc_loss == "hinge": - self.disc_loss = hinge_d_loss - elif disc_loss == "vanilla": - self.disc_loss = vanilla_d_loss - else: - raise ValueError(f"Unknown GAN loss '{disc_loss}'.") - print(f"VQLPIPSWithDiscriminator running with {disc_loss} loss.") - self.disc_factor = disc_factor - self.discriminator_weight = disc_weight - self.disc_conditional = disc_conditional - self.n_classes = n_classes - - def calculate_adaptive_weight(self, nll_loss, g_loss, last_layer=None): - if last_layer is not None: - nll_grads = torch.autograd.grad(nll_loss, last_layer, retain_graph=True)[0] - g_grads = torch.autograd.grad(g_loss, last_layer, retain_graph=True)[0] - else: - nll_grads = torch.autograd.grad(nll_loss, self.last_layer[0], retain_graph=True)[0] - g_grads = torch.autograd.grad(g_loss, self.last_layer[0], retain_graph=True)[0] - - d_weight = torch.norm(nll_grads) / (torch.norm(g_grads) + 1e-4) - d_weight = torch.clamp(d_weight, 0.0, 1e4).detach() - d_weight = d_weight * self.discriminator_weight - return d_weight - - def forward(self, codebook_loss, inputs, reconstructions, optimizer_idx, - global_step, last_layer=None, cond=None, split="train", predicted_indices=None): - if not exists(codebook_loss): - codebook_loss = torch.tensor([0.]).to(inputs.device) - #rec_loss = torch.abs(inputs.contiguous() - reconstructions.contiguous()) - rec_loss = self.pixel_loss(inputs.contiguous(), reconstructions.contiguous()) - if self.perceptual_weight > 0: - p_loss = self.perceptual_loss(inputs.contiguous(), reconstructions.contiguous()) - rec_loss = rec_loss + self.perceptual_weight * p_loss - else: - p_loss = torch.tensor([0.0]) - - nll_loss = rec_loss - #nll_loss = torch.sum(nll_loss) / nll_loss.shape[0] - nll_loss = torch.mean(nll_loss) - - # now the GAN part - if optimizer_idx == 0: - # generator update - if cond is None: - assert not self.disc_conditional - logits_fake = self.discriminator(reconstructions.contiguous()) - else: - assert self.disc_conditional - logits_fake = self.discriminator(torch.cat((reconstructions.contiguous(), cond), dim=1)) - g_loss = -torch.mean(logits_fake) - - try: - d_weight = self.calculate_adaptive_weight(nll_loss, g_loss, last_layer=last_layer) - except RuntimeError: - assert not self.training - d_weight = torch.tensor(0.0) - - disc_factor = adopt_weight(self.disc_factor, global_step, threshold=self.discriminator_iter_start) - loss = nll_loss + d_weight * disc_factor * g_loss + self.codebook_weight * codebook_loss.mean() - - log = {"{}/total_loss".format(split): loss.clone().detach().mean(), - "{}/quant_loss".format(split): codebook_loss.detach().mean(), - "{}/nll_loss".format(split): nll_loss.detach().mean(), - "{}/rec_loss".format(split): rec_loss.detach().mean(), - "{}/p_loss".format(split): p_loss.detach().mean(), - "{}/d_weight".format(split): d_weight.detach(), - "{}/disc_factor".format(split): torch.tensor(disc_factor), - "{}/g_loss".format(split): g_loss.detach().mean(), - } - if predicted_indices is not None: - assert self.n_classes is not None - with torch.no_grad(): - perplexity, cluster_usage = measure_perplexity(predicted_indices, self.n_classes) - log[f"{split}/perplexity"] = perplexity - log[f"{split}/cluster_usage"] = cluster_usage - return loss, log - - if optimizer_idx == 1: - # second pass for discriminator update - if cond is None: - logits_real = self.discriminator(inputs.contiguous().detach()) - logits_fake = self.discriminator(reconstructions.contiguous().detach()) - else: - logits_real = self.discriminator(torch.cat((inputs.contiguous().detach(), cond), dim=1)) - logits_fake = self.discriminator(torch.cat((reconstructions.contiguous().detach(), cond), dim=1)) - - disc_factor = adopt_weight(self.disc_factor, global_step, threshold=self.discriminator_iter_start) - d_loss = disc_factor * self.disc_loss(logits_real, logits_fake) - - log = {"{}/disc_loss".format(split): d_loss.clone().detach().mean(), - "{}/logits_real".format(split): logits_real.detach().mean(), - "{}/logits_fake".format(split): logits_fake.detach().mean() - } - return d_loss, log diff --git a/spaces/MisterZee/PIFu-Clothed-Human-Digitization/PIFu/lib/model/SurfaceClassifier.py b/spaces/MisterZee/PIFu-Clothed-Human-Digitization/PIFu/lib/model/SurfaceClassifier.py deleted file mode 100644 index af5afe4fdd4767f72549df258e5b67dea6ac671d..0000000000000000000000000000000000000000 --- a/spaces/MisterZee/PIFu-Clothed-Human-Digitization/PIFu/lib/model/SurfaceClassifier.py +++ /dev/null @@ -1,71 +0,0 @@ -import torch -import torch.nn as nn -import torch.nn.functional as F - - -class SurfaceClassifier(nn.Module): - def __init__(self, filter_channels, num_views=1, no_residual=True, last_op=None): - super(SurfaceClassifier, self).__init__() - - self.filters = [] - self.num_views = num_views - self.no_residual = no_residual - filter_channels = filter_channels - self.last_op = last_op - - if self.no_residual: - for l in range(0, len(filter_channels) - 1): - self.filters.append(nn.Conv1d( - filter_channels[l], - filter_channels[l + 1], - 1)) - self.add_module("conv%d" % l, self.filters[l]) - else: - for l in range(0, len(filter_channels) - 1): - if 0 != l: - self.filters.append( - nn.Conv1d( - filter_channels[l] + filter_channels[0], - filter_channels[l + 1], - 1)) - else: - self.filters.append(nn.Conv1d( - filter_channels[l], - filter_channels[l + 1], - 1)) - - self.add_module("conv%d" % l, self.filters[l]) - - def forward(self, feature): - ''' - - :param feature: list of [BxC_inxHxW] tensors of image features - :param xy: [Bx3xN] tensor of (x,y) coodinates in the image plane - :return: [BxC_outxN] tensor of features extracted at the coordinates - ''' - - y = feature - tmpy = feature - for i, f in enumerate(self.filters): - if self.no_residual: - y = self._modules['conv' + str(i)](y) - else: - y = self._modules['conv' + str(i)]( - y if i == 0 - else torch.cat([y, tmpy], 1) - ) - if i != len(self.filters) - 1: - y = F.leaky_relu(y) - - if self.num_views > 1 and i == len(self.filters) // 2: - y = y.view( - -1, self.num_views, y.shape[1], y.shape[2] - ).mean(dim=1) - tmpy = feature.view( - -1, self.num_views, feature.shape[1], feature.shape[2] - ).mean(dim=1) - - if self.last_op: - y = self.last_op(y) - - return y diff --git a/spaces/MohitGupta/Eng2Indic_Translitration/transliteration/__metadata.py b/spaces/MohitGupta/Eng2Indic_Translitration/transliteration/__metadata.py deleted file mode 100644 index 5becc17c04a9e3ad1c2a15f53252b7bb5a7517e7..0000000000000000000000000000000000000000 --- a/spaces/MohitGupta/Eng2Indic_Translitration/transliteration/__metadata.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "1.0.0" diff --git a/spaces/Mountchicken/MAERec-Gradio/mmocr/models/textdet/detectors/mmdet_wrapper.py b/spaces/Mountchicken/MAERec-Gradio/mmocr/models/textdet/detectors/mmdet_wrapper.py deleted file mode 100644 index 1d6be8caa6469ab2da2e55eb1f645f9129037490..0000000000000000000000000000000000000000 --- a/spaces/Mountchicken/MAERec-Gradio/mmocr/models/textdet/detectors/mmdet_wrapper.py +++ /dev/null @@ -1,156 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -from typing import Dict, List, Optional, Tuple, Union - -import cv2 -import torch -from mmdet.structures import DetDataSample -from mmdet.structures import SampleList as MMDET_SampleList -from mmdet.structures.mask import bitmap_to_polygon -from mmengine.model import BaseModel -from mmengine.structures import InstanceData - -from mmocr.registry import MODELS -from mmocr.utils.bbox_utils import bbox2poly -from mmocr.utils.typing_utils import DetSampleList - -ForwardResults = Union[Dict[str, torch.Tensor], List[DetDataSample], - Tuple[torch.Tensor], torch.Tensor] - - -@MODELS.register_module() -class MMDetWrapper(BaseModel): - """A wrapper of MMDet's model. - - Args: - cfg (dict): The config of the model. - text_repr_type (str): The boundary encoding type 'poly' or 'quad'. - Defaults to 'poly'. - """ - - def __init__(self, cfg: Dict, text_repr_type: str = 'poly') -> None: - data_preprocessor = cfg.pop('data_preprocessor') - data_preprocessor.update(_scope_='mmdet') - super().__init__(data_preprocessor=data_preprocessor, init_cfg=None) - cfg['_scope_'] = 'mmdet' - self.wrapped_model = MODELS.build(cfg) - self.text_repr_type = text_repr_type - - def forward(self, - inputs: torch.Tensor, - data_samples: Optional[Union[DetSampleList, - MMDET_SampleList]] = None, - mode: str = 'tensor', - **kwargs) -> ForwardResults: - """The unified entry for a forward process in both training and test. - - The method works in three modes: "tensor", "predict" and "loss": - - - "tensor": Forward the whole network and return tensor or tuple of - tensor without any post-processing, same as a common nn.Module. - - "predict": Forward and return the predictions, which are fully - processed to a list of :obj:`DetDataSample`. - - "loss": Forward and return a dict of losses according to the given - inputs and data samples. - - Note that this method doesn't handle either back propagation or - parameter update, which are supposed to be done in :meth:`train_step`. - - Args: - inputs (torch.Tensor): The input tensor with shape - (N, C, ...) in general. - data_samples (list[:obj:`DetDataSample`] or - list[:obj:`TextDetDataSample`]): The annotation data of every - sample. When in "predict" mode, it should be a list of - :obj:`TextDetDataSample`. Otherwise they are - :obj:`DetDataSample`s. Defaults to None. - mode (str): Running mode. Defaults to 'tensor'. - - Returns: - The return type depends on ``mode``. - - - If ``mode="tensor"``, return a tensor or a tuple of tensor. - - If ``mode="predict"``, return a list of :obj:`TextDetDataSample`. - - If ``mode="loss"``, return a dict of tensor. - """ - if mode == 'predict': - ocr_data_samples = data_samples - data_samples = [] - for i in range(len(ocr_data_samples)): - data_samples.append( - DetDataSample(metainfo=ocr_data_samples[i].metainfo)) - - results = self.wrapped_model.forward(inputs, data_samples, mode, - **kwargs) - - if mode == 'predict': - results = self.adapt_predictions(results, ocr_data_samples) - - return results - - def adapt_predictions(self, data: MMDET_SampleList, - data_samples: DetSampleList) -> DetSampleList: - """Convert Instance datas from MMDet into MMOCR's format. - - Args: - data: (list[DetDataSample]): Detection results of the - input images. Each DetDataSample usually contain - 'pred_instances'. And the ``pred_instances`` usually - contains following keys. - - scores (Tensor): Classification scores, has a shape - (num_instance, ) - - labels (Tensor): Labels of bboxes, has a shape - (num_instances, ). - - bboxes (Tensor): Has a shape (num_instances, 4), - the last dimension 4 arrange as (x1, y1, x2, y2). - - masks (Tensor, Optional): Has a shape (num_instances, H, W). - data_samples (list[:obj:`TextDetDataSample`]): The annotation data - of every samples. - - Returns: - list[TextDetDataSample]: A list of N datasamples containing ground - truth and prediction results. - The polygon results are saved in - ``TextDetDataSample.pred_instances.polygons`` - The confidence scores are saved in - ``TextDetDataSample.pred_instances.scores``. - """ - for i, det_data_sample in enumerate(data): - data_samples[i].pred_instances = InstanceData() - # convert mask to polygons if mask exists - if 'masks' in det_data_sample.pred_instances.keys(): - masks = det_data_sample.pred_instances.masks.cpu().numpy() - polygons = [] - scores = [] - for mask_idx, mask in enumerate(masks): - contours, _ = bitmap_to_polygon(mask) - polygons += [contour.reshape(-1) for contour in contours] - scores += [ - det_data_sample.pred_instances.scores[mask_idx].cpu() - ] * len(contours) - # filter invalid polygons - filterd_polygons = [] - keep_idx = [] - for poly_idx, polygon in enumerate(polygons): - if len(polygon) < 6: - continue - filterd_polygons.append(polygon) - keep_idx.append(poly_idx) - # convert by text_repr_type - if self.text_repr_type == 'quad': - for j, poly in enumerate(filterd_polygons): - rect = cv2.minAreaRect(poly) - vertices = cv2.boxPoints(rect) - poly = vertices.flatten() - filterd_polygons[j] = poly - - data_samples[i].pred_instances.polygons = filterd_polygons - data_samples[i].pred_instances.scores = torch.FloatTensor( - scores)[keep_idx] - else: - bboxes = det_data_sample.pred_instances.bboxes.cpu().numpy() - polygons = [bbox2poly(bbox) for bbox in bboxes] - data_samples[i].pred_instances.polygons = polygons - data_samples[i].pred_instances.scores = torch.FloatTensor( - det_data_sample.pred_instances.scores.cpu()) - - return data_samples diff --git a/spaces/Msp/Document_Parser/app.py b/spaces/Msp/Document_Parser/app.py deleted file mode 100644 index 58215fe7f54ceb0a818850e72ca47b9af5ef0d16..0000000000000000000000000000000000000000 --- a/spaces/Msp/Document_Parser/app.py +++ /dev/null @@ -1,419 +0,0 @@ -import os - -os.environ["TOKENIZERS_PARALLELISM"] = "false" - -from PIL import Image, ImageDraw -import traceback - -import gradio as gr - -import torch -from docquery import pipeline -from docquery.document import load_document, ImageDocument -from docquery.ocr_reader import get_ocr_reader - - -def ensure_list(x): - if isinstance(x, list): - return x - else: - return [x] - - -CHECKPOINTS = { - "LayoutLMv1 🦉": "impira/layoutlm-document-qa", - "LayoutLMv1 for Invoices 💸": "impira/layoutlm-invoices", - "Donut 🍩": "naver-clova-ix/donut-base-finetuned-docvqa", -} - -PIPELINES = {} - - -def construct_pipeline(task, model): - global PIPELINES - if model in PIPELINES: - return PIPELINES[model] - - device = "cuda" if torch.cuda.is_available() else "cpu" - ret = pipeline(task=task, model=CHECKPOINTS[model], device=device) - PIPELINES[model] = ret - return ret - - -def run_pipeline(model, question, document, top_k): - pipeline = construct_pipeline("document-question-answering", model) - return pipeline(question=question, **document.context, top_k=top_k) - - -# TODO: Move into docquery -# TODO: Support words past the first page (or window?) -def lift_word_boxes(document, page): - return document.context["image"][page][1] - - -def expand_bbox(word_boxes): - if len(word_boxes) == 0: - return None - - min_x, min_y, max_x, max_y = zip(*[x[1] for x in word_boxes]) - min_x, min_y, max_x, max_y = [min(min_x), min(min_y), max(max_x), max(max_y)] - return [min_x, min_y, max_x, max_y] - - -# LayoutLM boxes are normalized to 0, 1000 -def normalize_bbox(box, width, height, padding=0.005): - min_x, min_y, max_x, max_y = [c / 1000 for c in box] - if padding != 0: - min_x = max(0, min_x - padding) - min_y = max(0, min_y - padding) - max_x = min(max_x + padding, 1) - max_y = min(max_y + padding, 1) - return [min_x * width, min_y * height, max_x * width, max_y * height] - - -examples = [ - [ - "invoice.png", - "What is the invoice number?", - ], - [ - "contract.jpeg", - "What is the purchase amount?", - ], - [ - "statement.png", - "What are net sales for 2020?", - ], - -] - -question_files = { - "What are net sales for 2020?": "statement.pdf", - "How many likes does the space have?": "https://huggingface.co/spaces/impira/docquery", - "What is the title of post number 5?": "https://news.ycombinator.com", -} - - -def process_path(path): - error = None - if path: - try: - document = load_document(path) - return ( - document, - gr.update(visible=True, value=document.preview), - gr.update(visible=True), - gr.update(visible=False, value=None), - gr.update(visible=False, value=None), - None, - ) - except Exception as e: - traceback.print_exc() - error = str(e) - return ( - None, - gr.update(visible=False, value=None), - gr.update(visible=False), - gr.update(visible=False, value=None), - gr.update(visible=False, value=None), - gr.update(visible=True, value=error) if error is not None else None, - None, - ) - - -def process_upload(file): - if file: - return process_path(file.name) - else: - return ( - None, - gr.update(visible=False, value=None), - gr.update(visible=False), - gr.update(visible=False, value=None), - gr.update(visible=False, value=None), - None, - ) - - -colors = ["#64A087", "green", "black"] - - -def process_question(question, document, model=list(CHECKPOINTS.keys())[0]): - if not question or document is None: - return None, None, None - - text_value = None - predictions = run_pipeline(model, question, document, 3) - pages = [x.copy().convert("RGB") for x in document.preview] - for i, p in enumerate(ensure_list(predictions)): - if i == 0: - text_value = p["answer"] - else: - # Keep the code around to produce multiple boxes, but only show the top - # prediction for now - break - - if "word_ids" in p: - image = pages[p["page"]] - draw = ImageDraw.Draw(image, "RGBA") - word_boxes = lift_word_boxes(document, p["page"]) - x1, y1, x2, y2 = normalize_bbox( - expand_bbox([word_boxes[i] for i in p["word_ids"]]), - image.width, - image.height, - ) - draw.rectangle(((x1, y1), (x2, y2)), fill=(0, 255, 0, int(0.4 * 255))) - - return ( - gr.update(visible=True, value=pages), - gr.update(visible=True, value=predictions), - gr.update( - visible=True, - value=text_value, - ), - ) - - -def load_example_document(img, question, model): - if img is not None: - if question in question_files: - document = load_document(question_files[question]) - else: - document = ImageDocument(Image.fromarray(img), get_ocr_reader()) - preview, answer, answer_text = process_question(question, document, model) - return document, question, preview, gr.update(visible=True), answer, answer_text - else: - return None, None, None, gr.update(visible=False), None, None - - -CSS = """ -#question input { - font-size: 16px; -} -#url-textbox { - padding: 0 !important; -} -#short-upload-box .w-full { - min-height: 10rem !important; -} -/* I think something like this can be used to re-shape - * the table - */ -/* -.gr-samples-table tr { - display: inline; -} -.gr-samples-table .p-2 { - width: 100px; -} -*/ -#select-a-file { - width: 100%; -} -#file-clear { - padding-top: 2px !important; - padding-bottom: 2px !important; - padding-left: 8px !important; - padding-right: 8px !important; - margin-top: 10px; -} -.gradio-container .gr-button-primary { - background: linear-gradient(180deg, #CDF9BE 0%, #AFF497 100%); - border: 1px solid #B0DCCC; - border-radius: 8px; - color: #1B8700; -} -.gradio-container.dark button#submit-button { - background: linear-gradient(180deg, #CDF9BE 0%, #AFF497 100%); - border: 1px solid #B0DCCC; - border-radius: 8px; - color: #1B8700 -} - -table.gr-samples-table tr td { - border: none; - outline: none; -} - -table.gr-samples-table tr td:first-of-type { - width: 0%; -} - -div#short-upload-box div.absolute { - display: none !important; -} - -gradio-app > div > div > div > div.w-full > div, .gradio-app > div > div > div > div.w-full > div { - gap: 0px 2%; -} - -gradio-app div div div div.w-full, .gradio-app div div div div.w-full { - gap: 0px; -} - -gradio-app h2, .gradio-app h2 { - padding-top: 10px; -} - -#answer { - overflow-y: scroll; - color: white; - background: #666; - border-color: #666; - font-size: 20px; - font-weight: bold; -} - -#answer span { - color: white; -} - -#answer textarea { - color:white; - background: #777; - border-color: #777; - font-size: 18px; -} - -#url-error input { - color: red; -} -""" - -with gr.Blocks(css=CSS) as demo: - gr.Markdown("# Document Parser: Document Parser Engine") - gr.Markdown( - "Document_Parser is built on top of DocQuery library)" - " uses LayoutLMv1 fine-tuned on DocVQA, a document visual question" - " answering dataset, as well as SQuAD, which boosts its English-language comprehension." - - ) - - document = gr.Variable() - example_question = gr.Textbox(visible=False) - example_image = gr.Image(visible=False) - - with gr.Row(equal_height=True): - with gr.Column(): - with gr.Row(): - gr.Markdown("## 1. Select a file", elem_id="select-a-file") - img_clear_button = gr.Button( - "Clear", variant="secondary", elem_id="file-clear", visible=False - ) - image = gr.Gallery(visible=False) - with gr.Row(equal_height=True): - with gr.Column(): - with gr.Row(): - url = gr.Textbox( - show_label=False, - placeholder="URL", - lines=1, - max_lines=1, - elem_id="url-textbox", - ) - submit = gr.Button("Get") - url_error = gr.Textbox( - visible=False, - elem_id="url-error", - max_lines=1, - interactive=False, - label="Error", - ) - gr.Markdown("— or —") - upload = gr.File(label=None, interactive=True, elem_id="short-upload-box") - gr.Examples( - examples=examples, - inputs=[example_image, example_question], - ) - - with gr.Column() as col: - gr.Markdown("## 2. Ask a question") - question = gr.Textbox( - label="Question", - placeholder="e.g. What is the invoice number?", - lines=1, - max_lines=1, - ) - model = gr.Radio( - choices=list(CHECKPOINTS.keys()), - value=list(CHECKPOINTS.keys())[0], - label="Model", - ) - - with gr.Row(): - clear_button = gr.Button("Clear", variant="secondary") - submit_button = gr.Button( - "Submit", variant="primary", elem_id="submit-button" - ) - with gr.Column(): - output_text = gr.Textbox( - label="Top Answer", visible=False, elem_id="answer" - ) - output = gr.JSON(label="Output", visible=False) - - for cb in [img_clear_button, clear_button]: - cb.click( - lambda _: ( - gr.update(visible=False, value=None), - None, - gr.update(visible=False, value=None), - gr.update(visible=False, value=None), - gr.update(visible=False), - None, - None, - None, - gr.update(visible=False, value=None), - None, - ), - inputs=clear_button, - outputs=[ - image, - document, - output, - output_text, - img_clear_button, - example_image, - upload, - url, - url_error, - question, - ], - ) - - upload.change( - fn=process_upload, - inputs=[upload], - outputs=[document, image, img_clear_button, output, output_text, url_error], - ) - submit.click( - fn=process_path, - inputs=[url], - outputs=[document, image, img_clear_button, output, output_text, url_error], - ) - - question.submit( - fn=process_question, - inputs=[question, document, model], - outputs=[image, output, output_text], - ) - - submit_button.click( - process_question, - inputs=[question, document, model], - outputs=[image, output, output_text], - ) - - model.change( - process_question, - inputs=[question, document, model], - outputs=[image, output, output_text], - ) - - example_image.change( - fn=load_example_document, - inputs=[example_image, example_question, model], - outputs=[document, question, image, img_clear_button, output, output_text], - ) - -if __name__ == "__main__": - demo.launch(enable_queue=False) diff --git a/spaces/NATSpeech/PortaSpeech/utils/audio/pitch/utils.py b/spaces/NATSpeech/PortaSpeech/utils/audio/pitch/utils.py deleted file mode 100644 index 238b8022185753a7d4d9d674d189a99050c29b6f..0000000000000000000000000000000000000000 --- a/spaces/NATSpeech/PortaSpeech/utils/audio/pitch/utils.py +++ /dev/null @@ -1,82 +0,0 @@ -import numpy as np -import torch - - -def to_lf0(f0): - f0[f0 < 1.0e-5] = 1.0e-6 - lf0 = f0.log() if isinstance(f0, torch.Tensor) else np.log(f0) - lf0[f0 < 1.0e-5] = - 1.0E+10 - return lf0 - - -def to_f0(lf0): - f0 = np.where(lf0 <= 0, 0.0, np.exp(lf0)) - return f0.flatten() - - -def f0_to_coarse(f0, f0_bin=256, f0_max=900.0, f0_min=50.0): - f0_mel_min = 1127 * np.log(1 + f0_min / 700) - f0_mel_max = 1127 * np.log(1 + f0_max / 700) - is_torch = isinstance(f0, torch.Tensor) - f0_mel = 1127 * (1 + f0 / 700).log() if is_torch else 1127 * np.log(1 + f0 / 700) - f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - f0_mel_min) * (f0_bin - 2) / (f0_mel_max - f0_mel_min) + 1 - - f0_mel[f0_mel <= 1] = 1 - f0_mel[f0_mel > f0_bin - 1] = f0_bin - 1 - f0_coarse = (f0_mel + 0.5).long() if is_torch else np.rint(f0_mel).astype(int) - assert f0_coarse.max() <= 255 and f0_coarse.min() >= 1, (f0_coarse.max(), f0_coarse.min(), f0.min(), f0.max()) - return f0_coarse - - -def coarse_to_f0(f0_coarse, f0_bin=256, f0_max=900.0, f0_min=50.0): - f0_mel_min = 1127 * np.log(1 + f0_min / 700) - f0_mel_max = 1127 * np.log(1 + f0_max / 700) - uv = f0_coarse == 1 - f0 = f0_mel_min + (f0_coarse - 1) * (f0_mel_max - f0_mel_min) / (f0_bin - 2) - f0 = ((f0 / 1127).exp() - 1) * 700 - f0[uv] = 0 - return f0 - - -def norm_f0(f0, uv, pitch_norm='log', f0_mean=400, f0_std=100): - is_torch = isinstance(f0, torch.Tensor) - if pitch_norm == 'standard': - f0 = (f0 - f0_mean) / f0_std - if pitch_norm == 'log': - f0 = torch.log2(f0 + 1e-8) if is_torch else np.log2(f0 + 1e-8) - if uv is not None: - f0[uv > 0] = 0 - return f0 - - -def norm_interp_f0(f0, pitch_norm='log', f0_mean=None, f0_std=None): - is_torch = isinstance(f0, torch.Tensor) - if is_torch: - device = f0.device - f0 = f0.data.cpu().numpy() - uv = f0 == 0 - f0 = norm_f0(f0, uv, pitch_norm, f0_mean, f0_std) - if sum(uv) == len(f0): - f0[uv] = 0 - elif sum(uv) > 0: - f0[uv] = np.interp(np.where(uv)[0], np.where(~uv)[0], f0[~uv]) - if is_torch: - uv = torch.FloatTensor(uv) - f0 = torch.FloatTensor(f0) - f0 = f0.to(device) - uv = uv.to(device) - return f0, uv - - -def denorm_f0(f0, uv, pitch_norm='log', f0_mean=400, f0_std=100, pitch_padding=None, min=50, max=900): - is_torch = isinstance(f0, torch.Tensor) - if pitch_norm == 'standard': - f0 = f0 * f0_std + f0_mean - if pitch_norm == 'log': - f0 = 2 ** f0 - f0 = f0.clamp(min=min, max=max) if is_torch else np.clip(f0, a_min=min, a_max=max) - if uv is not None: - f0[uv > 0] = 0 - if pitch_padding is not None: - f0[pitch_padding] = 0 - return f0 diff --git a/spaces/NSect/multitrack-midi-music-generator/string_to_notes.py b/spaces/NSect/multitrack-midi-music-generator/string_to_notes.py deleted file mode 100644 index ba1d9525678b3e0ae270e8f2e06e9be443a2c112..0000000000000000000000000000000000000000 --- a/spaces/NSect/multitrack-midi-music-generator/string_to_notes.py +++ /dev/null @@ -1,137 +0,0 @@ -from typing import Optional - -from note_seq.protobuf.music_pb2 import NoteSequence -from note_seq.constants import STANDARD_PPQ - - -def token_sequence_to_note_sequence( - token_sequence: str, - qpm: float = 120.0, - use_program: bool = True, - use_drums: bool = True, - instrument_mapper: Optional[dict] = None, - only_piano: bool = False, -) -> NoteSequence: - """ - Converts a sequence of tokens into a sequence of notes. - - Args: - token_sequence (str): The sequence of tokens to convert. - qpm (float, optional): The quarter notes per minute. Defaults to 120.0. - use_program (bool, optional): Whether to use program. Defaults to True. - use_drums (bool, optional): Whether to use drums. Defaults to True. - instrument_mapper (Optional[dict], optional): The instrument mapper. Defaults to None. - only_piano (bool, optional): Whether to only use piano. Defaults to False. - - Returns: - NoteSequence: The resulting sequence of notes. - """ - if isinstance(token_sequence, str): - token_sequence = token_sequence.split() - - note_sequence = empty_note_sequence(qpm) - - # Compute note and bar lengths based on the provided QPM - note_length_16th = 0.25 * 60 / qpm - bar_length = 4.0 * 60 / qpm - - # Render all notes. - current_program = 1 - current_is_drum = False - current_instrument = 0 - track_count = 0 - for _, token in enumerate(token_sequence): - if token == "PIECE_START": - pass - elif token == "PIECE_END": - break - elif token == "TRACK_START": - current_bar_index = 0 - track_count += 1 - pass - elif token == "TRACK_END": - pass - elif token == "KEYS_START": - pass - elif token == "KEYS_END": - pass - elif token.startswith("KEY="): - pass - elif token.startswith("INST"): - instrument = token.split("=")[-1] - if instrument != "DRUMS" and use_program: - if instrument_mapper is not None: - if instrument in instrument_mapper: - instrument = instrument_mapper[instrument] - current_program = int(instrument) - current_instrument = track_count - current_is_drum = False - if instrument == "DRUMS" and use_drums: - current_instrument = 0 - current_program = 0 - current_is_drum = True - elif token == "BAR_START": - current_time = current_bar_index * bar_length - current_notes = {} - elif token == "BAR_END": - current_bar_index += 1 - pass - elif token.startswith("NOTE_ON"): - pitch = int(token.split("=")[-1]) - note = note_sequence.notes.add() - note.start_time = current_time - note.end_time = current_time + 4 * note_length_16th - note.pitch = pitch - note.instrument = current_instrument - note.program = current_program - note.velocity = 80 - note.is_drum = current_is_drum - current_notes[pitch] = note - elif token.startswith("NOTE_OFF"): - pitch = int(token.split("=")[-1]) - if pitch in current_notes: - note = current_notes[pitch] - note.end_time = current_time - elif token.startswith("TIME_DELTA"): - delta = float(token.split("=")[-1]) * note_length_16th - current_time += delta - elif token.startswith("DENSITY="): - pass - elif token == "[PAD]": - pass - else: - pass - - # Make the instruments right. - instruments_drums = [] - for note in note_sequence.notes: - pair = [note.program, note.is_drum] - if pair not in instruments_drums: - instruments_drums += [pair] - note.instrument = instruments_drums.index(pair) - - if only_piano: - for note in note_sequence.notes: - if not note.is_drum: - note.instrument = 0 - note.program = 0 - - return note_sequence - - -def empty_note_sequence(qpm: float = 120.0, total_time: float = 0.0) -> NoteSequence: - """ - Creates an empty note sequence. - - Args: - qpm (float, optional): The quarter notes per minute. Defaults to 120.0. - total_time (float, optional): The total time. Defaults to 0.0. - - Returns: - NoteSequence: The empty note sequence. - """ - note_sequence = NoteSequence() - note_sequence.tempos.add().qpm = qpm - note_sequence.ticks_per_quarter = STANDARD_PPQ - note_sequence.total_time = total_time - return note_sequence diff --git a/spaces/Namit2111/ChatGpt_Detector/README.md b/spaces/Namit2111/ChatGpt_Detector/README.md deleted file mode 100644 index 185f5334a8ec9e7a7bc825b07b385bb98496dd97..0000000000000000000000000000000000000000 --- a/spaces/Namit2111/ChatGpt_Detector/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: ChatGpt Detector -emoji: 🏃 -colorFrom: pink -colorTo: purple -sdk: gradio -sdk_version: 3.20.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/NimaBoscarino/climategan/tests/test_trainer.py b/spaces/NimaBoscarino/climategan/tests/test_trainer.py deleted file mode 100644 index b84153c169aab557a3aee937ea13429c62a72ec0..0000000000000000000000000000000000000000 --- a/spaces/NimaBoscarino/climategan/tests/test_trainer.py +++ /dev/null @@ -1,384 +0,0 @@ -print("Imports...", end="", flush=True) - -import sys -from pathlib import Path - -sys.path.append(str(Path(__file__).resolve().parent.parent)) - -import atexit -import logging -from argparse import ArgumentParser -from copy import deepcopy - -import comet_ml -import climategan -from comet_ml.api import API -from climategan.trainer import Trainer -from climategan.utils import get_comet_rest_api_key - -logging.basicConfig() -logging.getLogger().setLevel(logging.ERROR) -import traceback - -print("Done.") - - -def set_opts(opts, str_nested_key, value): - """ - Changes an opts with nested keys: - set_opts(addict.Dict(), "a.b.c", 2) == Dict({"a":{"b": {"c": 2}}}) - - Args: - opts (addict.Dict): opts whose values should be changed - str_nested_key (str): nested keys joined on "." - value (any): value to set to the nested keys of opts - """ - keys = str_nested_key.split(".") - o = opts - for k in keys[:-1]: - o = o[k] - o[keys[-1]] = value - - -def set_conf(opts, conf): - """ - Updates opts according to a test scenario's configuration dict. - Ignores all keys starting with "__" which are used for the scenario - but outside the opts - - Args: - opts (addict.Dict): trainer options - conf (dict): scenario's configuration - """ - for k, v in conf.items(): - if k.startswith("__"): - continue - set_opts(opts, k, v) - - -class bcolors: - HEADER = "\033[95m" - OKBLUE = "\033[94m" - OKGREEN = "\033[92m" - WARNING = "\033[93m" - FAIL = "\033[91m" - ENDC = "\033[0m" - BOLD = "\033[1m" - UNDERLINE = "\033[4m" - - -class Colors: - def _r(self, key, *args): - return f"{key}{' '.join(args)}{bcolors.ENDC}" - - def ob(self, *args): - return self._r(bcolors.OKBLUE, *args) - - def w(self, *args): - return self._r(bcolors.WARNING, *args) - - def og(self, *args): - return self._r(bcolors.OKGREEN, *args) - - def f(self, *args): - return self._r(bcolors.FAIL, *args) - - def b(self, *args): - return self._r(bcolors.BOLD, *args) - - def u(self, *args): - return self._r(bcolors.UNDERLINE, *args) - - -def comet_handler(exp, api): - def sub_handler(): - p = Colors() - print() - print(p.b(p.w("Deleting comet experiment"))) - api.delete_experiment(exp.get_key()) - - return sub_handler - - -def print_start(desc): - p = Colors() - cdesc = p.b(p.ob(desc)) - title = "| " + cdesc + " |" - line = "-" * (len(desc) + 6) - print(f"{line}\n{title}\n{line}") - - -def print_end(desc=None, ok=None): - p = Colors() - if ok and desc is None: - desc = "Done" - cdesc = p.b(p.og(desc)) - elif not ok and desc is None: - desc = "! Fail !" - cdesc = p.b(p.f(desc)) - elif desc is not None: - cdesc = p.b(p.og(desc)) - else: - desc = "Unknown" - cdesc = desc - - title = "| " + cdesc + " |" - line = "-" * (len(desc) + 6) - print(f"{line}\n{title}\n{line}\n") - - -def delete_on_exit(exp): - """ - Registers a callback to delete the comet exp at program exit - - Args: - exp (comet_ml.Experiment): The exp to delete - """ - rest_api_key = get_comet_rest_api_key() - api = API(api_key=rest_api_key) - atexit.register(comet_handler(exp, api)) - - -if __name__ == "__main__": - - # ----------------------------- - # ----- Parse Arguments ----- - # ----------------------------- - parser = ArgumentParser() - parser.add_argument("--no_delete", action="store_true", default=False) - parser.add_argument("--no_end_to_end", action="store_true", default=False) - parser.add_argument("--include", "-i", nargs="+", default=[]) - parser.add_argument("--exclude", "-e", nargs="+", default=[]) - args = parser.parse_args() - - assert not (args.include and args.exclude), "Choose 1: include XOR exclude" - - include = set(int(i) for i in args.include) - exclude = set(int(i) for i in args.exclude) - if include: - print("Including exclusively tests", " ".join(args.include)) - if exclude: - print("Excluding tests", " ".join(args.exclude)) - - # -------------------------------------- - # ----- Create global experiment ----- - # -------------------------------------- - print("Creating comet Experiment...", end="", flush=True) - global_exp = comet_ml.Experiment( - project_name="climategan-test", display_summary_level=0 - ) - print("Done.") - - if not args.no_delete: - delete_on_exit(global_exp) - - # prompt util for colors - prompt = Colors() - - # ------------------------------------- - # ----- Base Test Scenario Opts ----- - # ------------------------------------- - print("Loading opts...", end="", flush=True) - base_opts = climategan.utils.load_opts() - base_opts.data.check_samples = False - base_opts.train.fid.n_images = 5 - base_opts.comet.display_size = 5 - base_opts.tasks = ["m", "s", "d"] - base_opts.domains = ["r", "s"] - base_opts.data.loaders.num_workers = 4 - base_opts.data.loaders.batch_size = 2 - base_opts.data.max_samples = 9 - base_opts.train.epochs = 1 - if isinstance(base_opts.data.transforms[-1].new_size, int): - base_opts.data.transforms[-1].new_size = 256 - else: - base_opts.data.transforms[-1].new_size.default = 256 - print("Done.") - - # -------------------------------------- - # ----- Configure Test Scenarios ----- - # -------------------------------------- - - # override any nested key in opts - # create scenario-specific variables with __key - # ALWAYS specify a __doc key to describe your scenario - test_scenarios = [ - {"__use_comet": False, "__doc": "MSD no exp", "__verbose": 1}, # 0 - {"__doc": "MSD with exp"}, # 1 - { - "__doc": "MSD no exp upsample_featuremaps", # 2 - "__use_comet": False, - "gen.d.upsample_featuremaps": True, - "gen.s.upsample_featuremaps": True, - }, - {"tasks": ["p"], "domains": ["rf"], "__doc": "Painter"}, # 3 - { - "__doc": "M no exp low level feats", # 4 - "__use_comet": False, - "gen.m.use_low_level_feats": True, - "gen.m.use_dada": False, - "tasks": ["m"], - }, - { - "__doc": "MSD no exp deeplabv2", # 5 - "__use_comet": False, - "gen.encoder.architecture": "deeplabv2", - "gen.s.architecture": "deeplabv2", - }, - { - "__doc": "MSDP no End-to-end", # 6 - "domains": ["rf", "r", "s"], - "tasks": ["m", "s", "d", "p"], - }, - { - "__doc": "MSDP inference only no exp", # 7 - "__inference": True, - "__use_comet": False, - "domains": ["rf", "r", "s"], - "tasks": ["m", "s", "d", "p"], - }, - { - "__doc": "MSDP with End-to-end", # 8 - "__pl4m": True, - "domains": ["rf", "r", "s"], - "tasks": ["m", "s", "d", "p"], - }, - { - "__doc": "Kitti pretrain", # 9 - "train.epochs": 2, - "train.kitti.pretrain": True, - "train.kitti.epochs": 1, - "domains": ["kitti", "r", "s"], - "train.kitti.batch_size": 2, - }, - {"__doc": "Depth Dada archi", "gen.d.architecture": "dada"}, # 10 - { - "__doc": "Depth Base archi", - "gen.d.architecture": "base", - "gen.m.use_dada": False, - "gen.s.use_dada": False, - }, # 11 - { - "__doc": "Depth Base Classification", # 12 - "gen.d.architecture": "base", - "gen.d.classify.enable": True, - "gen.m.use_dada": False, - "gen.s.use_dada": False, - }, - { - "__doc": "MSD Resnet V3+ backbone", - "gen.deeplabv3.backbone": "resnet", - }, # 13 - { - "__use_comet": False, - "__doc": "MSD SPADE 12 (without x)", - "__verbose": 1, - "gen.m.use_spade": True, - "gen.m.spade.cond_nc": 12, - }, # 14 - { - "__use_comet": False, - "__doc": "MSD SPADE 15 (with x)", - "__verbose": 1, - "gen.m.use_spade": True, - "gen.m.spade.cond_nc": 15, - }, # 15 - { - "__use_comet": False, - "__doc": "Painter With Diff Augment", - "__verbose": 1, - "domains": ["rf"], - "tasks": ["p"], - "gen.p.diff_aug.use": True, - }, # 15 - { - "__use_comet": False, - "__doc": "MSD DADA_s", - "__verbose": 1, - "gen.s.use_dada": True, - "gen.m.use_dada": False, - }, # 16 - { - "__use_comet": False, - "__doc": "MSD DADA_ms", - "__verbose": 1, - "gen.s.use_dada": True, - "gen.m.use_dada": True, - }, # 17 - ] - - n_confs = len(test_scenarios) - - fails = [] - successes = [] - - # -------------------------------- - # ----- Run Test Scenarios ----- - # -------------------------------- - - for test_idx, conf in enumerate(test_scenarios): - if test_idx in exclude or (include and test_idx not in include): - reason = ( - "because it is in exclude" - if test_idx in exclude - else "because it is not in include" - ) - print("Ignoring test", test_idx, reason) - continue - - # copy base scenario opts - test_opts = deepcopy(base_opts) - # update with scenario configuration - set_conf(test_opts, conf) - - # print scenario description - print_start( - f"[{test_idx}/{n_confs - 1}] " - + conf.get("__doc", "WARNING: no __doc for test scenario") - ) - print() - - comet = conf.get("__use_comet", True) - pl4m = conf.get("__pl4m", False) - inference = conf.get("__inference", False) - verbose = conf.get("__verbose", 0) - - # set (or not) experiment - test_exp = None - if comet: - test_exp = global_exp - - try: - # create trainer - trainer = Trainer( - opts=test_opts, - verbose=verbose, - comet_exp=test_exp, - ) - trainer.functional_test_mode() - - # set (or not) painter loss for masker (= end-to-end) - if pl4m: - trainer.use_pl4m = True - - # test training procedure - trainer.setup(inference=inference) - if not inference: - trainer.train() - - successes.append(test_idx) - ok = True - except Exception as e: - print(e) - print(traceback.format_exc()) - fails.append(test_idx) - ok = False - finally: - print_end(ok=ok) - - print_end(desc=" ----- Summary ----- ") - if len(fails) == 0: - print("•• All scenarios were successful") - else: - print(f"•• {len(successes)}/{len(test_scenarios)} successful tests") - print(f"•• Failed test indices: {', '.join(map(str, fails))}") diff --git a/spaces/NoamSiegel/gpt-workouts/app.py b/spaces/NoamSiegel/gpt-workouts/app.py deleted file mode 100644 index f2a69218ea5cc7eddb0368aa50aa4a80955362bf..0000000000000000000000000000000000000000 --- a/spaces/NoamSiegel/gpt-workouts/app.py +++ /dev/null @@ -1,204 +0,0 @@ -import openai -import gradio as gr -import os - -# Set up OpenAI API credentials -openai.api_key = os.environ.get("OPENAI_API_KEY") - -# function to generate a workout plan based on user inputs -def generate_workout( - age, - weight, - height, - sex, - goal, - equipment, - years, - split, - days, - time, - rest, - cardio, - warm_up, - stretching - ): - - age = int(age) - - if warm_up: - warm_up = "Wants all their workout to include a warm-up" - else: - warm_up = "Doesn't want their workout to have a warm-up " - if stretching: - stretching = "Wants all their workouts to include stretching" - else: - stretching = "Doesn't want a portion of their workout to be stretching" - - prompt = f""" - Individual_Exercise_Time = (Sets * Reps) - Total_Rest_Time = (Sets * Rest Time) - Total_Exercise_Time = Sum(Individual_Exercise_Time) + Total_Rest_Time - Total_Workout_Time = Total_Exercise_Time + Warm-Up Time + Stretching Time + Cardio Time - - Create a workout plan for an individual where you take into account that: - - Workout Time is {time} minutes or less - - They are {age} years old - - They weight {weight} pounds - - They are {height} inches high - - They are a {sex} - - Their primary goal is {goal} - - They have access to {equipment} - - They have {years} years of experience weight lifting - - They need a {split} workout split - - They want to work out {days} a week - - They want at least {rest} seconds of rest between sets - - They wants to add a {cardio} to each workout day - - {warm_up} - - {stretching} - - For each exercise, write down the approximate time it will take. Do the same for each workout day. If "Total_Workout_Time" > {time}, reduce the number of exercises accordingly. - - Format the workout plan for easy reading by separating each workout day by week day. - """ - - response = openai.Completion.create( - engine="text-davinci-003", - prompt=prompt, - temperature=0.5, - n=1, - max_tokens=1000, - ) - - plan = response.choices[0].text.strip() - # plan = plan + "\n\n" + prompt - - return plan - -# Gradio interface -with gr.Blocks() as main: - gr.Markdown(""" - # Neural Network Workout Planner - Generate a unique, specifically tailored workouts plan using OpenAI's GPT API. If enough people [show interest](https://www.linkedin.com/in/noam-siegel/), I will update to have these features: - """) - with gr.Tab("The Workout Plan"): - with gr.Row(): - with gr.Column(): - - gr.Markdown("#### Physical Information") - with gr.Row(): - age = gr.Number(label="Age (years)") #1 age - weight = gr.Number(label="Weight (lbs)") #2 weight - height = gr.Number(label="Height (inches)") # 3 height - with gr.Row(): - sex = gr.Dropdown( #4 sex - label="Biological Sex", - choices=["Male", "Female"] - ) - - gr.Markdown("#### Background Information") - with gr.Row(): - goal = gr.Dropdown( #5 goal - label="What is your primary goal?", - choices=[ - "Hypertrophy (muscle growth)", - "Power lifting (strength increase)", - "Flexibility and mobility", - ]) - equipment = gr.Dropdown( #6 equipment - label="What equipment do you have access to?", - choices=[ - "A Home Gym", - "A Commercial Gym", - "No Equipment" - ] - ) - - # What is the title for this? - with gr.Row(): - years = gr.Dropdown( # 7 years - label = "How many years have you been working out?", - choices = [ - "0 - 1 years", - "1 - 2 years", - "2-4 years", - "Over 4 years" - ] - ) - split = gr.Dropdown( #8 split - label="What is your preferred training split?", - choices=[ - "Full body", - "Upper-lower", - "Push-pull", - "Body-part", - "Compound exercises", - "Olympic lifts", - "No preference" - ] - ) - - gr.Markdown("##### Workout Information") - with gr.Column(): - days = gr.Slider(1, 7, value=3, step=1, label="How many days per week do you want to work out?") #9 days - time = gr.Slider(30, 120, value=60, step=15, label="How many minutes do you have per workout?") # 10 time - rest = gr.Slider(30, 180, value=90, step=15, label="How many seconds of rest time do you want in between sets?") # 11 rest - - gr.Markdown("##### Additonal Information") - with gr.Column(): - cardio = gr.Dropdown( # 12 cardio - label="Cardio options", - choices=[ - "No cardio", - "Low Intensity Interval Training (LIIT)", - "Medium Intensity Interval Training (MIIT)", - "High Intensity Interval Training (HIIT)" - ] - ) - warm_up = gr.Checkbox(label="Include warm-up") # 13 warm up - stretching = gr.Checkbox(label="Include stretching session") # 14 stretching - - submit_btn = gr.Button(value="Create my plan") - - # output textbox - with gr.Column(): - gr.Markdown("### Generated Plan") - plan = gr.Textbox("Fill out your preferences first!") - # gr.Button(label="Add feedback") - - with gr.Tab("Explanation"): - gr.Markdown(""" - ### How it works - 1. Each Gradio block converts your custom workout preferences into variables - 2. Upon clicking the "Submit" button, the variables transformed into a prompt - 3. The prompt is then sent into OpenAI's ChatGPT Davinci API - 4. ChatGPT's response is returned in the text box - - ### Tools used: - - [OpenAI ChatGPT APIs]() - - [Gradio]() - """) - - submit_btn.click( - generate_workout, - inputs=[ - age, - weight, - height, - sex, - goal, - equipment, - years, - split, - days, - time, - rest, - cardio, - warm_up, - stretching, - ], - outputs=[ - plan - ] - ) - -main.launch() \ No newline at end of file diff --git a/spaces/Norod78/Hebrew-GPT-Neo-Small/README.md b/spaces/Norod78/Hebrew-GPT-Neo-Small/README.md deleted file mode 100644 index aa711f1b708e0f0e637bdc9d4b557cabe2eb0349..0000000000000000000000000000000000000000 --- a/spaces/Norod78/Hebrew-GPT-Neo-Small/README.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Hebrew GPT Neo (Small) -emoji: 📚 -colorFrom: blue -colorTo: gray -sdk: streamlit -app_file: app.py -pinned: true ---- - -# Configuration - -`title`: _string_ -Display title for the Space - -`emoji`: _string_ -Space emoji (emoji-only character allowed) - -`colorFrom`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`colorTo`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`sdk`: _string_ -Can be either `gradio` or `streamlit` - -`app_file`: _string_ -Path to your main application file (which contains either `gradio` or `streamlit` Python code). -Path is relative to the root of the repository. - -`pinned`: _boolean_ -Whether the Space stays on top of your list. diff --git a/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/fairseq/tasks/multilingual_denoising.py b/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/fairseq/tasks/multilingual_denoising.py deleted file mode 100644 index d1c914917feb5165aad7482cd1377f5f65b21635..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/fairseq/tasks/multilingual_denoising.py +++ /dev/null @@ -1,254 +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 numpy as np -from fairseq.data import ( - AppendTokenDataset, - ConcatDataset, - DenoisingDataset, - Dictionary, - PrependTokenDataset, - ResamplingDataset, - SortDataset, - TokenBlockDataset, - data_utils, -) -from fairseq.data.encoders.utils import get_whole_word_mask -from fairseq.tasks import register_task - -from .denoising import DenoisingTask - - -logger = logging.getLogger(__name__) - - -@register_task("multilingual_denoising") -class MultilingualDenoisingTask(DenoisingTask): - @staticmethod - def add_args(parser): - DenoisingTask.add_args(parser) - parser.add_argument( - "--multilang-sampling-alpha", - type=float, - default=1.0, - help="smoothing alpha for sample ratios across multiple datasets", - ) - parser.add_argument("--add-lang-token", default=False, action="store_true") - parser.add_argument( - "--langs", type=str, help="language ids we are considering", default=None - ) - parser.add_argument( - "--no-whole-word-mask-langs", - type=str, - default="", - metavar="N", - help="languages without spacing between words dont support whole word masking", - ) - - @classmethod - def setup_task(cls, args, **kwargs): - """Setup the task.""" - paths = args.data.split(":") - assert len(paths) > 0 - dictionary = Dictionary.load(os.path.join(paths[0], "dict.txt")) - - data_path = paths[0] - if args.langs is None: - languages = sorted( - [ - name - for name in os.listdir(data_path) - if os.path.isdir(os.path.join(data_path, name)) - ] - ) - else: - languages = args.langs.split(",") - - if args.add_lang_token: - for lang in languages: - dictionary.add_symbol("[{}]".format(lang)) - - logger.info("dictionary: {} types".format(len(dictionary))) - if not hasattr(args, "shuffle_instance"): - args.shuffle_instance = False - return cls(args, dictionary) - - def __init__(self, args, dictionary): - super().__init__(args, dictionary) - self.dictionary = dictionary - self.seed = args.seed - - # add mask token - self.mask_idx = self.dictionary.add_symbol("") - self.langs = args.langs - self.args = args - - def _get_sample_prob(self, dataset_lens): - """ - Get smoothed sampling porbability by languages. This helps low resource - languages by upsampling them. - """ - prob = dataset_lens / dataset_lens.sum() - smoothed_prob = prob ** self.args.multilang_sampling_alpha - smoothed_prob = smoothed_prob / smoothed_prob.sum() - return smoothed_prob - - 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 = self.args.data.split(":") - assert len(paths) > 0 - data_path = paths[(epoch - 1) % len(paths)] - split_path = os.path.join(data_path, split) - - if self.langs is None: - languages = sorted( - [ - name - for name in os.listdir(data_path) - if os.path.isdir(os.path.join(data_path, name)) - ] - ) - else: - languages = self.langs.split(",") - for name in languages: - p = os.path.join(data_path, name) - assert os.path.exists(p), "data not found: {}".format(p) - - logger.info("Training on {0} languages: {1}".format(len(languages), languages)) - logger.info( - "Language to id mapping: ", {lang: id for id, lang in enumerate(languages)} - ) - - mask_whole_words = get_whole_word_mask(self.args, self.dictionary) - language_without_segmentations = self.args.no_whole_word_mask_langs.split(",") - lang_datasets = [] - for language in languages: - split_path = os.path.join(data_path, language, split) - - dataset = data_utils.load_indexed_dataset( - split_path, - self.source_dictionary, - self.args.dataset_impl, - combine=combine, - ) - if dataset is None: - raise FileNotFoundError( - "Dataset not found: {} ({})".format(split, split_path) - ) - - end_token = ( - self.source_dictionary.index("[{}]".format(language)) - if self.args.add_lang_token - else self.source_dictionary.eos() - ) - - # create continuous blocks of tokens - dataset = TokenBlockDataset( - dataset, - dataset.sizes, - self.args.tokens_per_sample - 2, # one less for - pad=self.source_dictionary.pad(), - eos=end_token, - break_mode=self.args.sample_break_mode, - ) - logger.info("loaded {} blocks from: {}".format(len(dataset), split_path)) - - # prepend beginning-of-sentence token (, equiv. to [CLS] in BERT) - dataset = PrependTokenDataset(dataset, self.source_dictionary.bos()) - dataset = AppendTokenDataset(dataset, end_token) - - lang_mask_whole_words = ( - mask_whole_words - if language not in language_without_segmentations - else None - ) - lang_dataset = DenoisingDataset( - dataset, - dataset.sizes, - self.dictionary, - self.mask_idx, - lang_mask_whole_words, - shuffle=self.args.shuffle_instance, - seed=self.seed, - args=self.args, - eos=None - if not self.args.add_lang_token - else self.source_dictionary.index("[{}]".format(language)), - ) - lang_datasets.append(lang_dataset) - - dataset_lengths = np.array( - [len(d) for d in lang_datasets], - dtype=float, - ) - logger.info( - "loaded total {} blocks for all languages".format( - int(dataset_lengths.sum()), - ) - ) - if split == self.args.train_subset: - # For train subset, additionally up or down sample languages. - sample_probs = self._get_sample_prob(dataset_lengths) - logger.info( - "Sample probability by language: {}".format( - { - lang: "{0:.4f}".format(sample_probs[id]) - for id, lang in enumerate(languages) - } - ) - ) - size_ratio = (sample_probs * dataset_lengths.sum()) / dataset_lengths - logger.info( - "Up/Down Sampling ratio by language: {}".format( - { - lang: "{0:.2f}".format(size_ratio[id]) - for id, lang in enumerate(languages) - } - ) - ) - - resampled_lang_datasets = [ - ResamplingDataset( - lang_datasets[i], - size_ratio=size_ratio[i], - seed=self.args.seed, - epoch=epoch, - replace=size_ratio[i] >= 1.0, - ) - for i, d in enumerate(lang_datasets) - ] - dataset = ConcatDataset( - resampled_lang_datasets, - ) - else: - dataset = ConcatDataset(lang_datasets) - lang_splits = [split] - for lang_id, lang_dataset in enumerate(lang_datasets): - split_name = split + "_" + languages[lang_id] - lang_splits.append(split_name) - self.datasets[split_name] = lang_dataset - - if split in self.args.valid_subset: - self.args.valid_subset = self.args.valid_subset.replace( - split, ",".join(lang_splits) - ) - - with data_utils.numpy_seed(self.args.seed + epoch): - shuffle = np.random.permutation(len(dataset)) - - self.datasets[split] = SortDataset( - dataset, - sort_order=[ - shuffle, - dataset.sizes, - ], - ) diff --git a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/multilingual/multilingual_fairseq_gen.sh b/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/multilingual/multilingual_fairseq_gen.sh deleted file mode 100644 index 65aa322d7daaa428015de98abe4664a6a4164bfd..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/multilingual/multilingual_fairseq_gen.sh +++ /dev/null @@ -1,26 +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. - -lang_pairs="en-fr,en-cs,fr-en,cs-en" -path_2_data=$1 # -lang_list=$2 # -model=$3 # -source_lang=cs -target_lang=en - -fairseq-generate "$path_2_data" \ - --path "$model" \ - --task translation_multi_simple_epoch \ - --gen-subset test \ - --source-lang "$source_lang" \ - --target-lang "$target_lang" \ - --sacrebleu --remove-bpe 'sentencepiece'\ - --batch-size 32 \ - --encoder-langtok "src" \ - --decoder-langtok \ - --lang-dict "$lang_list" \ - --lang-pairs "$lang_pairs" diff --git a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/fairseq/modules/sparse_transformer_sentence_encoder.py b/spaces/OFA-Sys/OFA-Image_Caption/fairseq/fairseq/modules/sparse_transformer_sentence_encoder.py deleted file mode 100644 index f41ec09327fe80b50d20674e7482794ce45c531c..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/fairseq/modules/sparse_transformer_sentence_encoder.py +++ /dev/null @@ -1,96 +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.nn as nn -from fairseq.modules import TransformerSentenceEncoder -from fairseq.modules.sparse_transformer_sentence_encoder_layer import ( - SparseTransformerSentenceEncoderLayer, -) - - -class SparseTransformerSentenceEncoder(TransformerSentenceEncoder): - """ - Sparse implementation of the TransformerSentenceEncoder - - see SparseMultiheadAttention - """ - - def __init__( - self, - padding_idx: int, - vocab_size: int, - num_encoder_layers: int = 6, - embedding_dim: int = 768, - ffn_embedding_dim: int = 3072, - num_attention_heads: int = 8, - dropout: float = 0.1, - attention_dropout: float = 0.1, - activation_dropout: float = 0.1, - max_seq_len: int = 256, - num_segments: int = 2, - use_position_embeddings: bool = True, - offset_positions_by_padding: bool = True, - encoder_normalize_before: bool = False, - apply_bert_init: bool = False, - activation_fn: str = "relu", - learned_pos_embedding: bool = True, - embed_scale: float = None, - freeze_embeddings: bool = False, - n_trans_layers_to_freeze: int = 0, - export: bool = False, - is_bidirectional: bool = True, - stride: int = 32, - expressivity: int = 8, - ) -> None: - - super().__init__( - padding_idx, - vocab_size, - num_encoder_layers, - embedding_dim, - ffn_embedding_dim, - num_attention_heads, - dropout, - attention_dropout, - activation_dropout, - max_seq_len, - num_segments, - use_position_embeddings, - offset_positions_by_padding, - encoder_normalize_before, - apply_bert_init, - activation_fn, - learned_pos_embedding, - embed_scale, - freeze_embeddings, - n_trans_layers_to_freeze, - export, - ) - - self.layers = nn.ModuleList( - [ - SparseTransformerSentenceEncoderLayer( - embedding_dim=self.embedding_dim, - ffn_embedding_dim=ffn_embedding_dim, - num_attention_heads=num_attention_heads, - dropout=dropout, - attention_dropout=attention_dropout, - activation_dropout=activation_dropout, - activation_fn=activation_fn, - export=export, - is_bidirectional=is_bidirectional, - stride=stride, - expressivity=expressivity, - ) - for _ in range(num_encoder_layers) - ] - ) - - def freeze_module_params(m): - if m is not None: - for p in m.parameters(): - p.requires_grad = False - - for layer in range(n_trans_layers_to_freeze): - freeze_module_params(self.layers[layer]) diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/examples/speech_synthesis/preprocessing/vad/__init__.py b/spaces/OFA-Sys/OFA-vqa/fairseq/examples/speech_synthesis/preprocessing/vad/__init__.py deleted file mode 100644 index 9cf121081fbde2f5085ed380f0841649d143a4be..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/examples/speech_synthesis/preprocessing/vad/__init__.py +++ /dev/null @@ -1,192 +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 collections -import contextlib -import wave - -try: - import webrtcvad -except ImportError: - raise ImportError("Please install py-webrtcvad: pip install webrtcvad") -import argparse -import os -import logging -from tqdm import tqdm - -AUDIO_SUFFIX = '.wav' -FS_MS = 30 -SCALE = 6e-5 -THRESHOLD = 0.3 - - -def read_wave(path): - """Reads a .wav file. - Takes the path, and returns (PCM audio data, sample rate). - """ - with contextlib.closing(wave.open(path, 'rb')) as wf: - num_channels = wf.getnchannels() - assert num_channels == 1 - sample_width = wf.getsampwidth() - assert sample_width == 2 - sample_rate = wf.getframerate() - assert sample_rate in (8000, 16000, 32000, 48000) - pcm_data = wf.readframes(wf.getnframes()) - return pcm_data, sample_rate - - -def write_wave(path, audio, sample_rate): - """Writes a .wav file. - Takes path, PCM audio data, and sample rate. - """ - with contextlib.closing(wave.open(path, 'wb')) as wf: - wf.setnchannels(1) - wf.setsampwidth(2) - wf.setframerate(sample_rate) - wf.writeframes(audio) - - -class Frame(object): - """Represents a "frame" of audio data.""" - def __init__(self, bytes, timestamp, duration): - self.bytes = bytes - self.timestamp = timestamp - self.duration = duration - - -def frame_generator(frame_duration_ms, audio, sample_rate): - """Generates audio frames from PCM audio data. - Takes the desired frame duration in milliseconds, the PCM data, and - the sample rate. - Yields Frames of the requested duration. - """ - n = int(sample_rate * (frame_duration_ms / 1000.0) * 2) - offset = 0 - timestamp = 0.0 - duration = (float(n) / sample_rate) / 2.0 - while offset + n < len(audio): - yield Frame(audio[offset:offset + n], timestamp, duration) - timestamp += duration - offset += n - - -def vad_collector(sample_rate, frame_duration_ms, - padding_duration_ms, vad, frames): - """Filters out non-voiced audio frames. - Given a webrtcvad.Vad and a source of audio frames, yields only - the voiced audio. - Uses a padded, sliding window algorithm over the audio frames. - When more than 90% of the frames in the window are voiced (as - reported by the VAD), the collector triggers and begins yielding - audio frames. Then the collector waits until 90% of the frames in - the window are unvoiced to detrigger. - The window is padded at the front and back to provide a small - amount of silence or the beginnings/endings of speech around the - voiced frames. - Arguments: - sample_rate - The audio sample rate, in Hz. - frame_duration_ms - The frame duration in milliseconds. - padding_duration_ms - The amount to pad the window, in milliseconds. - vad - An instance of webrtcvad.Vad. - frames - a source of audio frames (sequence or generator). - Returns: A generator that yields PCM audio data. - """ - num_padding_frames = int(padding_duration_ms / frame_duration_ms) - # We use a deque for our sliding window/ring buffer. - ring_buffer = collections.deque(maxlen=num_padding_frames) - # We have two states: TRIGGERED and NOTTRIGGERED. We start in the - # NOTTRIGGERED state. - triggered = False - - voiced_frames = [] - for frame in frames: - is_speech = vad.is_speech(frame.bytes, sample_rate) - - # sys.stdout.write('1' if is_speech else '0') - if not triggered: - ring_buffer.append((frame, is_speech)) - num_voiced = len([f for f, speech in ring_buffer if speech]) - # If we're NOTTRIGGERED and more than 90% of the frames in - # the ring buffer are voiced frames, then enter the - # TRIGGERED state. - if num_voiced > 0.9 * ring_buffer.maxlen: - triggered = True - # We want to yield all the audio we see from now until - # we are NOTTRIGGERED, but we have to start with the - # audio that's already in the ring buffer. - for f, _ in ring_buffer: - voiced_frames.append(f) - ring_buffer.clear() - else: - # We're in the TRIGGERED state, so collect the audio data - # and add it to the ring buffer. - voiced_frames.append(frame) - ring_buffer.append((frame, is_speech)) - num_unvoiced = len([f for f, speech in ring_buffer if not speech]) - # If more than 90% of the frames in the ring buffer are - # unvoiced, then enter NOTTRIGGERED and yield whatever - # audio we've collected. - if num_unvoiced > 0.9 * ring_buffer.maxlen: - triggered = False - yield [b''.join([f.bytes for f in voiced_frames]), - voiced_frames[0].timestamp, voiced_frames[-1].timestamp] - ring_buffer.clear() - voiced_frames = [] - # If we have any leftover voiced audio when we run out of input, - # yield it. - if voiced_frames: - yield [b''.join([f.bytes for f in voiced_frames]), - voiced_frames[0].timestamp, voiced_frames[-1].timestamp] - - -def main(args): - # create output folder - try: - cmd = f"mkdir -p {args.out_path}" - os.system(cmd) - except Exception: - logging.error("Can not create output folder") - exit(-1) - - # build vad object - vad = webrtcvad.Vad(int(args.agg)) - # iterating over wavs in dir - for file in tqdm(os.listdir(args.in_path)): - if file.endswith(AUDIO_SUFFIX): - audio_inpath = os.path.join(args.in_path, file) - audio_outpath = os.path.join(args.out_path, file) - audio, sample_rate = read_wave(audio_inpath) - frames = frame_generator(FS_MS, audio, sample_rate) - frames = list(frames) - segments = vad_collector(sample_rate, FS_MS, 300, vad, frames) - merge_segments = list() - timestamp_start = 0.0 - timestamp_end = 0.0 - # removing start, end, and long sequences of sils - for i, segment in enumerate(segments): - merge_segments.append(segment[0]) - if i and timestamp_start: - sil_duration = segment[1] - timestamp_end - if sil_duration > THRESHOLD: - merge_segments.append(int(THRESHOLD / SCALE)*(b'\x00')) - else: - merge_segments.append(int((sil_duration / SCALE))*(b'\x00')) - timestamp_start = segment[1] - timestamp_end = segment[2] - segment = b''.join(merge_segments) - write_wave(audio_outpath, segment, sample_rate) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Apply vad to a file of fils.') - parser.add_argument('in_path', type=str, help='Path to the input files') - parser.add_argument('out_path', type=str, - help='Path to save the processed files') - parser.add_argument('--agg', type=int, default=3, - help='The level of aggressiveness of the VAD: [0-3]') - args = parser.parse_args() - - main(args) diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/examples/wav2vec/unsupervised/kaldi_self_train/st/local/unsup_select_decode_word.sh b/spaces/OFA-Sys/OFA-vqa/fairseq/examples/wav2vec/unsupervised/kaldi_self_train/st/local/unsup_select_decode_word.sh deleted file mode 100644 index c10a6b8809b77bca2b2c02df8b8702725bdd51c7..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/examples/wav2vec/unsupervised/kaldi_self_train/st/local/unsup_select_decode_word.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -split="dev_other" -ref_txt="" # ground truth transcript path -psd_txt="" # pseudo transcript path -get_best_wer=true -dec_name="decode" -graph_name="graph" -kenlm_path=/checkpoint/abaevski/data/speech/libri/librispeech_lm_novox.phnc_o6.bin -phonemize_lexicon="" - -. ./cmd.sh -. ./path.sh -. parse_options.sh -. /private/home/wnhsu/unsup_asr/fairseq-py-unsup/env.sh - -exp_root=$1 - -set -eu - -if [ ! -z $ref_txt ] && $get_best_wer; then - echo "==== WER w.r.t. real transcript (select based on unsupervised metric)" - for x in $exp_root/*/${dec_name}_${split}*; do - lang=$(dirname $x)/$graph_name - - for tra in $x/scoring/*.tra; do - cat $tra | utils/int2sym.pl -f 2- $lang/words.txt | sed 's:\::g' > $tra.txt - python local/unsup_select.py $psd_txt $tra.txt \ - --kenlm_path $kenlm_path --gt_tra $ref_txt --phonemize \ - --phonemize_lexicon "$phonemize_lexicon" - done | grep "score=" | sed 's/=/ /g' | sed 's/;//g' | sort -k3n | head -n1 - done -fi - - diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/distributed/__init__.py b/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/distributed/__init__.py deleted file mode 100644 index d0b96b734c4b5e7cd5d295238d0764c05093dc27..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/distributed/__init__.py +++ /dev/null @@ -1,21 +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 .distributed_timeout_wrapper import DistributedTimeoutWrapper -from .fully_sharded_data_parallel import fsdp_enable_wrap, fsdp_wrap, FullyShardedDataParallel -from .legacy_distributed_data_parallel import LegacyDistributedDataParallel -from .module_proxy_wrapper import ModuleProxyWrapper -from .tpu_distributed_data_parallel import TPUDistributedDataParallel - - -__all__ = [ - "DistributedTimeoutWrapper", - "fsdp_enable_wrap", - "fsdp_wrap", - "FullyShardedDataParallel", - "LegacyDistributedDataParallel", - "ModuleProxyWrapper", - "TPUDistributedDataParallel", -] diff --git a/spaces/OpenGVLab/InternGPT/third-party/lama/saicinpainting/evaluation/vis.py b/spaces/OpenGVLab/InternGPT/third-party/lama/saicinpainting/evaluation/vis.py deleted file mode 100644 index c2910b4ef8c61efee72dabd0531a9b669ec8bf98..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/InternGPT/third-party/lama/saicinpainting/evaluation/vis.py +++ /dev/null @@ -1,37 +0,0 @@ -import numpy as np -from skimage import io -from skimage.segmentation import mark_boundaries - - -def save_item_for_vis(item, out_file): - mask = item['mask'] > 0.5 - if mask.ndim == 3: - mask = mask[0] - img = mark_boundaries(np.transpose(item['image'], (1, 2, 0)), - mask, - color=(1., 0., 0.), - outline_color=(1., 1., 1.), - mode='thick') - - if 'inpainted' in item: - inp_img = mark_boundaries(np.transpose(item['inpainted'], (1, 2, 0)), - mask, - color=(1., 0., 0.), - mode='outer') - img = np.concatenate((img, inp_img), axis=1) - - img = np.clip(img * 255, 0, 255).astype('uint8') - io.imsave(out_file, img) - - -def save_mask_for_sidebyside(item, out_file): - mask = item['mask']# > 0.5 - if mask.ndim == 3: - mask = mask[0] - mask = np.clip(mask * 255, 0, 255).astype('uint8') - io.imsave(out_file, mask) - -def save_img_for_sidebyside(item, out_file): - img = np.transpose(item['image'], (1, 2, 0)) - img = np.clip(img * 255, 0, 255).astype('uint8') - io.imsave(out_file, img) \ No newline at end of file diff --git a/spaces/Osborn-bh/ChatGLM3-6B-Osborn/README_en.md b/spaces/Osborn-bh/ChatGLM3-6B-Osborn/README_en.md deleted file mode 100644 index 495789d21dbfc21c00e84961629e2ae290d9323f..0000000000000000000000000000000000000000 --- a/spaces/Osborn-bh/ChatGLM3-6B-Osborn/README_en.md +++ /dev/null @@ -1,243 +0,0 @@ -# ChatGLM3 - -

    -🤗 HF Repo • 🤖 ModelScope • 🐦 Twitter • 📃 [GLM@ACL 22] [GitHub] • 📃 [GLM-130B@ICLR 23] [GitHub]
    -

    -

    - 👋 Join our Slack and WeChat -

    -

    -📍Experience the larger-scale ChatGLM model at chatglm.cn -

    - -## Introduction - -ChatGLM3 is a new generation of pre-trained dialogue models jointly released by Zhipu AI and Tsinghua KEG. ChatGLM3-6B is the open-source model in the ChatGLM3 series, maintaining many excellent features of the first two generations such as smooth dialogue and low deployment threshold, while introducing the following features: - -1. **Stronger Base Model:** The base model of ChatGLM3-6B, ChatGLM3-6B-Base, adopts a more diverse training dataset, more sufficient training steps, and a more reasonable training strategy. Evaluations on datasets from various perspectives such as semantics, mathematics, reasoning, code, and knowledge show that **ChatGLM3-6B-Base has the strongest performance among base models below 10B**. - -2. **More Complete Function Support:** ChatGLM3-6B adopts a newly designed [Prompt format](PROMPT_en.md), supporting multi-turn dialogues as usual. It also natively supports [tool invocation](tool_using/README_en.md) (Function Call), code execution (Code Interpreter), and Agent tasks in complex scenarios. - -3. **More Comprehensive Open-source Series:** In addition to the dialogue model [ChatGLM3-6B](https://huggingface.co/THUDM/chatglm3-6b), the basic model [ChatGLM3-6B-Base](https://huggingface.co/THUDM/chatglm3-6b-base), and the long-text dialogue model [ChatGLM3-6B-32K](https://huggingface.co/THUDM/chatglm3-6b-32k) have also been open-sourced. All these weights are **fully open** for academic research, and **free commercial use is also allowed** after registration via a [questionnaire](https://open.bigmodel.cn/mla/form). - ------ - -The ChatGLM3 open-source model aims to promote the development of large-model technology together with the open-source community. Developers and everyone are earnestly requested to comply with the [open-source protocol](MODEL_LICENSE), and not to use the open-source models, codes, and derivatives for any purposes that might harm the nation and society, and for any services that have not been evaluated and filed for safety. Currently, no applications, including web, Android, Apple iOS, and Windows App, have been developed based on the **ChatGLM3 open-source model** by our project team. - -Although every effort has been made to ensure the compliance and accuracy of the data at various stages of model training, due to the smaller scale of the ChatGLM3-6B model and the influence of probabilistic randomness factors, the accuracy of output content cannot be guaranteed. The model output is also easily misled by user input. **This project does not assume risks and liabilities caused by data security, public opinion risks, or any misleading, abuse, dissemination, and improper use of open-source models and codes.** - -## Model List - -| Model | Seq Length | Download -| :---: |:---------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------: -| ChatGLM3-6B | 8k | [HuggingFace](https://huggingface.co/THUDM/chatglm3-6b) \| [ModelScope](https://modelscope.cn/models/ZhipuAI/chatglm3-6b) -| ChatGLM3-6B-Base | 8k | [HuggingFace](https://huggingface.co/THUDM/chatglm3-6b-base) \| [ModelScope](https://modelscope.cn/models/ZhipuAI/chatglm3-6b-base) -| ChatGLM3-6B-32K | 32k | [HuggingFace](https://huggingface.co/THUDM/chatglm3-6b-32k) \| [ModelScope](https://modelscope.cn/models/ZhipuAI/chatglm3-6b-32k) - -## Projects -Open source projects that accelerate ChatGLM3: -* [chatglm.cpp](https://github.com/li-plus/chatglm.cpp): Real-time inference on your laptop accelerated by quantization, similar to llama.cpp. - -## Evaluation Results - -### Typical Tasks - -We selected 8 typical Chinese-English datasets and conducted performance tests on the ChatGLM3-6B (base) version. - -| Model | GSM8K | MATH | BBH | MMLU | C-Eval | CMMLU | MBPP | AGIEval | -|------------------|:-----:|:----:|:----:|:----:|:------:|:-----:|:----:|:-------:| -| ChatGLM2-6B-Base | 32.4 | 6.5 | 33.7 | 47.9 | 51.7 | 50.0 | - | - | -| Best Baseline | 52.1 | 13.1 | 45.0 | 60.1 | 63.5 | 62.2 | 47.5 | 45.8 | -| ChatGLM3-6B-Base | 72.3 | 25.7 | 66.1 | 61.4 | 69.0 | 67.5 | 52.4 | 53.7 | -> "Best Baseline" refers to the pre-trained models that perform best on the corresponding datasets with model parameters below 10B, excluding models that are trained specifically for a single task and do not maintain general capabilities. - -> In the tests of ChatGLM3-6B-Base, BBH used a 3-shot test, GSM8K and MATH that require inference used a 0-shot CoT test, MBPP used a 0-shot generation followed by running test cases to calculate Pass@1, and other multiple-choice type datasets all used a 0-shot test. - -We have conducted manual evaluation tests on ChatGLM3-6B-32K in multiple long-text application scenarios. Compared with the second-generation model, its effect has improved by more than 50% on average. In applications such as paper reading, document summarization, and financial report analysis, this improvement is particularly significant. In addition, we also tested the model on the LongBench evaluation set, and the specific results are shown in the table below. - -| Model | Average | Summary | Single-Doc QA | Multi-Doc QA | Code | Few-shot | Synthetic | -|----------------------|:-----:|:----:|:----:|:----:|:------:|:-----:|:-----:| -| ChatGLM2-6B-32K | 41.5 | 24.8 | 37.6 | 34.7 | 52.8 | 51.3 | 47.7 | -| ChatGLM3-6B-32K | 50.2 | 26.6 | 45.8 | 46.1 | 56.2 | 61.2 | 65 | - - -## How to Use - -### Environment Installation -First, you need to download this repository: -```shell -git clone https://github.com/THUDM/ChatGLM3 -cd ChatGLM3 -``` - -Then use pip to install the dependencies: -``` -pip install -r requirements.txt -``` -It is recommended to use version `4.30.2` for the `transformers` library, and version 2.0 or above for `torch`, to achieve the best inference performance. - -### Integrated Demo - -We provide an integrated demo that incorporates the following three functionalities. Please refer to [Integrated Demo](composite_demo/README_en.md) for how to run it. - -- Chat: Dialogue mode, where you can interact with the model. -- Tool: Tool mode, where in addition to dialogue, the model can also perform other operations using tools. - ![tool](resources/tool.png) -- Code Interpreter: Code interpreter mode, where the model can execute code in a Jupyter environment and obtain results to complete complex tasks. - ![code](resources/heart.png) - -### Usage - -The ChatGLM model can be called to start a conversation using the following code: - -```python ->>> from transformers import AutoTokenizer, AutoModel ->>> tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True) ->>> model = AutoModel.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True, device='cuda') ->>> model = model.eval() ->>> response, history = model.chat(tokenizer, "Hello", history=[]) ->>> print(response) -Hello 👋! I'm ChatGLM3-6B, the artificial intelligence assistant, nice to meet you. Feel free to ask me any questions. ->>> response, history = model.chat(tokenizer, "What should I do if I can't sleep at night", history=history) ->>> print(response) -If you're having trouble sleeping at night, here are a few suggestions that might help: - -1. Create a relaxing sleep environment: Make sure your bedroom is cool, quiet, and dark. Consider using earplugs, a white noise machine, or a fan to help create an optimal environment. -2. Establish a bedtime routine: Try to go to bed and wake up at the same time every day, even on weekends. A consistent routine can help regulate your body's internal clock. -3. Avoid stimulating activities before bedtime: Avoid using electronic devices, watching TV, or engaging in stimulating activities like exercise or puzzle-solving, as these can interfere with your ability to fall asleep. -4. Limit caffeine and alcohol: Avoid consuming caffeine and alcohol close to bedtime, as these can disrupt your sleep patterns. -5. Practice relaxation techniques: Try meditation, deep breathing, or progressive muscle relaxation to help calm your mind and body before sleep. -6. Consider taking a warm bath or shower: A warm bath or shower can help relax your muscles and promote sleep. -7. Get some fresh air: Make sure to get some fresh air during the day, as lack of vitamin D can interfere with sleep quality. - -If you continue to have difficulty sleeping, consult with a healthcare professional for further guidance and support. -``` - -#### Load Model Locally -The above code will automatically download the model implementation and parameters by `transformers`. The complete model implementation is available on [Hugging Face Hub](https://huggingface.co/THUDM/chatglm3-6b). If your network environment is poor, downloading model parameters might take a long time or even fail. In this case, you can first download the model to your local machine, and then load it from there. - -To download the model from Hugging Face Hub, you need to [install Git LFS](https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage) first, then run -```Shell -git clone https://huggingface.co/THUDM/chatglm3-6b -``` - -If the download from HuggingFace is slow, you can also download it from [ModelScope](https://modelscope.cn/models/ZhipuAI/chatglm3-6b). - -### Web-based Dialogue Demo -![web-demo](resources/web-demo.gif) -You can launch a web-based demo using Gradio with the following command: -```shell -python web_demo.py -``` - -![web-demo](resources/web-demo2.png) - -You can launch a web-based demo using Streamlit with the following command: -```shell -streamlit run web_demo2.py -``` - -The web-based demo will run a Web Server and output an address. You can use it by opening the output address in a browser. Based on tests, the web-based demo using Streamlit runs more smoothly. - -### Command Line Dialogue Demo - -![cli-demo](resources/cli-demo.png) - -Run [cli_demo.py](cli_demo.py) in the repository: - -```shell -python cli_demo.py -``` - -The program will interact in the command line, enter instructions in the command line and hit enter to generate a response. Enter `clear` to clear the dialogue history, enter `stop` to terminate the program. - -### API Deployment -Thanks to [@xusenlinzy](https://github.com/xusenlinzy) for implementing the OpenAI format streaming API deployment, which can serve as the backend for any ChatGPT-based application, such as [ChatGPT-Next-Web](https://github.com/Yidadaa/ChatGPT-Next-Web). You can deploy it by running [openai_api.py](openai_api.py) in the repository: -```shell -python openai_api.py -``` -The example code for API calls is as follows: -```python -import openai -if __name__ == "__main__": - openai.api_base = "http://localhost:8000/v1" - openai.api_key = "none" - for chunk in openai.ChatCompletion.create( - model="chatglm3-6b", - messages=[ - {"role": "user", "content": "你好"} - ], - stream=True - ): - if hasattr(chunk.choices[0].delta, "content"): - print(chunk.choices[0].delta.content, end="", flush=True) -``` - -### Tool Invocation - -For methods of tool invocation, please refer to [Tool Invocation](tool_using/README_en.md). - -## Low-Cost Deployment - -### Model Quantization - -By default, the model is loaded with FP16 precision, running the above code requires about 13GB of VRAM. If your GPU's VRAM is limited, you can try loading the model quantitatively, as follows: - -```python -model = AutoModel.from_pretrained("THUDM/chatglm3-6b",trust_remote_code=True).quantize(4).cuda() -``` - -Model quantization will bring some performance loss. Through testing, ChatGLM3-6B can still perform natural and smooth generation under 4-bit quantization. - -### CPU Deployment - -If you don't have GPU hardware, you can also run inference on the CPU, but the inference speed will be slower. The usage is as follows (requires about 32GB of memory): - -```python -model = AutoModel.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True).float() -``` - -### Mac Deployment - -For Macs equipped with Apple Silicon or AMD GPUs, the MPS backend can be used to run ChatGLM3-6B on the GPU. Refer to Apple's [official instructions](https://developer.apple.com/metal/pytorch) to install PyTorch-Nightly (the correct version number should be 2.x.x.dev2023xxxx, not 2.x.x). - -Currently, only [loading the model locally](README_en.md#load-model-locally) is supported on MacOS. Change the model loading in the code to load locally and use the MPS backend: - -```python -model = AutoModel.from_pretrained("your local path", trust_remote_code=True).to('mps') -``` - -Loading the half-precision ChatGLM3-6B model requires about 13GB of memory. Machines with smaller memory (such as a 16GB memory MacBook Pro) will use virtual memory on the hard disk when there is insufficient free memory, resulting in a significant slowdown in inference speed. - -### Multi-GPU Deployment - -If you have multiple GPUs, but each GPU's VRAM size is not enough to accommodate the complete model, then the model can be split across multiple GPUs. First, install accelerate: `pip install accelerate`, and then load the model through the following methods: - -```python -from utils import load_model_on_gpus -model = load_model_on_gpus("THUDM/chatglm3-6b", num_gpus=2) -``` - -This allows the model to be deployed on two GPUs for inference. You can change `num_gpus` to the number of GPUs you want to use. It is evenly split by default, but you can also pass the `device_map` parameter to specify it yourself. - -## Citation - -If you find our work helpful, please consider citing the following papers. - -``` -@article{zeng2022glm, - title={Glm-130b: An open bilingual pre-trained model}, - author={Zeng, Aohan and Liu, Xiao and Du, Zhengxiao and Wang, Zihan and Lai, Hanyu and Ding, Ming and Yang, Zhuoyi and Xu, Yifan and Zheng, Wendi and Xia, Xiao and others}, - journal={arXiv preprint arXiv:2210.02414}, - year={2022} -} -``` -``` -@inproceedings{du2022glm, - title={GLM: General Language Model Pretraining with Autoregressive Blank Infilling}, - author={Du, Zhengxiao and Qian, Yujie and Liu, Xiao and Ding, Ming and Qiu, Jiezhong and Yang, Zhilin and Tang, Jie}, - booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)}, - pages={320--335}, - year={2022} -} -``` diff --git a/spaces/Osborn-bh/ChatGLM3-6B-Osborn/composite_demo/client.py b/spaces/Osborn-bh/ChatGLM3-6B-Osborn/composite_demo/client.py deleted file mode 100644 index 07f84962bb8331e8d6f7f280f0ce82ba6755524d..0000000000000000000000000000000000000000 --- a/spaces/Osborn-bh/ChatGLM3-6B-Osborn/composite_demo/client.py +++ /dev/null @@ -1,137 +0,0 @@ -from __future__ import annotations - -from collections.abc import Iterable -import os -from typing import Any, Protocol - -from huggingface_hub.inference._text_generation import TextGenerationStreamResponse, Token -import streamlit as st -import torch -from transformers import AutoModel, AutoTokenizer - -from conversation import Conversation - -TOOL_PROMPT = 'Answer the following questions as best as you can. You have access to the following tools:' - -MODEL_PATH = os.environ.get('MODEL_PATH', 'THUDM/chatglm3-6b') - -@st.cache_resource -def get_client() -> Client: - client = HFClient(MODEL_PATH) - return client - -class Client(Protocol): - def generate_stream(self, - system: str | None, - tools: list[dict] | None, - history: list[Conversation], - **parameters: Any - ) -> Iterable[TextGenerationStreamResponse]: - ... - -def stream_chat(self, tokenizer, query: str, history: list[tuple[str, str]] = None, role: str = "user", - past_key_values=None,max_length: int = 8192, do_sample=True, top_p=0.8, temperature=0.8, - logits_processor=None, return_past_key_values=False, **kwargs): - - from transformers.generation.logits_process import LogitsProcessor - from transformers.generation.utils import LogitsProcessorList - - class InvalidScoreLogitsProcessor(LogitsProcessor): - def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor: - if torch.isnan(scores).any() or torch.isinf(scores).any(): - scores.zero_() - scores[..., 5] = 5e4 - return scores - - if history is None: - history = [] - if logits_processor is None: - logits_processor = LogitsProcessorList() - logits_processor.append(InvalidScoreLogitsProcessor()) - eos_token_id = [tokenizer.eos_token_id, tokenizer.get_command("<|user|>"), - tokenizer.get_command("<|observation|>")] - gen_kwargs = {"max_length": max_length, "do_sample": do_sample, "top_p": top_p, - "temperature": temperature, "logits_processor": logits_processor, **kwargs} - if past_key_values is None: - inputs = tokenizer.build_chat_input(query, history=history, role=role) - else: - inputs = tokenizer.build_chat_input(query, role=role) - inputs = inputs.to(self.device) - if past_key_values is not None: - past_length = past_key_values[0][0].shape[0] - if self.transformer.pre_seq_len is not None: - past_length -= self.transformer.pre_seq_len - inputs.position_ids += past_length - attention_mask = inputs.attention_mask - attention_mask = torch.cat((attention_mask.new_ones(1, past_length), attention_mask), dim=1) - inputs['attention_mask'] = attention_mask - history.append({"role": role, "content": query}) - for outputs in self.stream_generate(**inputs, past_key_values=past_key_values, - eos_token_id=eos_token_id, return_past_key_values=return_past_key_values, - **gen_kwargs): - if return_past_key_values: - outputs, past_key_values = outputs - outputs = outputs.tolist()[0][len(inputs["input_ids"][0]):] - response = tokenizer.decode(outputs) - if response and response[-1] != "�": - new_history = history - if return_past_key_values: - yield response, new_history, past_key_values - else: - yield response, new_history - -class HFClient(Client): - def __init__(self, model_path: str): - self.model_path = model_path - self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True) - self.model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to( - 'cuda' if torch.cuda.is_available() else - 'mps' if torch.backends.mps.is_available() else - 'cpu' - ) - self.model = self.model.eval() - - def generate_stream(self, - system: str | None, - tools: list[dict] | None, - history: list[Conversation], - **parameters: Any - ) -> Iterable[TextGenerationStreamResponse]: - chat_history = [{ - 'role': 'system', - 'content': system if not tools else TOOL_PROMPT, - }] - - if tools: - chat_history[0]['tools'] = tools - - for conversation in history[:-1]: - chat_history.append({ - 'role': str(conversation.role).removeprefix('<|').removesuffix('|>'), - 'content': conversation.content, - }) - - query = history[-1].content - role = str(history[-1].role).removeprefix('<|').removesuffix('|>') - - text = '' - - for new_text, _ in stream_chat(self.model, - self.tokenizer, - query, - chat_history, - role, - **parameters, - ): - word = new_text.removeprefix(text) - word_stripped = word.strip() - text = new_text - yield TextGenerationStreamResponse( - generated_text=text, - token=Token( - id=0, - logprob=0, - text=word, - special=word_stripped.startswith('<|') and word_stripped.endswith('|>'), - ) - ) diff --git a/spaces/Oumar199/Fake-Real-Face-Detection/fake_face_detection/optimization/fake_face_bayesian_optimization.py b/spaces/Oumar199/Fake-Real-Face-Detection/fake_face_detection/optimization/fake_face_bayesian_optimization.py deleted file mode 100644 index 9f7cf4f8b5694377f2c03e5f705ebc202ef75348..0000000000000000000000000000000000000000 --- a/spaces/Oumar199/Fake-Real-Face-Detection/fake_face_detection/optimization/fake_face_bayesian_optimization.py +++ /dev/null @@ -1,175 +0,0 @@ -from fake_face_detection.utils.generation import PI_generate_sample as generate_sample -from fake_face_detection.utils.acquisitions import PI_acquisition as acquisition -from fake_face_detection.utils.sampling import get_random_samples -from sklearn.gaussian_process import GaussianProcessRegressor -from functools import partial -from typing import * -import pandas as pd -import numpy as np -import string -import random -import pickle -import os - -letters = string.ascii_letters + string.digits - -class SimpleBayesianOptimizationForFakeReal: - - def __init__(self, objective: Callable, search_spaces: dict, maximize: bool = True, random_kwargs: dict = {}, kwargs: dict = {}, checkpoint: str = "data/trials/checkpoint.txt"): - - # recuperate the optimization strategy - self.maximize = maximize - - # checkpoint where the data and score will be saved - self.checkpoint = checkpoint - - # initialize the search spaces - self.search_spaces = search_spaces - - # recuperate the random kwargs - self.random_kwargs = random_kwargs - - # initialize the objective function - self.objective = objective - - # initialize the kwargs - self.kwargs = kwargs - - # initialize the model - self.model = GaussianProcessRegressor() - - # initialize the random kwargs with a random values - random_kwargs = {key: value + ''.join(random.choice(letters) for i in range(7)) for key, value in self.random_kwargs.items()} - - # add random kwargs to the kwargs - self.kwargs.update(random_kwargs) - - # recuperate random sample - config = get_random_samples(search_spaces) - - if os.path.exists(self.checkpoint): - - with open(self.checkpoint, 'rb') as f: - - pickler = pickle.Unpickler(f) - - checkpoint = pickler.load() - - self.data = checkpoint['data'] - - self.scores = checkpoint['scores'] - - self.model = checkpoint['model'] - - self.current_trial = checkpoint['trial'] - - print(f"Checkpoint loaded at trial {self.current_trial}") - - else: - - # add config to kwargs - self.kwargs['config'] = config - - # calculate the first score - score = self.objective(**self.kwargs) - - # initialize the input data - self.data = [list(config.values())] - - # initialize the scores - self.scores = [[score]] - - # fit the model with the input data and the target - self.model.fit(self.data, self.scores) - - # initialize the number of trials to zero - self.current_trial = 0 - - with open(self.checkpoint, 'wb') as f: - - pickler = pickle.Pickler(f) - - checkpoint = { - 'data': self.data, - 'scores': self.scores, - 'model': self.model, - 'trial': self.current_trial - } - - pickler.dump(checkpoint) - - def optimize(self, n_trials: int = 50, n_tests: int = 100): - """Finding the best hyperparameters with the Bayesian Optimization - - Args: - n_trials (int, optional): The number of trials. Defaults to 50. - n_tests (int, optional): The number of random samples to test for each trial. Defaults to 100. - """ - - # let us make multiple trials in order to find the best params - for trial in range(self.current_trial + 1, self.current_trial + n_trials + 1): - - # let us generate new samples with the acquisition and the surrogate functions - new_sample = generate_sample(self.data, self.model, self.search_spaces, n_tests, maximize = self.maximize) - config = {key: new_sample[i] for i, key in enumerate(self.search_spaces)} - - # recuperate a new score - new_score = self.get_score(config) - - # let us add the new sample, target and score to their lists - self.data.append(new_sample) - - self.scores.append([new_score]) - - # let us train again the model - self.model.fit(self.data, self.scores) - - # recuperate the current trial - self.current_trial = trial - - with open(self.checkpoint, 'wb') as f: - - pickler = pickle.Pickler(f) - - checkpoint = { - 'data': self.data, - 'scores': self.scores, - 'model': self.model, - 'trial': self.current_trial - } - - pickler.dump(checkpoint) - - def get_score(self, config: dict): - - # add random seed (since we have always the same problem of randomizing the seed) - random.seed(None) - - # initialize the random kwargs with a random values - random_kwargs = {key: value + ''.join(random.choice(letters) for i in range(7)) for key, value in self.random_kwargs.items()} - print(random_kwargs) - # add random kwargs to the kwargs - self.kwargs.update(random_kwargs) - - # add config to kwargs - self.kwargs['config'] = config - - # calculate the first score - new_score = self.objective(**self.kwargs) - - return new_score - - def get_results(self): - """Recuperate the generated samples and the scores - - Returns: - pd.DataFrame: A data frame containing the results - """ - # let us return the results as a data frame - data = {key: np.array(self.data, dtype = object)[:, i] for i, key in enumerate(self.search_spaces)} - - data.update({'score': np.array(self.scores)[:, 0]}) - - return pd.DataFrame(data) - - diff --git a/spaces/PAIR/Text2Video-Zero/app_canny_db.py b/spaces/PAIR/Text2Video-Zero/app_canny_db.py deleted file mode 100644 index 1d0129ae9c13a57f6c5c50cd8e0cb6e1a7af9fc7..0000000000000000000000000000000000000000 --- a/spaces/PAIR/Text2Video-Zero/app_canny_db.py +++ /dev/null @@ -1,109 +0,0 @@ -import gradio as gr -from model import Model -import gradio_utils -import os -on_huggingspace = os.environ.get("SPACE_AUTHOR_NAME") == "PAIR" - - -examples = [ - ['Anime DB', "woman1", "Portrait of detailed 1girl, feminine, soldier cinematic shot on canon 5d ultra realistic skin intricate clothes accurate hands Rory Lewis Artgerm WLOP Jeremy Lipking Jane Ansell studio lighting"], - ['Arcane DB', "woman1", "Oil painting of a beautiful girl arcane style, masterpiece, a high-quality, detailed, and professional photo"], - ['GTA-5 DB', "man1", "gtav style"], - ['GTA-5 DB', "woman3", "gtav style"], - ['Avatar DB', "woman2", "oil painting of a beautiful girl avatar style"], -] - - -def load_db_model(evt: gr.SelectData): - db_name = gradio_utils.get_db_name_from_id(evt.index) - return db_name - - -def canny_select(evt: gr.SelectData): - canny_name = gradio_utils.get_canny_name_from_id(evt.index) - return canny_name - - -def create_demo(model: Model): - - with gr.Blocks() as demo: - with gr.Row(): - gr.Markdown( - '## Text, Canny-Edge and DreamBooth Conditional Video Generation') - with gr.Row(): - gr.HTML( - """ -
    -

    - Description: Our current release supports only four predefined DreamBooth models and four "motion edges". So you must choose one DreamBooth model and one "motion edges" shown below, or use the examples. The keywords 1girl, arcane style, gtav, and avatar style correspond to the models from left to right. -

    -
    - """) - with gr.Row(): - with gr.Column(): - # input_video_path = gr.Video(source='upload', format="mp4", visible=False) - gr.Markdown("## Selection") - db_text_field = gr.Markdown('DB Model: **Anime DB** ') - canny_text_field = gr.Markdown('Motion: **woman1**') - prompt = gr.Textbox(label='Prompt') - run_button = gr.Button(label='Run') - with gr.Accordion('Advanced options', open=False): - watermark = gr.Radio(["Picsart AI Research", "Text2Video-Zero", - "None"], label="Watermark", value='Picsart AI Research') - chunk_size = gr.Slider( - label="Chunk size", minimum=2, maximum=16, value=2, step=1, visible=not on_huggingspace, - info="Number of frames processed at once. Reduce for lower memory usage.") - merging_ratio = gr.Slider( - label="Merging ratio", minimum=0.0, maximum=0.9, step=0.1, value=0.0, visible=not on_huggingspace, - info="Ratio of how many tokens are merged. The higher the more compression (less memory and faster inference).") - with gr.Column(): - result = gr.Image(label="Generated Video").style(height=400) - - with gr.Row(): - gallery_db = gr.Gallery(label="Db models", value=[('__assets__/db_files/anime.jpg', "anime"), ('__assets__/db_files/arcane.jpg', "Arcane"), ( - '__assets__/db_files/gta.jpg', "GTA-5 (Man)"), ('__assets__/db_files/avatar.jpg', "Avatar DB")]).style(grid=[4], height=50) - with gr.Row(): - gallery_canny = gr.Gallery(label="Motions", value=[('__assets__/db_files/woman1.gif', "woman1"), ('__assets__/db_files/woman2.gif', "woman2"), ( - '__assets__/db_files/man1.gif', "man1"), ('__assets__/db_files/woman3.gif', "woman3")]).style(grid=[4], height=50) - - db_selection = gr.Textbox(label="DB Model", visible=False) - canny_selection = gr.Textbox( - label="One of the above defined motions", visible=False) - - gallery_db.select(load_db_model, None, db_selection) - gallery_canny.select(canny_select, None, canny_selection) - - db_selection.change(on_db_selection_update, None, db_text_field) - canny_selection.change(on_canny_selection_update, - None, canny_text_field) - - inputs = [ - db_selection, - canny_selection, - prompt, - chunk_size, - watermark, - merging_ratio, - ] - - gr.Examples(examples=examples, - inputs=inputs, - outputs=result, - fn=model.process_controlnet_canny_db, - # cache_examples=on_huggingspace, - cache_examples=False, - ) - - run_button.click(fn=model.process_controlnet_canny_db, - inputs=inputs, - outputs=result,) - return demo - - -def on_db_selection_update(evt: gr.EventData): - - return f"DB model: **{evt._data}**" - - -def on_canny_selection_update(evt: gr.EventData): - return f"Motion: **{evt._data}**" diff --git a/spaces/PaddlePaddle/photo2cartoon/app.py b/spaces/PaddlePaddle/photo2cartoon/app.py deleted file mode 100644 index fceb167b07ca54f80e7542bbd2b1eeaaf538d44b..0000000000000000000000000000000000000000 --- a/spaces/PaddlePaddle/photo2cartoon/app.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -os.system("hub install Photo2Cartoon==1.0.0") -import gradio as gr -import paddlehub as hub -import cv2 -from pathlib import Path - -model = hub.Module(name='Photo2Cartoon') - -def inference(image): - result = model.Cartoon_GEN( - images=[cv2.imread(image.name)], - paths=None, - batch_size=4, - output_dir='output', - visualization=True, - use_gpu=False) - return './output/result_0.png' - -title = "Photo2Cartoon" -description = "Gradio demo for Photo2cartoon. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below." -article = "

    Github Repo

    " -iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file",source="webcam"), outputs=gr.outputs.Image(type="file"),enable_queue=True,title=title,article=article,description=description) -iface.launch() \ No newline at end of file diff --git a/spaces/PeepDaSlan9/AutoGPT/autogpt/json_utils/json_fix_llm.py b/spaces/PeepDaSlan9/AutoGPT/autogpt/json_utils/json_fix_llm.py deleted file mode 100644 index 869aed125cfb8cd7a69ed02eeb389cc72a3e296b..0000000000000000000000000000000000000000 --- a/spaces/PeepDaSlan9/AutoGPT/autogpt/json_utils/json_fix_llm.py +++ /dev/null @@ -1,220 +0,0 @@ -"""This module contains functions to fix JSON strings generated by LLM models, such as ChatGPT, using the assistance -of the ChatGPT API or LLM models.""" -from __future__ import annotations - -import contextlib -import json -from typing import Any, Dict - -from colorama import Fore -from regex import regex - -from autogpt.config import Config -from autogpt.json_utils.json_fix_general import correct_json -from autogpt.llm_utils import call_ai_function -from autogpt.logs import logger -from autogpt.speech import say_text - -JSON_SCHEMA = """ -{ - "command": { - "name": "command name", - "args": { - "arg name": "value" - } - }, - "thoughts": - { - "text": "thought", - "reasoning": "reasoning", - "plan": "- short bulleted\n- list that conveys\n- long-term plan", - "criticism": "constructive self-criticism", - "speak": "thoughts summary to say to user" - } -} -""" - -CFG = Config() - - -def auto_fix_json(json_string: str, schema: str) -> str: - """Fix the given JSON string to make it parseable and fully compliant with - the provided schema using GPT-3. - - Args: - json_string (str): The JSON string to fix. - schema (str): The schema to use to fix the JSON. - Returns: - str: The fixed JSON string. - """ - # Try to fix the JSON using GPT: - function_string = "def fix_json(json_string: str, schema:str=None) -> str:" - args = [f"'''{json_string}'''", f"'''{schema}'''"] - description_string = ( - "This function takes a JSON string and ensures that it" - " is parseable and fully compliant with the provided schema. If an object" - " or field specified in the schema isn't contained within the correct JSON," - " it is omitted. The function also escapes any double quotes within JSON" - " string values to ensure that they are valid. If the JSON string contains" - " any None or NaN values, they are replaced with null before being parsed." - ) - - # If it doesn't already start with a "`", add one: - if not json_string.startswith("`"): - json_string = "```json\n" + json_string + "\n```" - result_string = call_ai_function( - function_string, args, description_string, model=CFG.fast_llm_model - ) - logger.debug("------------ JSON FIX ATTEMPT ---------------") - logger.debug(f"Original JSON: {json_string}") - logger.debug("-----------") - logger.debug(f"Fixed JSON: {result_string}") - logger.debug("----------- END OF FIX ATTEMPT ----------------") - - try: - json.loads(result_string) # just check the validity - return result_string - except json.JSONDecodeError: # noqa: E722 - # Get the call stack: - # import traceback - # call_stack = traceback.format_exc() - # print(f"Failed to fix JSON: '{json_string}' "+call_stack) - return "failed" - - -def fix_json_using_multiple_techniques(assistant_reply: str) -> Dict[Any, Any]: - """Fix the given JSON string to make it parseable and fully compliant with two techniques. - - Args: - json_string (str): The JSON string to fix. - - Returns: - str: The fixed JSON string. - """ - - # Parse and print Assistant response - assistant_reply_json = fix_and_parse_json(assistant_reply) - if assistant_reply_json == {}: - assistant_reply_json = attempt_to_fix_json_by_finding_outermost_brackets( - assistant_reply - ) - - if assistant_reply_json != {}: - return assistant_reply_json - - logger.error( - "Error: The following AI output couldn't be converted to a JSON:\n", - assistant_reply, - ) - if CFG.speak_mode: - say_text("I have received an invalid JSON response from the OpenAI API.") - - return {} - - -def fix_and_parse_json( - json_to_load: str, try_to_fix_with_gpt: bool = True -) -> Dict[Any, Any]: - """Fix and parse JSON string - - Args: - json_to_load (str): The JSON string. - try_to_fix_with_gpt (bool, optional): Try to fix the JSON with GPT. - Defaults to True. - - Returns: - str or dict[Any, Any]: The parsed JSON. - """ - - with contextlib.suppress(json.JSONDecodeError): - json_to_load = json_to_load.replace("\t", "") - return json.loads(json_to_load) - - with contextlib.suppress(json.JSONDecodeError): - json_to_load = correct_json(json_to_load) - return json.loads(json_to_load) - # Let's do something manually: - # sometimes GPT responds with something BEFORE the braces: - # "I'm sorry, I don't understand. Please try again." - # {"text": "I'm sorry, I don't understand. Please try again.", - # "confidence": 0.0} - # So let's try to find the first brace and then parse the rest - # of the string - try: - brace_index = json_to_load.index("{") - maybe_fixed_json = json_to_load[brace_index:] - last_brace_index = maybe_fixed_json.rindex("}") - maybe_fixed_json = maybe_fixed_json[: last_brace_index + 1] - return json.loads(maybe_fixed_json) - except (json.JSONDecodeError, ValueError) as e: - return try_ai_fix(try_to_fix_with_gpt, e, json_to_load) - - -def try_ai_fix( - try_to_fix_with_gpt: bool, exception: Exception, json_to_load: str -) -> Dict[Any, Any]: - """Try to fix the JSON with the AI - - Args: - try_to_fix_with_gpt (bool): Whether to try to fix the JSON with the AI. - exception (Exception): The exception that was raised. - json_to_load (str): The JSON string to load. - - Raises: - exception: If try_to_fix_with_gpt is False. - - Returns: - str or dict[Any, Any]: The JSON string or dictionary. - """ - if not try_to_fix_with_gpt: - raise exception - if CFG.debug_mode: - logger.warn( - "Warning: Failed to parse AI output, attempting to fix." - "\n If you see this warning frequently, it's likely that" - " your prompt is confusing the AI. Try changing it up" - " slightly." - ) - # Now try to fix this up using the ai_functions - ai_fixed_json = auto_fix_json(json_to_load, JSON_SCHEMA) - - if ai_fixed_json != "failed": - return json.loads(ai_fixed_json) - # This allows the AI to react to the error message, - # which usually results in it correcting its ways. - # logger.error("Failed to fix AI output, telling the AI.") - return {} - - -def attempt_to_fix_json_by_finding_outermost_brackets(json_string: str): - if CFG.speak_mode and CFG.debug_mode: - say_text( - "I have received an invalid JSON response from the OpenAI API. " - "Trying to fix it now." - ) - logger.error("Attempting to fix JSON by finding outermost brackets\n") - - try: - json_pattern = regex.compile(r"\{(?:[^{}]|(?R))*\}") - json_match = json_pattern.search(json_string) - - if json_match: - # Extract the valid JSON object from the string - json_string = json_match.group(0) - logger.typewriter_log( - title="Apparently json was fixed.", title_color=Fore.GREEN - ) - if CFG.speak_mode and CFG.debug_mode: - say_text("Apparently json was fixed.") - else: - return {} - - except (json.JSONDecodeError, ValueError): - if CFG.debug_mode: - logger.error(f"Error: Invalid JSON: {json_string}\n") - if CFG.speak_mode: - say_text("Didn't work. I will have to ignore this response then.") - logger.error("Error: Invalid JSON, setting it to empty JSON now.\n") - json_string = {} - - return fix_and_parse_json(json_string) diff --git a/spaces/Pengyey/bingo-chuchu/src/components/voice.tsx b/spaces/Pengyey/bingo-chuchu/src/components/voice.tsx deleted file mode 100644 index ab886394487445e4b0675770b76096bba0e61b0e..0000000000000000000000000000000000000000 --- a/spaces/Pengyey/bingo-chuchu/src/components/voice.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import React, { useEffect } from 'react' -import { useSetAtom } from 'jotai' -import { useBing } from '@/lib/hooks/use-bing' -import Image from 'next/image' -import VoiceIcon from '@/assets/images/voice.svg' -import VoiceButton from './ui/voice' -import { SR } from '@/lib/bots/bing/sr' -import { voiceListenAtom } from '@/state' - -const sr = new SR(['发送', '清空', '退出']) - -const Voice = ({ setInput, input, sendMessage, isSpeaking }: Pick, 'setInput' | 'sendMessage' | 'input' | 'isSpeaking'>) => { - const setListen = useSetAtom(voiceListenAtom) - useEffect(() => { - if (sr.listening) return - sr.transcript = !isSpeaking - }, [isSpeaking]) - - useEffect(() => { - sr.onchange = (msg: string, command?: string) => { - switch (command) { - case '退出': - sr.stop() - break; - case '发送': - sendMessage(input) - case '清空': - setInput('') - break; - default: - setInput(input + msg) - } - } - }, [input, setInput, sendMessage]) - - const switchSR = (enable: boolean = false) => { - setListen(enable) - if (enable) { - sr.start() - } else { - sr.stop() - } - } - - return sr.listening ? ( - switchSR(false)} /> - ) : ( - start voice switchSR(true)} /> - ) -}; - -export default Voice; diff --git a/spaces/Pie31415/control-animation/annotator/uniformer/mmcv/utils/__init__.py b/spaces/Pie31415/control-animation/annotator/uniformer/mmcv/utils/__init__.py deleted file mode 100644 index 378a0068432a371af364de9d73785901c0f83383..0000000000000000000000000000000000000000 --- a/spaces/Pie31415/control-animation/annotator/uniformer/mmcv/utils/__init__.py +++ /dev/null @@ -1,69 +0,0 @@ -# flake8: noqa -# Copyright (c) OpenMMLab. All rights reserved. -from .config import Config, ConfigDict, DictAction -from .misc import (check_prerequisites, concat_list, deprecated_api_warning, - has_method, import_modules_from_strings, is_list_of, - is_method_overridden, is_seq_of, is_str, is_tuple_of, - iter_cast, list_cast, requires_executable, requires_package, - slice_list, to_1tuple, to_2tuple, to_3tuple, to_4tuple, - to_ntuple, tuple_cast) -from .path import (check_file_exist, fopen, is_filepath, mkdir_or_exist, - scandir, symlink) -from .progressbar import (ProgressBar, track_iter_progress, - track_parallel_progress, track_progress) -from .testing import (assert_attrs_equal, assert_dict_contains_subset, - assert_dict_has_keys, assert_is_norm_layer, - assert_keys_equal, assert_params_all_zeros, - check_python_script) -from .timer import Timer, TimerError, check_time -from .version_utils import digit_version, get_git_hash - -try: - import torch -except ImportError: - __all__ = [ - 'Config', 'ConfigDict', 'DictAction', 'is_str', 'iter_cast', - 'list_cast', 'tuple_cast', 'is_seq_of', 'is_list_of', 'is_tuple_of', - 'slice_list', 'concat_list', 'check_prerequisites', 'requires_package', - 'requires_executable', 'is_filepath', 'fopen', 'check_file_exist', - 'mkdir_or_exist', 'symlink', 'scandir', 'ProgressBar', - 'track_progress', 'track_iter_progress', 'track_parallel_progress', - 'Timer', 'TimerError', 'check_time', 'deprecated_api_warning', - 'digit_version', 'get_git_hash', 'import_modules_from_strings', - 'assert_dict_contains_subset', 'assert_attrs_equal', - 'assert_dict_has_keys', 'assert_keys_equal', 'check_python_script', - 'to_1tuple', 'to_2tuple', 'to_3tuple', 'to_4tuple', 'to_ntuple', - 'is_method_overridden', 'has_method' - ] -else: - from .env import collect_env - from .logging import get_logger, print_log - from .parrots_jit import jit, skip_no_elena - from .parrots_wrapper import ( - TORCH_VERSION, BuildExtension, CppExtension, CUDAExtension, DataLoader, - PoolDataLoader, SyncBatchNorm, _AdaptiveAvgPoolNd, _AdaptiveMaxPoolNd, - _AvgPoolNd, _BatchNorm, _ConvNd, _ConvTransposeMixin, _InstanceNorm, - _MaxPoolNd, get_build_config, is_rocm_pytorch, _get_cuda_home) - from .registry import Registry, build_from_cfg - from .trace import is_jit_tracing - __all__ = [ - 'Config', 'ConfigDict', 'DictAction', 'collect_env', 'get_logger', - 'print_log', 'is_str', 'iter_cast', 'list_cast', 'tuple_cast', - 'is_seq_of', 'is_list_of', 'is_tuple_of', 'slice_list', 'concat_list', - 'check_prerequisites', 'requires_package', 'requires_executable', - 'is_filepath', 'fopen', 'check_file_exist', 'mkdir_or_exist', - 'symlink', 'scandir', 'ProgressBar', 'track_progress', - 'track_iter_progress', 'track_parallel_progress', 'Registry', - 'build_from_cfg', 'Timer', 'TimerError', 'check_time', 'SyncBatchNorm', - '_AdaptiveAvgPoolNd', '_AdaptiveMaxPoolNd', '_AvgPoolNd', '_BatchNorm', - '_ConvNd', '_ConvTransposeMixin', '_InstanceNorm', '_MaxPoolNd', - 'get_build_config', 'BuildExtension', 'CppExtension', 'CUDAExtension', - 'DataLoader', 'PoolDataLoader', 'TORCH_VERSION', - 'deprecated_api_warning', 'digit_version', 'get_git_hash', - 'import_modules_from_strings', 'jit', 'skip_no_elena', - 'assert_dict_contains_subset', 'assert_attrs_equal', - 'assert_dict_has_keys', 'assert_keys_equal', 'assert_is_norm_layer', - 'assert_params_all_zeros', 'check_python_script', - 'is_method_overridden', 'is_jit_tracing', 'is_rocm_pytorch', - '_get_cuda_home', 'has_method' - ] diff --git a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_vendor/resolvelib/compat/collections_abc.py b/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_vendor/resolvelib/compat/collections_abc.py deleted file mode 100644 index 1becc5093c5ab8e196bb9fee415e2381e7158fc3..0000000000000000000000000000000000000000 --- a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_vendor/resolvelib/compat/collections_abc.py +++ /dev/null @@ -1,6 +0,0 @@ -__all__ = ["Mapping", "Sequence"] - -try: - from collections.abc import Mapping, Sequence -except ImportError: - from collections import Mapping, Sequence diff --git a/spaces/Realcat/image-matching-webui/third_party/DKM/dkm/train/train.py b/spaces/Realcat/image-matching-webui/third_party/DKM/dkm/train/train.py deleted file mode 100644 index b580221f56a2667784836f0237955cc75131b88c..0000000000000000000000000000000000000000 --- a/spaces/Realcat/image-matching-webui/third_party/DKM/dkm/train/train.py +++ /dev/null @@ -1,67 +0,0 @@ -from tqdm import tqdm -from dkm.utils.utils import to_cuda - - -def train_step(train_batch, model, objective, optimizer, **kwargs): - optimizer.zero_grad() - out = model(train_batch) - l = objective(out, train_batch) - l.backward() - optimizer.step() - return {"train_out": out, "train_loss": l.item()} - - -def train_k_steps( - n_0, k, dataloader, model, objective, optimizer, lr_scheduler, progress_bar=True -): - for n in tqdm(range(n_0, n_0 + k), disable=not progress_bar): - batch = next(dataloader) - model.train(True) - batch = to_cuda(batch) - train_step( - train_batch=batch, - model=model, - objective=objective, - optimizer=optimizer, - lr_scheduler=lr_scheduler, - n=n, - ) - lr_scheduler.step() - - -def train_epoch( - dataloader=None, - model=None, - objective=None, - optimizer=None, - lr_scheduler=None, - epoch=None, -): - model.train(True) - print(f"At epoch {epoch}") - for batch in tqdm(dataloader, mininterval=5.0): - batch = to_cuda(batch) - train_step( - train_batch=batch, model=model, objective=objective, optimizer=optimizer - ) - lr_scheduler.step() - return { - "model": model, - "optimizer": optimizer, - "lr_scheduler": lr_scheduler, - "epoch": epoch, - } - - -def train_k_epochs( - start_epoch, end_epoch, dataloader, model, objective, optimizer, lr_scheduler -): - for epoch in range(start_epoch, end_epoch + 1): - train_epoch( - dataloader=dataloader, - model=model, - objective=objective, - optimizer=optimizer, - lr_scheduler=lr_scheduler, - epoch=epoch, - ) diff --git a/spaces/Reeve/Ohayou_Face/models/mtcnn/mtcnn_pytorch/src/box_utils.py b/spaces/Reeve/Ohayou_Face/models/mtcnn/mtcnn_pytorch/src/box_utils.py deleted file mode 100644 index 1e8081b73639a7d70e4391b3d45417569550ddc6..0000000000000000000000000000000000000000 --- a/spaces/Reeve/Ohayou_Face/models/mtcnn/mtcnn_pytorch/src/box_utils.py +++ /dev/null @@ -1,238 +0,0 @@ -import numpy as np -from PIL import Image - - -def nms(boxes, overlap_threshold=0.5, mode='union'): - """Non-maximum suppression. - - Arguments: - boxes: a float numpy array of shape [n, 5], - where each row is (xmin, ymin, xmax, ymax, score). - overlap_threshold: a float number. - mode: 'union' or 'min'. - - Returns: - list with indices of the selected boxes - """ - - # if there are no boxes, return the empty list - if len(boxes) == 0: - return [] - - # list of picked indices - pick = [] - - # grab the coordinates of the bounding boxes - x1, y1, x2, y2, score = [boxes[:, i] for i in range(5)] - - area = (x2 - x1 + 1.0) * (y2 - y1 + 1.0) - ids = np.argsort(score) # in increasing order - - while len(ids) > 0: - - # grab index of the largest value - last = len(ids) - 1 - i = ids[last] - pick.append(i) - - # compute intersections - # of the box with the largest score - # with the rest of boxes - - # left top corner of intersection boxes - ix1 = np.maximum(x1[i], x1[ids[:last]]) - iy1 = np.maximum(y1[i], y1[ids[:last]]) - - # right bottom corner of intersection boxes - ix2 = np.minimum(x2[i], x2[ids[:last]]) - iy2 = np.minimum(y2[i], y2[ids[:last]]) - - # width and height of intersection boxes - w = np.maximum(0.0, ix2 - ix1 + 1.0) - h = np.maximum(0.0, iy2 - iy1 + 1.0) - - # intersections' areas - inter = w * h - if mode == 'min': - overlap = inter / np.minimum(area[i], area[ids[:last]]) - elif mode == 'union': - # intersection over union (IoU) - overlap = inter / (area[i] + area[ids[:last]] - inter) - - # delete all boxes where overlap is too big - ids = np.delete( - ids, - np.concatenate([[last], np.where(overlap > overlap_threshold)[0]]) - ) - - return pick - - -def convert_to_square(bboxes): - """Convert bounding boxes to a square form. - - Arguments: - bboxes: a float numpy array of shape [n, 5]. - - Returns: - a float numpy array of shape [n, 5], - squared bounding boxes. - """ - - square_bboxes = np.zeros_like(bboxes) - x1, y1, x2, y2 = [bboxes[:, i] for i in range(4)] - h = y2 - y1 + 1.0 - w = x2 - x1 + 1.0 - max_side = np.maximum(h, w) - square_bboxes[:, 0] = x1 + w * 0.5 - max_side * 0.5 - square_bboxes[:, 1] = y1 + h * 0.5 - max_side * 0.5 - square_bboxes[:, 2] = square_bboxes[:, 0] + max_side - 1.0 - square_bboxes[:, 3] = square_bboxes[:, 1] + max_side - 1.0 - return square_bboxes - - -def calibrate_box(bboxes, offsets): - """Transform bounding boxes to be more like true bounding boxes. - 'offsets' is one of the outputs of the nets. - - Arguments: - bboxes: a float numpy array of shape [n, 5]. - offsets: a float numpy array of shape [n, 4]. - - Returns: - a float numpy array of shape [n, 5]. - """ - x1, y1, x2, y2 = [bboxes[:, i] for i in range(4)] - w = x2 - x1 + 1.0 - h = y2 - y1 + 1.0 - w = np.expand_dims(w, 1) - h = np.expand_dims(h, 1) - - # this is what happening here: - # tx1, ty1, tx2, ty2 = [offsets[:, i] for i in range(4)] - # x1_true = x1 + tx1*w - # y1_true = y1 + ty1*h - # x2_true = x2 + tx2*w - # y2_true = y2 + ty2*h - # below is just more compact form of this - - # are offsets always such that - # x1 < x2 and y1 < y2 ? - - translation = np.hstack([w, h, w, h]) * offsets - bboxes[:, 0:4] = bboxes[:, 0:4] + translation - return bboxes - - -def get_image_boxes(bounding_boxes, img, size=24): - """Cut out boxes from the image. - - Arguments: - bounding_boxes: a float numpy array of shape [n, 5]. - img: an instance of PIL.Image. - size: an integer, size of cutouts. - - Returns: - a float numpy array of shape [n, 3, size, size]. - """ - - num_boxes = len(bounding_boxes) - width, height = img.size - - [dy, edy, dx, edx, y, ey, x, ex, w, h] = correct_bboxes(bounding_boxes, width, height) - img_boxes = np.zeros((num_boxes, 3, size, size), 'float32') - - for i in range(num_boxes): - img_box = np.zeros((h[i], w[i], 3), 'uint8') - - img_array = np.asarray(img, 'uint8') - img_box[dy[i]:(edy[i] + 1), dx[i]:(edx[i] + 1), :] = \ - img_array[y[i]:(ey[i] + 1), x[i]:(ex[i] + 1), :] - - # resize - img_box = Image.fromarray(img_box) - img_box = img_box.resize((size, size), Image.BILINEAR) - img_box = np.asarray(img_box, 'float32') - - img_boxes[i, :, :, :] = _preprocess(img_box) - - return img_boxes - - -def correct_bboxes(bboxes, width, height): - """Crop boxes that are too big and get coordinates - with respect to cutouts. - - Arguments: - bboxes: a float numpy array of shape [n, 5], - where each row is (xmin, ymin, xmax, ymax, score). - width: a float number. - height: a float number. - - Returns: - dy, dx, edy, edx: a int numpy arrays of shape [n], - coordinates of the boxes with respect to the cutouts. - y, x, ey, ex: a int numpy arrays of shape [n], - corrected ymin, xmin, ymax, xmax. - h, w: a int numpy arrays of shape [n], - just heights and widths of boxes. - - in the following order: - [dy, edy, dx, edx, y, ey, x, ex, w, h]. - """ - - x1, y1, x2, y2 = [bboxes[:, i] for i in range(4)] - w, h = x2 - x1 + 1.0, y2 - y1 + 1.0 - num_boxes = bboxes.shape[0] - - # 'e' stands for end - # (x, y) -> (ex, ey) - x, y, ex, ey = x1, y1, x2, y2 - - # we need to cut out a box from the image. - # (x, y, ex, ey) are corrected coordinates of the box - # in the image. - # (dx, dy, edx, edy) are coordinates of the box in the cutout - # from the image. - dx, dy = np.zeros((num_boxes,)), np.zeros((num_boxes,)) - edx, edy = w.copy() - 1.0, h.copy() - 1.0 - - # if box's bottom right corner is too far right - ind = np.where(ex > width - 1.0)[0] - edx[ind] = w[ind] + width - 2.0 - ex[ind] - ex[ind] = width - 1.0 - - # if box's bottom right corner is too low - ind = np.where(ey > height - 1.0)[0] - edy[ind] = h[ind] + height - 2.0 - ey[ind] - ey[ind] = height - 1.0 - - # if box's top left corner is too far left - ind = np.where(x < 0.0)[0] - dx[ind] = 0.0 - x[ind] - x[ind] = 0.0 - - # if box's top left corner is too high - ind = np.where(y < 0.0)[0] - dy[ind] = 0.0 - y[ind] - y[ind] = 0.0 - - return_list = [dy, edy, dx, edx, y, ey, x, ex, w, h] - return_list = [i.astype('int32') for i in return_list] - - return return_list - - -def _preprocess(img): - """Preprocessing step before feeding the network. - - Arguments: - img: a float numpy array of shape [h, w, c]. - - Returns: - a float numpy array of shape [1, c, h, w]. - """ - img = img.transpose((2, 0, 1)) - img = np.expand_dims(img, 0) - img = (img - 127.5) * 0.0078125 - return img diff --git a/spaces/Robert001/UniControl-Demo/annotator/uniformer/mmcv/engine/__init__.py b/spaces/Robert001/UniControl-Demo/annotator/uniformer/mmcv/engine/__init__.py deleted file mode 100644 index 3193b7f664e19ce2458d81c836597fa22e4bb082..0000000000000000000000000000000000000000 --- a/spaces/Robert001/UniControl-Demo/annotator/uniformer/mmcv/engine/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -from .test import (collect_results_cpu, collect_results_gpu, multi_gpu_test, - single_gpu_test) - -__all__ = [ - 'collect_results_cpu', 'collect_results_gpu', 'multi_gpu_test', - 'single_gpu_test' -] diff --git a/spaces/Rongjiehuang/GenerSpeech/modules/GenerSpeech/task/dataset.py b/spaces/Rongjiehuang/GenerSpeech/modules/GenerSpeech/task/dataset.py deleted file mode 100644 index 0b1f6fa2c596a23b9bc49ad470c1723d3597d738..0000000000000000000000000000000000000000 --- a/spaces/Rongjiehuang/GenerSpeech/modules/GenerSpeech/task/dataset.py +++ /dev/null @@ -1,193 +0,0 @@ -import matplotlib -matplotlib.use('Agg') -from tasks.base_task import data_loader -from tasks.tts.fs2 import FastSpeech2Task -from tasks.tts.dataset_utils import FastSpeechDataset, BaseTTSDataset -import glob -import importlib -from utils.pitch_utils import norm_interp_f0, denorm_f0, f0_to_coarse -from inference.base_tts_infer import load_data_preprocessor -from data_gen.tts.emotion import inference as EmotionEncoder -from data_gen.tts.emotion.inference import embed_utterance as Embed_utterance -from data_gen.tts.emotion.inference import preprocess_wav -from tqdm import tqdm -from utils.hparams import hparams -from data_gen.tts.data_gen_utils import build_phone_encoder, build_word_encoder -import random -import torch -import torch.optim -import torch.nn.functional as F -import torch.utils.data -from utils.indexed_datasets import IndexedDataset -from resemblyzer import VoiceEncoder -import torch.distributions -import numpy as np -import utils -import os - - - -class GenerSpeech_dataset(BaseTTSDataset): - def __init__(self, prefix, shuffle=False, test_items=None, test_sizes=None, data_dir=None): - super().__init__(prefix, shuffle, test_items, test_sizes, data_dir) - self.f0_mean, self.f0_std = hparams.get('f0_mean', None), hparams.get('f0_std', None) - if prefix == 'valid': - indexed_ds = IndexedDataset(f'{self.data_dir}/train') - sizes = np.load(f'{self.data_dir}/train_lengths.npy') - index = [i for i in range(len(indexed_ds))] - random.shuffle(index) - index = index[:300] - self.sizes = sizes[index] - self.indexed_ds = [] - for i in index: - self.indexed_ds.append(indexed_ds[i]) - self.avail_idxs = list(range(len(self.sizes))) - if hparams['min_frames'] > 0: - self.avail_idxs = [x for x in self.avail_idxs if self.sizes[x] >= hparams['min_frames']] - self.sizes = [self.sizes[i] for i in self.avail_idxs] - - if prefix == 'test' and hparams['test_input_dir'] != '': - self.preprocessor, self.preprocess_args = load_data_preprocessor() - self.indexed_ds, self.sizes = self.load_test_inputs(hparams['test_input_dir']) - self.avail_idxs = [i for i, _ in enumerate(self.sizes)] - - - def load_test_inputs(self, test_input_dir): - inp_wav_paths = sorted(glob.glob(f'{test_input_dir}/*.wav') + glob.glob(f'{test_input_dir}/*.mp3')) - binarizer_cls = hparams.get("binarizer_cls", 'data_gen.tts.base_binarizerr.BaseBinarizer') - pkg = ".".join(binarizer_cls.split(".")[:-1]) - cls_name = binarizer_cls.split(".")[-1] - binarizer_cls = getattr(importlib.import_module(pkg), cls_name) - - phone_encoder = build_phone_encoder(hparams['binary_data_dir']) - word_encoder = build_word_encoder(hparams['binary_data_dir']) - voice_encoder = VoiceEncoder().cuda() - - encoder = [phone_encoder, word_encoder] - sizes = [] - items = [] - EmotionEncoder.load_model(hparams['emotion_encoder_path']) - preprocessor, preprocess_args = self.preprocessor, self.preprocess_args - - for wav_fn in tqdm(inp_wav_paths): - item_name = wav_fn[len(test_input_dir) + 1:].replace("/", "_") - spk_id = emotion = 0 - item2tgfn = wav_fn.replace('.wav', '.TextGrid') # prepare textgrid alignment - txtpath = wav_fn.replace('.wav', '.txt') # prepare text - with open(txtpath, 'r') as f: - text_raw = f.readlines() - f.close() - ph, txt = preprocessor.txt_to_ph(preprocessor.txt_processor, text_raw[0], preprocess_args) - - item = binarizer_cls.process_item(item_name, ph, txt, item2tgfn, wav_fn, spk_id, emotion, encoder, hparams['binarization_args']) - item['emo_embed'] = Embed_utterance(preprocess_wav(item['wav_fn'])) - item['spk_embed'] = voice_encoder.embed_utterance(item['wav']) - items.append(item) - sizes.append(item['len']) - return items, sizes - - def _get_item(self, index): - if hasattr(self, 'avail_idxs') and self.avail_idxs is not None: - index = self.avail_idxs[index] - if self.indexed_ds is None: - self.indexed_ds = IndexedDataset(f'{self.data_dir}/{self.prefix}') - return self.indexed_ds[index] - - def __getitem__(self, index): - hparams = self.hparams - item = self._get_item(index) - assert len(item['mel']) == self.sizes[index], (len(item['mel']), self.sizes[index]) - max_frames = hparams['max_frames'] - spec = torch.Tensor(item['mel'])[:max_frames] - max_frames = spec.shape[0] // hparams['frames_multiple'] * hparams['frames_multiple'] - spec = spec[:max_frames] - phone = torch.LongTensor(item['phone'][:hparams['max_input_tokens']]) - sample = { - "id": index, - "item_name": item['item_name'], - "text": item['txt'], - "txt_token": phone, - "mel": spec, - "mel_nonpadding": spec.abs().sum(-1) > 0, - } - spec = sample['mel'] - T = spec.shape[0] - sample['mel2ph'] = mel2ph = torch.LongTensor(item['mel2ph'])[:T] if 'mel2ph' in item else None - if hparams['use_pitch_embed']: - assert 'f0' in item - if hparams.get('normalize_pitch', False): - f0 = item["f0"] - if len(f0 > 0) > 0 and f0[f0 > 0].std() > 0: - f0[f0 > 0] = (f0[f0 > 0] - f0[f0 > 0].mean()) / f0[f0 > 0].std() * hparams['f0_std'] + \ - hparams['f0_mean'] - f0[f0 > 0] = f0[f0 > 0].clip(min=60, max=500) - pitch = f0_to_coarse(f0) - pitch = torch.LongTensor(pitch[:max_frames]) - else: - pitch = torch.LongTensor(item.get("pitch"))[:max_frames] if "pitch" in item else None - f0, uv = norm_interp_f0(item["f0"][:max_frames], hparams) - uv = torch.FloatTensor(uv) - f0 = torch.FloatTensor(f0) - else: - f0 = uv = torch.zeros_like(mel2ph) - pitch = None - sample["f0"], sample["uv"], sample["pitch"] = f0, uv, pitch - sample["spk_embed"] = torch.Tensor(item['spk_embed']) - sample["emotion"] = item['emotion'] - sample["emo_embed"] = torch.Tensor(item['emo_embed']) - - if hparams.get('use_word', False): - sample["ph_words"] = item["ph_words"] - sample["word_tokens"] = torch.LongTensor(item["word_tokens"]) - sample["mel2word"] = torch.LongTensor(item.get("mel2word"))[:max_frames] - sample["ph2word"] = torch.LongTensor(item['ph2word'][:hparams['max_input_tokens']]) - return sample - - def collater(self, samples): - if len(samples) == 0: - return {} - hparams = self.hparams - id = torch.LongTensor([s['id'] for s in samples]) - item_names = [s['item_name'] for s in samples] - text = [s['text'] for s in samples] - txt_tokens = utils.collate_1d([s['txt_token'] for s in samples], 0) - mels = utils.collate_2d([s['mel'] for s in samples], 0.0) - txt_lengths = torch.LongTensor([s['txt_token'].numel() for s in samples]) - mel_lengths = torch.LongTensor([s['mel'].shape[0] for s in samples]) - - batch = { - 'id': id, - 'item_name': item_names, - 'nsamples': len(samples), - 'text': text, - 'txt_tokens': txt_tokens, - 'txt_lengths': txt_lengths, - 'mels': mels, - 'mel_lengths': mel_lengths, - } - - f0 = utils.collate_1d([s['f0'] for s in samples], 0.0) - pitch = utils.collate_1d([s['pitch'] for s in samples]) if samples[0]['pitch'] is not None else None - uv = utils.collate_1d([s['uv'] for s in samples]) - mel2ph = utils.collate_1d([s['mel2ph'] for s in samples], 0.0) if samples[0]['mel2ph'] is not None else None - batch.update({ - 'mel2ph': mel2ph, - 'pitch': pitch, - 'f0': f0, - 'uv': uv, - }) - spk_embed = torch.stack([s['spk_embed'] for s in samples]) - batch['spk_embed'] = spk_embed - emo_embed = torch.stack([s['emo_embed'] for s in samples]) - batch['emo_embed'] = emo_embed - - if hparams.get('use_word', False): - ph_words = [s['ph_words'] for s in samples] - batch['ph_words'] = ph_words - word_tokens = utils.collate_1d([s['word_tokens'] for s in samples], 0) - batch['word_tokens'] = word_tokens - mel2word = utils.collate_1d([s['mel2word'] for s in samples], 0) - batch['mel2word'] = mel2word - ph2word = utils.collate_1d([s['ph2word'] for s in samples], 0) - batch['ph2word'] = ph2word - return batch \ No newline at end of file diff --git a/spaces/Rothfeld/stable-diffusion-mat-outpainting-primer/torch_utils/ops/fma.py b/spaces/Rothfeld/stable-diffusion-mat-outpainting-primer/torch_utils/ops/fma.py deleted file mode 100644 index 2eeac58a626c49231e04122b93e321ada954c5d3..0000000000000000000000000000000000000000 --- a/spaces/Rothfeld/stable-diffusion-mat-outpainting-primer/torch_utils/ops/fma.py +++ /dev/null @@ -1,60 +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. - -"""Fused multiply-add, with slightly faster gradients than `torch.addcmul()`.""" - -import torch - -#---------------------------------------------------------------------------- - -def fma(a, b, c): # => a * b + c - return _FusedMultiplyAdd.apply(a, b, c) - -#---------------------------------------------------------------------------- - -class _FusedMultiplyAdd(torch.autograd.Function): # a * b + c - @staticmethod - def forward(ctx, a, b, c): # pylint: disable=arguments-differ - out = torch.addcmul(c, a, b) - ctx.save_for_backward(a, b) - ctx.c_shape = c.shape - return out - - @staticmethod - def backward(ctx, dout): # pylint: disable=arguments-differ - a, b = ctx.saved_tensors - c_shape = ctx.c_shape - da = None - db = None - dc = None - - if ctx.needs_input_grad[0]: - da = _unbroadcast(dout * b, a.shape) - - if ctx.needs_input_grad[1]: - db = _unbroadcast(dout * a, b.shape) - - if ctx.needs_input_grad[2]: - dc = _unbroadcast(dout, c_shape) - - return da, db, dc - -#---------------------------------------------------------------------------- - -def _unbroadcast(x, shape): - extra_dims = x.ndim - len(shape) - assert extra_dims >= 0 - dim = [i for i in range(x.ndim) if x.shape[i] > 1 and (i < extra_dims or shape[i - extra_dims] == 1)] - if len(dim): - x = x.sum(dim=dim, keepdim=True) - if extra_dims: - x = x.reshape(-1, *x.shape[extra_dims+1:]) - assert x.shape == shape - return x - -#---------------------------------------------------------------------------- diff --git a/spaces/Ryukijano/jax-diffusers-event-canny-coyo1m/app.py b/spaces/Ryukijano/jax-diffusers-event-canny-coyo1m/app.py deleted file mode 100644 index 07bb6439ef3df3074148ab01313165d031f39808..0000000000000000000000000000000000000000 --- a/spaces/Ryukijano/jax-diffusers-event-canny-coyo1m/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/jax-diffusers-event/canny-coyo1m").launch() \ No newline at end of file diff --git a/spaces/SamerKharboush/chatGPT-Sam-Turbo/assets/custom.css b/spaces/SamerKharboush/chatGPT-Sam-Turbo/assets/custom.css deleted file mode 100644 index 7a08a3878ec520619245eef7704b66f6f2b5f5ed..0000000000000000000000000000000000000000 --- a/spaces/SamerKharboush/chatGPT-Sam-Turbo/assets/custom.css +++ /dev/null @@ -1,239 +0,0 @@ -:root { - --chatbot-color-light: #F3F3F3; - --chatbot-color-dark: #121111; -} - -/* 覆盖gradio的页脚信息QAQ */ -footer { - display: none !important; -} -#footer{ - text-align: center; -} -#footer div{ - display: inline-block; -} -#footer .versions{ - font-size: 85%; - opacity: 0.85; -} - -/* status_display */ -#status_display { - display: flex; - min-height: 2.5em; - align-items: flex-end; - justify-content: flex-end; -} -#status_display p { - font-size: .85em; - font-family: monospace; - color: var(--body-text-color-subdued); -} - -#chuanhu_chatbot, #status_display { - transition: all 0.6s; -} - -/* usage_display */ -#usage_display { - position: relative; - margin: 0; - box-shadow: var(--block-shadow); - border-width: var(--block-border-width); - border-color: var(--block-border-color); - border-radius: var(--block-radius); - background: var(--block-background-fill); - width: 100%; - line-height: var(--line-sm); - min-height: 2em; -} -#usage_display p, #usage_display span { - margin: 0; - padding: .5em 1em; - font-size: .85em; - color: var(--body-text-color-subdued); -} -.progress-bar { - background-color: var(--input-background-fill);; - margin: 0 1em; - height: 20px; - border-radius: 10px; - overflow: hidden; -} -.progress { - background-color: var(--block-title-background-fill);; - height: 100%; - border-radius: 10px; - text-align: right; - transition: width 0.5s ease-in-out; -} -.progress-text { - /* color: white; */ - color: var(--color-accent) !important; - font-size: 1em !important; - font-weight: bold; - padding-right: 10px; - line-height: 20px; -} -/* list */ -ol:not(.options), ul:not(.options) { - padding-inline-start: 2em !important; -} - -/* 亮色 */ -@media (prefers-color-scheme: light) { - #chuanhu_chatbot { - background-color: var(--chatbot-color-light) !important; - color: #000000 !important; - } - [data-testid = "bot"] { - background-color: ##b2a361 !important; - } - [data-testid = "user"] { - background-color: #95EC69 !important; - } -} -/* 暗色 */ -@media (prefers-color-scheme: dark) { - #chuanhu_chatbot { - background-color: var(--chatbot-color-dark) !important; - color: #FFFFFF !important; - } - [data-testid = "bot"] { - background-color: #b2a361 !important; - } - [data-testid = "user"] { - background-color: #26B561 !important; - } - body { - background-color: var(--neutral-950) !important; - } -} - -/* 对话气泡 */ -[class *= "message"] { - border-radius: var(--radius-xl) !important; - border: none; - padding: var(--spacing-xl) !important; - font-size: var(--text-md) !important; - line-height: var(--line-md) !important; - min-height: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl)); - min-width: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl)); -} -[data-testid = "bot"] { - max-width: 85%; - border-bottom-left-radius: 0 !important; -} -[data-testid = "user"] { - max-width: 85%; - width: auto !important; - border-bottom-right-radius: 0 !important; -} -/* 表格 */ -table { - margin: 1em 0; - border-collapse: collapse; - empty-cells: show; -} -td,th { - border: 1.2px solid var(--border-color-primary) !important; - padding: 0.2em; -} -thead { - background-color: rgba(175,184,193,0.2); -} -thead th { - padding: .5em .2em; -} -/* 行内代码 */ -code { - display: inline; - white-space: break-spaces; - border-radius: 6px; - margin: 0 2px 0 2px; - padding: .2em .4em .1em .4em; - background-color: rgba(175,184,193,0.2); -} -/* 代码块 */ -pre code { - display: block; - overflow: auto; - white-space: pre; - background-color: hsla(0, 0%, 0%, 80%)!important; - border-radius: 10px; - padding: 1.4em 1.2em 0em 1.4em; - margin: 1.2em 2em 1.2em 0.5em; - color: #FFF; - box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2); -} -/* 代码高亮样式 */ -.highlight .hll { background-color: #49483e } -.highlight .c { color: #75715e } /* Comment */ -.highlight .err { color: #960050; background-color: #1e0010 } /* Error */ -.highlight .k { color: #66d9ef } /* Keyword */ -.highlight .l { color: #ae81ff } /* Literal */ -.highlight .n { color: #f8f8f2 } /* Name */ -.highlight .o { color: #f92672 } /* Operator */ -.highlight .p { color: #f8f8f2 } /* Punctuation */ -.highlight .ch { color: #75715e } /* Comment.Hashbang */ -.highlight .cm { color: #75715e } /* Comment.Multiline */ -.highlight .cp { color: #75715e } /* Comment.Preproc */ -.highlight .cpf { color: #75715e } /* Comment.PreprocFile */ -.highlight .c1 { color: #75715e } /* Comment.Single */ -.highlight .cs { color: #75715e } /* Comment.Special */ -.highlight .gd { color: #f92672 } /* Generic.Deleted */ -.highlight .ge { font-style: italic } /* Generic.Emph */ -.highlight .gi { color: #a6e22e } /* Generic.Inserted */ -.highlight .gs { font-weight: bold } /* Generic.Strong */ -.highlight .gu { color: #75715e } /* Generic.Subheading */ -.highlight .kc { color: #66d9ef } /* Keyword.Constant */ -.highlight .kd { color: #66d9ef } /* Keyword.Declaration */ -.highlight .kn { color: #f92672 } /* Keyword.Namespace */ -.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */ -.highlight .kr { color: #66d9ef } /* Keyword.Reserved */ -.highlight .kt { color: #66d9ef } /* Keyword.Type */ -.highlight .ld { color: #e6db74 } /* Literal.Date */ -.highlight .m { color: #ae81ff } /* Literal.Number */ -.highlight .s { color: #e6db74 } /* Literal.String */ -.highlight .na { color: #a6e22e } /* Name.Attribute */ -.highlight .nb { color: #f8f8f2 } /* Name.Builtin */ -.highlight .nc { color: #a6e22e } /* Name.Class */ -.highlight .no { color: #66d9ef } /* Name.Constant */ -.highlight .nd { color: #a6e22e } /* Name.Decorator */ -.highlight .ni { color: #f8f8f2 } /* Name.Entity */ -.highlight .ne { color: #a6e22e } /* Name.Exception */ -.highlight .nf { color: #a6e22e } /* Name.Function */ -.highlight .nl { color: #f8f8f2 } /* Name.Label */ -.highlight .nn { color: #f8f8f2 } /* Name.Namespace */ -.highlight .nx { color: #a6e22e } /* Name.Other */ -.highlight .py { color: #f8f8f2 } /* Name.Property */ -.highlight .nt { color: #f92672 } /* Name.Tag */ -.highlight .nv { color: #f8f8f2 } /* Name.Variable */ -.highlight .ow { color: #f92672 } /* Operator.Word */ -.highlight .w { color: #f8f8f2 } /* Text.Whitespace */ -.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ -.highlight .mf { color: #ae81ff } /* Literal.Number.Float */ -.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ -.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ -.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ -.highlight .sa { color: #e6db74 } /* Literal.String.Affix */ -.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ -.highlight .sc { color: #e6db74 } /* Literal.String.Char */ -.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ -.highlight .sd { color: #e6db74 } /* Literal.String.Doc */ -.highlight .s2 { color: #e6db74 } /* Literal.String.Double */ -.highlight .se { color: #ae81ff } /* Literal.String.Escape */ -.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ -.highlight .si { color: #e6db74 } /* Literal.String.Interpol */ -.highlight .sx { color: #e6db74 } /* Literal.String.Other */ -.highlight .sr { color: #e6db74 } /* Literal.String.Regex */ -.highlight .s1 { color: #e6db74 } /* Literal.String.Single */ -.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ -.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ -.highlight .fm { color: #a6e22e } /* Name.Function.Magic */ -.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ -.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ -.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ -.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ -.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ diff --git a/spaces/SantoshKumar/06-SD-SL-AI-Image-Music-Video-UI-UX/app.py b/spaces/SantoshKumar/06-SD-SL-AI-Image-Music-Video-UI-UX/app.py deleted file mode 100644 index 0f4298365bc4f58d285202fb9442e12805d2db95..0000000000000000000000000000000000000000 --- a/spaces/SantoshKumar/06-SD-SL-AI-Image-Music-Video-UI-UX/app.py +++ /dev/null @@ -1,45 +0,0 @@ -import streamlit as st -import gradio as gr -import IPython -import streamlit as st -import streamlit.components.v1 as components -from IPython.display import IFrame - -src='' # URL parameter to change the iframe url -def SetIframeURL(option_selected): - if (option_selected=='Collager'): - src='https://www.artbreeder.com/' - if (option_selected=='Midjourney'): - src='https://www.midjourney.com/' - if (option_selected=='DreamStudio'): - src='https://beta.dreamstudio.ai/' - if (option_selected=='NightCafe'): - src='https://creator.nightcafe.studio/' - if (option_selected=='RunwayML'): - src='https://app.runwayml.com/' - if (option_selected=='ArtFromTextandImages'): - src='https://huggingface.co/spaces/awacke1/Art-from-Text-and-Images' - if (option_selected=='Boomy'): - src='https://boomy.com/' - - width = st.sidebar.slider("Width", 200, 1500, 800, 100) - height = st.sidebar.slider("Height", 200, 1500, 900, 100) - st.components.v1.iframe(src, width, height, scrolling=True) - -try: - options = ['Midjourney', 'RunwayML', 'Boomy'] - query_params = st.experimental_get_query_params() - query_option = query_params['option'][0] #throws an exception when visiting http://host:port - option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option)) - if option_selected: - st.experimental_set_query_params(option=option_selected) - SetIframeURL(option_selected) -except: - options = ['Midjourney', 'RunwayML', 'Boomy'] - st.experimental_set_query_params(option=options[1]) # defaults to 1 - query_params = st.experimental_get_query_params() - query_option = query_params['option'][0] - option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option)) - if option_selected: - st.experimental_set_query_params(option=option_selected) - SetIframeURL(option_selected) \ No newline at end of file diff --git a/spaces/Shibe/sahil2801-replit-code-instruct-glaive/README.md b/spaces/Shibe/sahil2801-replit-code-instruct-glaive/README.md deleted file mode 100644 index 05ac22700fcc2018959d63fa1b3e0a6ebdd1fff7..0000000000000000000000000000000000000000 --- a/spaces/Shibe/sahil2801-replit-code-instruct-glaive/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Sahil2801 Replit Code Instruct Glaive -emoji: 🦀 -colorFrom: green -colorTo: gray -sdk: gradio -sdk_version: 3.35.2 -app_file: app.py -pinned: false -license: openrail ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/utils/traitlets.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/utils/traitlets.py deleted file mode 100644 index 2f979fa727127d12b7f66fa169c05778fae4801e..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/utils/traitlets.py +++ /dev/null @@ -1,6 +0,0 @@ - -from warnings import warn - -warn("IPython.utils.traitlets has moved to a top-level traitlets package.", stacklevel=2) - -from traitlets import * diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/colorama/tests/winterm_test.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/colorama/tests/winterm_test.py deleted file mode 100644 index d0955f9e608377940f0d548576964f2fcf3caf48..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/colorama/tests/winterm_test.py +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. -import sys -from unittest import TestCase, main, skipUnless - -try: - from unittest.mock import Mock, patch -except ImportError: - from mock import Mock, patch - -from ..winterm import WinColor, WinStyle, WinTerm - - -class WinTermTest(TestCase): - - @patch('colorama.winterm.win32') - def testInit(self, mockWin32): - mockAttr = Mock() - mockAttr.wAttributes = 7 + 6 * 16 + 8 - mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr - term = WinTerm() - self.assertEqual(term._fore, 7) - self.assertEqual(term._back, 6) - self.assertEqual(term._style, 8) - - @skipUnless(sys.platform.startswith("win"), "requires Windows") - def testGetAttrs(self): - term = WinTerm() - - term._fore = 0 - term._back = 0 - term._style = 0 - self.assertEqual(term.get_attrs(), 0) - - term._fore = WinColor.YELLOW - self.assertEqual(term.get_attrs(), WinColor.YELLOW) - - term._back = WinColor.MAGENTA - self.assertEqual( - term.get_attrs(), - WinColor.YELLOW + WinColor.MAGENTA * 16) - - term._style = WinStyle.BRIGHT - self.assertEqual( - term.get_attrs(), - WinColor.YELLOW + WinColor.MAGENTA * 16 + WinStyle.BRIGHT) - - @patch('colorama.winterm.win32') - def testResetAll(self, mockWin32): - mockAttr = Mock() - mockAttr.wAttributes = 1 + 2 * 16 + 8 - mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr - term = WinTerm() - - term.set_console = Mock() - term._fore = -1 - term._back = -1 - term._style = -1 - - term.reset_all() - - self.assertEqual(term._fore, 1) - self.assertEqual(term._back, 2) - self.assertEqual(term._style, 8) - self.assertEqual(term.set_console.called, True) - - @skipUnless(sys.platform.startswith("win"), "requires Windows") - def testFore(self): - term = WinTerm() - term.set_console = Mock() - term._fore = 0 - - term.fore(5) - - self.assertEqual(term._fore, 5) - self.assertEqual(term.set_console.called, True) - - @skipUnless(sys.platform.startswith("win"), "requires Windows") - def testBack(self): - term = WinTerm() - term.set_console = Mock() - term._back = 0 - - term.back(5) - - self.assertEqual(term._back, 5) - self.assertEqual(term.set_console.called, True) - - @skipUnless(sys.platform.startswith("win"), "requires Windows") - def testStyle(self): - term = WinTerm() - term.set_console = Mock() - term._style = 0 - - term.style(22) - - self.assertEqual(term._style, 22) - self.assertEqual(term.set_console.called, True) - - @patch('colorama.winterm.win32') - def testSetConsole(self, mockWin32): - mockAttr = Mock() - mockAttr.wAttributes = 0 - mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr - term = WinTerm() - term.windll = Mock() - - term.set_console() - - self.assertEqual( - mockWin32.SetConsoleTextAttribute.call_args, - ((mockWin32.STDOUT, term.get_attrs()), {}) - ) - - @patch('colorama.winterm.win32') - def testSetConsoleOnStderr(self, mockWin32): - mockAttr = Mock() - mockAttr.wAttributes = 0 - mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr - term = WinTerm() - term.windll = Mock() - - term.set_console(on_stderr=True) - - self.assertEqual( - mockWin32.SetConsoleTextAttribute.call_args, - ((mockWin32.STDERR, term.get_attrs()), {}) - ) - - -if __name__ == '__main__': - main() diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/docarray/typing/url/url_3d/mesh_url.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/docarray/typing/url/url_3d/mesh_url.py deleted file mode 100644 index 70f32eb55817fc338989ebedf8f0c0041f5939f1..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/docarray/typing/url/url_3d/mesh_url.py +++ /dev/null @@ -1,78 +0,0 @@ -from typing import TYPE_CHECKING, Any, Dict, Optional, TypeVar - -import numpy as np -from pydantic import parse_obj_as - -from docarray.typing.proto_register import _register_proto -from docarray.typing.tensor.ndarray import NdArray -from docarray.typing.url.url_3d.url_3d import Url3D - -if TYPE_CHECKING: - from docarray.documents.mesh.vertices_and_faces import VerticesAndFaces - -T = TypeVar('T', bound='Mesh3DUrl') - - -@_register_proto(proto_type_name='mesh_url') -class Mesh3DUrl(Url3D): - """ - URL to a file containing 3D mesh information. - Can be remote (web) URL, or a local file path. - """ - - def load( - self: T, - skip_materials: bool = True, - trimesh_args: Optional[Dict[str, Any]] = None, - ) -> 'VerticesAndFaces': - """ - Load the data from the url into a [`VerticesAndFaces`][docarray.documents.VerticesAndFaces] - object containing vertices and faces information. - - --- - - ```python - from docarray import BaseDoc - - from docarray.typing import Mesh3DUrl, NdArray - - - class MyDoc(BaseDoc): - mesh_url: Mesh3DUrl - - - doc = MyDoc(mesh_url="https://people.sc.fsu.edu/~jburkardt/data/obj/al.obj") - - tensors = doc.mesh_url.load() - assert isinstance(tensors.vertices, NdArray) - assert isinstance(tensors.faces, NdArray) - ``` - - - :param skip_materials: Skip materials if True, else skip. - :param trimesh_args: dictionary of additional arguments for `trimesh.load()` - or `trimesh.load_remote()`. - :return: VerticesAndFaces object containing vertices and faces information. - """ - from docarray.documents.mesh.vertices_and_faces import VerticesAndFaces - - if not trimesh_args: - trimesh_args = {} - mesh = self._load_trimesh_instance( - force='mesh', skip_materials=skip_materials, **trimesh_args - ) - - vertices = parse_obj_as(NdArray, mesh.vertices.view(np.ndarray)) - faces = parse_obj_as(NdArray, mesh.faces.view(np.ndarray)) - - return VerticesAndFaces(vertices=vertices, faces=faces) - - def display(self) -> None: - """ - Plot mesh from url. - This loads the Trimesh instance of the 3D mesh, and then displays it. - """ - from IPython.display import display - - mesh = self._load_trimesh_instance(skip_materials=False) - display(mesh.show()) diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/docarray/utils/_internal/compress.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/docarray/utils/_internal/compress.py deleted file mode 100644 index 51b4860fe4ae8996d1249247ad08bddd3f288731..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/docarray/utils/_internal/compress.py +++ /dev/null @@ -1,97 +0,0 @@ -from typing import IO, TYPE_CHECKING, Callable, Optional - -from docarray.utils._internal.misc import import_library - - -def _compress_bytes(data: bytes, algorithm: Optional[str] = None) -> bytes: - if algorithm == 'lz4': - if TYPE_CHECKING: - from lz4 import frame - else: - lz4 = import_library('lz4', raise_error=True) # noqa: F841 - from lz4 import frame - - data = frame.compress(data) - elif algorithm == 'bz2': - import bz2 - - data = bz2.compress(data) - elif algorithm == 'lzma': - import lzma - - data = lzma.compress(data) - elif algorithm == 'zlib': - import zlib - - data = zlib.compress(data) - elif algorithm == 'gzip': - import gzip - - data = gzip.compress(data) - return data - - -def _decompress_bytes(data: bytes, algorithm: Optional[str] = None) -> bytes: - if algorithm == 'lz4': - if TYPE_CHECKING: - from lz4 import frame - else: - lz4 = import_library('lz4', raise_error=True) # noqa: F841 - from lz4 import frame - - data = frame.decompress(data) - elif algorithm == 'bz2': - import bz2 - - data = bz2.decompress(data) - elif algorithm == 'lzma': - import lzma - - data = lzma.decompress(data) - elif algorithm == 'zlib': - import zlib - - data = zlib.decompress(data) - elif algorithm == 'gzip': - import gzip - - data = gzip.decompress(data) - return data - - -def _get_compress_ctx(algorithm: Optional[str] = None) -> Optional[Callable]: - if algorithm == 'lz4': - if TYPE_CHECKING: - from lz4 import frame - else: - lz4 = import_library('lz4', raise_error=True) # noqa: F841 - from lz4 import frame - - def _fun(x: IO[bytes]): - return frame.LZ4FrameFile(x, 'wb') - - compress_ctx = _fun - elif algorithm == 'gzip': - import gzip - - def _fun(x: IO[bytes]): - return gzip.GzipFile(fileobj=x, mode='wb') - - compress_ctx = _fun - elif algorithm == 'bz2': - import bz2 - - def _fun(x: IO[bytes]): - return bz2.BZ2File(filename=x, mode='wb') - - compress_ctx = _fun - elif algorithm == 'lzma': - import lzma - - def _fun(x: IO[bytes]): - return lzma.LZMAFile(filename=x, mode='wb') - - compress_ctx = _fun - else: - compress_ctx = None - return compress_ctx diff --git a/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/evaluation/lvis_evaluation.py b/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/evaluation/lvis_evaluation.py deleted file mode 100644 index 7d712ef262789edb85392cb54577c3a6b15e223e..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/evaluation/lvis_evaluation.py +++ /dev/null @@ -1,380 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import copy -import itertools -import json -import logging -import os -import pickle -from collections import OrderedDict -import torch - -import annotator.oneformer.detectron2.utils.comm as comm -from annotator.oneformer.detectron2.config import CfgNode -from annotator.oneformer.detectron2.data import MetadataCatalog -from annotator.oneformer.detectron2.structures import Boxes, BoxMode, pairwise_iou -from annotator.oneformer.detectron2.utils.file_io import PathManager -from annotator.oneformer.detectron2.utils.logger import create_small_table - -from .coco_evaluation import instances_to_coco_json -from .evaluator import DatasetEvaluator - - -class LVISEvaluator(DatasetEvaluator): - """ - Evaluate object proposal and instance detection/segmentation outputs using - LVIS's metrics and evaluation API. - """ - - def __init__( - self, - dataset_name, - tasks=None, - distributed=True, - output_dir=None, - *, - max_dets_per_image=None, - ): - """ - Args: - dataset_name (str): name of the dataset to be evaluated. - It must have the following corresponding metadata: - "json_file": the path to the LVIS format annotation - tasks (tuple[str]): tasks that can be evaluated under the given - configuration. A task is one of "bbox", "segm". - By default, will infer this automatically from predictions. - distributed (True): if True, will collect results from all ranks for evaluation. - Otherwise, will evaluate the results in the current process. - output_dir (str): optional, an output directory to dump results. - max_dets_per_image (None or int): limit on maximum detections per image in evaluating AP - This limit, by default of the LVIS dataset, is 300. - """ - from lvis import LVIS - - self._logger = logging.getLogger(__name__) - - if tasks is not None and isinstance(tasks, CfgNode): - self._logger.warn( - "COCO Evaluator instantiated using config, this is deprecated behavior." - " Please pass in explicit arguments instead." - ) - self._tasks = None # Infering it from predictions should be better - else: - self._tasks = tasks - - self._distributed = distributed - self._output_dir = output_dir - self._max_dets_per_image = max_dets_per_image - - self._cpu_device = torch.device("cpu") - - self._metadata = MetadataCatalog.get(dataset_name) - json_file = PathManager.get_local_path(self._metadata.json_file) - self._lvis_api = LVIS(json_file) - # Test set json files do not contain annotations (evaluation must be - # performed using the LVIS evaluation server). - self._do_evaluation = len(self._lvis_api.get_ann_ids()) > 0 - - def reset(self): - self._predictions = [] - - def process(self, inputs, outputs): - """ - Args: - inputs: the inputs to a LVIS model (e.g., GeneralizedRCNN). - It is a list of dict. Each dict corresponds to an image and - contains keys like "height", "width", "file_name", "image_id". - outputs: the outputs of a LVIS model. It is a list of dicts with key - "instances" that contains :class:`Instances`. - """ - for input, output in zip(inputs, outputs): - prediction = {"image_id": input["image_id"]} - - if "instances" in output: - instances = output["instances"].to(self._cpu_device) - prediction["instances"] = instances_to_coco_json(instances, input["image_id"]) - if "proposals" in output: - prediction["proposals"] = output["proposals"].to(self._cpu_device) - self._predictions.append(prediction) - - def evaluate(self): - if self._distributed: - comm.synchronize() - predictions = comm.gather(self._predictions, dst=0) - predictions = list(itertools.chain(*predictions)) - - if not comm.is_main_process(): - return - else: - predictions = self._predictions - - if len(predictions) == 0: - self._logger.warning("[LVISEvaluator] Did not receive valid predictions.") - return {} - - if self._output_dir: - PathManager.mkdirs(self._output_dir) - file_path = os.path.join(self._output_dir, "instances_predictions.pth") - with PathManager.open(file_path, "wb") as f: - torch.save(predictions, f) - - self._results = OrderedDict() - if "proposals" in predictions[0]: - self._eval_box_proposals(predictions) - if "instances" in predictions[0]: - self._eval_predictions(predictions) - # Copy so the caller can do whatever with results - return copy.deepcopy(self._results) - - def _tasks_from_predictions(self, predictions): - for pred in predictions: - if "segmentation" in pred: - return ("bbox", "segm") - return ("bbox",) - - def _eval_predictions(self, predictions): - """ - Evaluate predictions. Fill self._results with the metrics of the tasks. - - Args: - predictions (list[dict]): list of outputs from the model - """ - self._logger.info("Preparing results in the LVIS format ...") - lvis_results = list(itertools.chain(*[x["instances"] for x in predictions])) - tasks = self._tasks or self._tasks_from_predictions(lvis_results) - - # LVIS evaluator can be used to evaluate results for COCO dataset categories. - # In this case `_metadata` variable will have a field with COCO-specific category mapping. - if hasattr(self._metadata, "thing_dataset_id_to_contiguous_id"): - reverse_id_mapping = { - v: k for k, v in self._metadata.thing_dataset_id_to_contiguous_id.items() - } - for result in lvis_results: - result["category_id"] = reverse_id_mapping[result["category_id"]] - else: - # unmap the category ids for LVIS (from 0-indexed to 1-indexed) - for result in lvis_results: - result["category_id"] += 1 - - if self._output_dir: - file_path = os.path.join(self._output_dir, "lvis_instances_results.json") - self._logger.info("Saving results to {}".format(file_path)) - with PathManager.open(file_path, "w") as f: - f.write(json.dumps(lvis_results)) - f.flush() - - if not self._do_evaluation: - self._logger.info("Annotations are not available for evaluation.") - return - - self._logger.info("Evaluating predictions ...") - for task in sorted(tasks): - res = _evaluate_predictions_on_lvis( - self._lvis_api, - lvis_results, - task, - max_dets_per_image=self._max_dets_per_image, - class_names=self._metadata.get("thing_classes"), - ) - self._results[task] = res - - def _eval_box_proposals(self, predictions): - """ - Evaluate the box proposals in predictions. - Fill self._results with the metrics for "box_proposals" task. - """ - if self._output_dir: - # Saving generated box proposals to file. - # Predicted box_proposals are in XYXY_ABS mode. - bbox_mode = BoxMode.XYXY_ABS.value - ids, boxes, objectness_logits = [], [], [] - for prediction in predictions: - ids.append(prediction["image_id"]) - boxes.append(prediction["proposals"].proposal_boxes.tensor.numpy()) - objectness_logits.append(prediction["proposals"].objectness_logits.numpy()) - - proposal_data = { - "boxes": boxes, - "objectness_logits": objectness_logits, - "ids": ids, - "bbox_mode": bbox_mode, - } - with PathManager.open(os.path.join(self._output_dir, "box_proposals.pkl"), "wb") as f: - pickle.dump(proposal_data, f) - - if not self._do_evaluation: - self._logger.info("Annotations are not available for evaluation.") - return - - self._logger.info("Evaluating bbox proposals ...") - res = {} - areas = {"all": "", "small": "s", "medium": "m", "large": "l"} - for limit in [100, 1000]: - for area, suffix in areas.items(): - stats = _evaluate_box_proposals(predictions, self._lvis_api, area=area, limit=limit) - key = "AR{}@{:d}".format(suffix, limit) - res[key] = float(stats["ar"].item() * 100) - self._logger.info("Proposal metrics: \n" + create_small_table(res)) - self._results["box_proposals"] = res - - -# inspired from Detectron: -# https://github.com/facebookresearch/Detectron/blob/a6a835f5b8208c45d0dce217ce9bbda915f44df7/detectron/datasets/json_dataset_evaluator.py#L255 # noqa -def _evaluate_box_proposals(dataset_predictions, lvis_api, thresholds=None, area="all", limit=None): - """ - Evaluate detection proposal recall metrics. This function is a much - faster alternative to the official LVIS API recall evaluation code. However, - it produces slightly different results. - """ - # Record max overlap value for each gt box - # Return vector of overlap values - areas = { - "all": 0, - "small": 1, - "medium": 2, - "large": 3, - "96-128": 4, - "128-256": 5, - "256-512": 6, - "512-inf": 7, - } - area_ranges = [ - [0**2, 1e5**2], # all - [0**2, 32**2], # small - [32**2, 96**2], # medium - [96**2, 1e5**2], # large - [96**2, 128**2], # 96-128 - [128**2, 256**2], # 128-256 - [256**2, 512**2], # 256-512 - [512**2, 1e5**2], - ] # 512-inf - assert area in areas, "Unknown area range: {}".format(area) - area_range = area_ranges[areas[area]] - gt_overlaps = [] - num_pos = 0 - - for prediction_dict in dataset_predictions: - predictions = prediction_dict["proposals"] - - # sort predictions in descending order - # TODO maybe remove this and make it explicit in the documentation - inds = predictions.objectness_logits.sort(descending=True)[1] - predictions = predictions[inds] - - ann_ids = lvis_api.get_ann_ids(img_ids=[prediction_dict["image_id"]]) - anno = lvis_api.load_anns(ann_ids) - gt_boxes = [ - BoxMode.convert(obj["bbox"], BoxMode.XYWH_ABS, BoxMode.XYXY_ABS) for obj in anno - ] - gt_boxes = torch.as_tensor(gt_boxes).reshape(-1, 4) # guard against no boxes - gt_boxes = Boxes(gt_boxes) - gt_areas = torch.as_tensor([obj["area"] for obj in anno]) - - if len(gt_boxes) == 0 or len(predictions) == 0: - continue - - valid_gt_inds = (gt_areas >= area_range[0]) & (gt_areas <= area_range[1]) - gt_boxes = gt_boxes[valid_gt_inds] - - num_pos += len(gt_boxes) - - if len(gt_boxes) == 0: - continue - - if limit is not None and len(predictions) > limit: - predictions = predictions[:limit] - - overlaps = pairwise_iou(predictions.proposal_boxes, gt_boxes) - - _gt_overlaps = torch.zeros(len(gt_boxes)) - for j in range(min(len(predictions), len(gt_boxes))): - # find which proposal box maximally covers each gt box - # and get the iou amount of coverage for each gt box - max_overlaps, argmax_overlaps = overlaps.max(dim=0) - - # find which gt box is 'best' covered (i.e. 'best' = most iou) - gt_ovr, gt_ind = max_overlaps.max(dim=0) - assert gt_ovr >= 0 - # find the proposal box that covers the best covered gt box - box_ind = argmax_overlaps[gt_ind] - # record the iou coverage of this gt box - _gt_overlaps[j] = overlaps[box_ind, gt_ind] - assert _gt_overlaps[j] == gt_ovr - # mark the proposal box and the gt box as used - overlaps[box_ind, :] = -1 - overlaps[:, gt_ind] = -1 - - # append recorded iou coverage level - gt_overlaps.append(_gt_overlaps) - gt_overlaps = ( - torch.cat(gt_overlaps, dim=0) if len(gt_overlaps) else torch.zeros(0, dtype=torch.float32) - ) - gt_overlaps, _ = torch.sort(gt_overlaps) - - if thresholds is None: - step = 0.05 - thresholds = torch.arange(0.5, 0.95 + 1e-5, step, dtype=torch.float32) - recalls = torch.zeros_like(thresholds) - # compute recall for each iou threshold - for i, t in enumerate(thresholds): - recalls[i] = (gt_overlaps >= t).float().sum() / float(num_pos) - # ar = 2 * np.trapz(recalls, thresholds) - ar = recalls.mean() - return { - "ar": ar, - "recalls": recalls, - "thresholds": thresholds, - "gt_overlaps": gt_overlaps, - "num_pos": num_pos, - } - - -def _evaluate_predictions_on_lvis( - lvis_gt, lvis_results, iou_type, max_dets_per_image=None, class_names=None -): - """ - Args: - iou_type (str): - max_dets_per_image (None or int): limit on maximum detections per image in evaluating AP - This limit, by default of the LVIS dataset, is 300. - class_names (None or list[str]): if provided, will use it to predict - per-category AP. - - Returns: - a dict of {metric name: score} - """ - metrics = { - "bbox": ["AP", "AP50", "AP75", "APs", "APm", "APl", "APr", "APc", "APf"], - "segm": ["AP", "AP50", "AP75", "APs", "APm", "APl", "APr", "APc", "APf"], - }[iou_type] - - logger = logging.getLogger(__name__) - - if len(lvis_results) == 0: # TODO: check if needed - logger.warn("No predictions from the model!") - return {metric: float("nan") for metric in metrics} - - if iou_type == "segm": - lvis_results = copy.deepcopy(lvis_results) - # When evaluating mask AP, if the results contain bbox, LVIS API will - # use the box area as the area of the instance, instead of the mask area. - # This leads to a different definition of small/medium/large. - # We remove the bbox field to let mask AP use mask area. - for c in lvis_results: - c.pop("bbox", None) - - if max_dets_per_image is None: - max_dets_per_image = 300 # Default for LVIS dataset - - from lvis import LVISEval, LVISResults - - logger.info(f"Evaluating with max detections per image = {max_dets_per_image}") - lvis_results = LVISResults(lvis_gt, lvis_results, max_dets=max_dets_per_image) - lvis_eval = LVISEval(lvis_gt, lvis_results, iou_type) - lvis_eval.run() - lvis_eval.print_results() - - # Pull the standard metrics from the LVIS results - results = lvis_eval.get_results() - results = {metric: float(results[metric] * 100) for metric in metrics} - logger.info("Evaluation results for {}: \n".format(iou_type) + create_small_table(results)) - return results diff --git a/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/modeling/matcher.py b/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/modeling/matcher.py deleted file mode 100644 index 2504d17a4f9707d7cdd8d47a6cb5a2faf3c397fd..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/modeling/matcher.py +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -from typing import List -import torch - -from annotator.oneformer.detectron2.layers import nonzero_tuple - - -# TODO: the name is too general -class Matcher(object): - """ - This class assigns to each predicted "element" (e.g., a box) a ground-truth - element. Each predicted element will have exactly zero or one matches; each - ground-truth element may be matched to zero or more predicted elements. - - The matching is determined by the MxN match_quality_matrix, that characterizes - how well each (ground-truth, prediction)-pair match each other. For example, - if the elements are boxes, this matrix may contain box intersection-over-union - overlap values. - - The matcher returns (a) a vector of length N containing the index of the - ground-truth element m in [0, M) that matches to prediction n in [0, N). - (b) a vector of length N containing the labels for each prediction. - """ - - def __init__( - self, thresholds: List[float], labels: List[int], allow_low_quality_matches: bool = False - ): - """ - Args: - thresholds (list): a list of thresholds used to stratify predictions - into levels. - labels (list): a list of values to label predictions belonging at - each level. A label can be one of {-1, 0, 1} signifying - {ignore, negative class, positive class}, respectively. - allow_low_quality_matches (bool): if True, produce additional matches - for predictions with maximum match quality lower than high_threshold. - See set_low_quality_matches_ for more details. - - For example, - thresholds = [0.3, 0.5] - labels = [0, -1, 1] - All predictions with iou < 0.3 will be marked with 0 and - thus will be considered as false positives while training. - All predictions with 0.3 <= iou < 0.5 will be marked with -1 and - thus will be ignored. - All predictions with 0.5 <= iou will be marked with 1 and - thus will be considered as true positives. - """ - # Add -inf and +inf to first and last position in thresholds - thresholds = thresholds[:] - assert thresholds[0] > 0 - thresholds.insert(0, -float("inf")) - thresholds.append(float("inf")) - # Currently torchscript does not support all + generator - assert all([low <= high for (low, high) in zip(thresholds[:-1], thresholds[1:])]) - assert all([l in [-1, 0, 1] for l in labels]) - assert len(labels) == len(thresholds) - 1 - self.thresholds = thresholds - self.labels = labels - self.allow_low_quality_matches = allow_low_quality_matches - - def __call__(self, match_quality_matrix): - """ - Args: - match_quality_matrix (Tensor[float]): an MxN tensor, containing the - pairwise quality between M ground-truth elements and N predicted - elements. All elements must be >= 0 (due to the us of `torch.nonzero` - for selecting indices in :meth:`set_low_quality_matches_`). - - Returns: - matches (Tensor[int64]): a vector of length N, where matches[i] is a matched - ground-truth index in [0, M) - match_labels (Tensor[int8]): a vector of length N, where pred_labels[i] indicates - whether a prediction is a true or false positive or ignored - """ - assert match_quality_matrix.dim() == 2 - if match_quality_matrix.numel() == 0: - default_matches = match_quality_matrix.new_full( - (match_quality_matrix.size(1),), 0, dtype=torch.int64 - ) - # When no gt boxes exist, we define IOU = 0 and therefore set labels - # to `self.labels[0]`, which usually defaults to background class 0 - # To choose to ignore instead, can make labels=[-1,0,-1,1] + set appropriate thresholds - default_match_labels = match_quality_matrix.new_full( - (match_quality_matrix.size(1),), self.labels[0], dtype=torch.int8 - ) - return default_matches, default_match_labels - - assert torch.all(match_quality_matrix >= 0) - - # match_quality_matrix is M (gt) x N (predicted) - # Max over gt elements (dim 0) to find best gt candidate for each prediction - matched_vals, matches = match_quality_matrix.max(dim=0) - - match_labels = matches.new_full(matches.size(), 1, dtype=torch.int8) - - for (l, low, high) in zip(self.labels, self.thresholds[:-1], self.thresholds[1:]): - low_high = (matched_vals >= low) & (matched_vals < high) - match_labels[low_high] = l - - if self.allow_low_quality_matches: - self.set_low_quality_matches_(match_labels, match_quality_matrix) - - return matches, match_labels - - def set_low_quality_matches_(self, match_labels, match_quality_matrix): - """ - Produce additional matches for predictions that have only low-quality matches. - Specifically, for each ground-truth G find the set of predictions that have - maximum overlap with it (including ties); for each prediction in that set, if - it is unmatched, then match it to the ground-truth G. - - This function implements the RPN assignment case (i) in Sec. 3.1.2 of - :paper:`Faster R-CNN`. - """ - # For each gt, find the prediction with which it has highest quality - highest_quality_foreach_gt, _ = match_quality_matrix.max(dim=1) - # Find the highest quality match available, even if it is low, including ties. - # Note that the matches qualities must be positive due to the use of - # `torch.nonzero`. - _, pred_inds_with_highest_quality = nonzero_tuple( - match_quality_matrix == highest_quality_foreach_gt[:, None] - ) - # If an anchor was labeled positive only due to a low-quality match - # with gt_A, but it has larger overlap with gt_B, it's matched index will still be gt_B. - # This follows the implementation in Detectron, and is found to have no significant impact. - match_labels[pred_inds_with_highest_quality] = 1 diff --git a/spaces/Superlang/ImageProcessor/annotator/uniformer/mmcv/ops/roi_align.py b/spaces/Superlang/ImageProcessor/annotator/uniformer/mmcv/ops/roi_align.py deleted file mode 100644 index 0755aefc66e67233ceae0f4b77948301c443e9fb..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/uniformer/mmcv/ops/roi_align.py +++ /dev/null @@ -1,223 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import torch -import torch.nn as nn -from torch.autograd import Function -from torch.autograd.function import once_differentiable -from torch.nn.modules.utils import _pair - -from ..utils import deprecated_api_warning, ext_loader - -ext_module = ext_loader.load_ext('_ext', - ['roi_align_forward', 'roi_align_backward']) - - -class RoIAlignFunction(Function): - - @staticmethod - def symbolic(g, input, rois, output_size, spatial_scale, sampling_ratio, - pool_mode, aligned): - from ..onnx import is_custom_op_loaded - has_custom_op = is_custom_op_loaded() - if has_custom_op: - return g.op( - 'mmcv::MMCVRoiAlign', - input, - rois, - output_height_i=output_size[0], - output_width_i=output_size[1], - spatial_scale_f=spatial_scale, - sampling_ratio_i=sampling_ratio, - mode_s=pool_mode, - aligned_i=aligned) - else: - from torch.onnx.symbolic_opset9 import sub, squeeze - from torch.onnx.symbolic_helper import _slice_helper - from torch.onnx import TensorProtoDataType - # batch_indices = rois[:, 0].long() - batch_indices = _slice_helper( - g, rois, axes=[1], starts=[0], ends=[1]) - batch_indices = squeeze(g, batch_indices, 1) - batch_indices = g.op( - 'Cast', batch_indices, to_i=TensorProtoDataType.INT64) - # rois = rois[:, 1:] - rois = _slice_helper(g, rois, axes=[1], starts=[1], ends=[5]) - if aligned: - # rois -= 0.5/spatial_scale - aligned_offset = g.op( - 'Constant', - value_t=torch.tensor([0.5 / spatial_scale], - dtype=torch.float32)) - rois = sub(g, rois, aligned_offset) - # roi align - return g.op( - 'RoiAlign', - input, - rois, - batch_indices, - output_height_i=output_size[0], - output_width_i=output_size[1], - spatial_scale_f=spatial_scale, - sampling_ratio_i=max(0, sampling_ratio), - mode_s=pool_mode) - - @staticmethod - def forward(ctx, - input, - rois, - output_size, - spatial_scale=1.0, - sampling_ratio=0, - pool_mode='avg', - aligned=True): - ctx.output_size = _pair(output_size) - ctx.spatial_scale = spatial_scale - ctx.sampling_ratio = sampling_ratio - assert pool_mode in ('max', 'avg') - ctx.pool_mode = 0 if pool_mode == 'max' else 1 - ctx.aligned = aligned - ctx.input_shape = input.size() - - assert rois.size(1) == 5, 'RoI must be (idx, x1, y1, x2, y2)!' - - output_shape = (rois.size(0), input.size(1), ctx.output_size[0], - ctx.output_size[1]) - output = input.new_zeros(output_shape) - if ctx.pool_mode == 0: - argmax_y = input.new_zeros(output_shape) - argmax_x = input.new_zeros(output_shape) - else: - argmax_y = input.new_zeros(0) - argmax_x = input.new_zeros(0) - - ext_module.roi_align_forward( - input, - rois, - output, - argmax_y, - argmax_x, - aligned_height=ctx.output_size[0], - aligned_width=ctx.output_size[1], - spatial_scale=ctx.spatial_scale, - sampling_ratio=ctx.sampling_ratio, - pool_mode=ctx.pool_mode, - aligned=ctx.aligned) - - ctx.save_for_backward(rois, argmax_y, argmax_x) - return output - - @staticmethod - @once_differentiable - def backward(ctx, grad_output): - rois, argmax_y, argmax_x = ctx.saved_tensors - grad_input = grad_output.new_zeros(ctx.input_shape) - # complex head architecture may cause grad_output uncontiguous. - grad_output = grad_output.contiguous() - ext_module.roi_align_backward( - grad_output, - rois, - argmax_y, - argmax_x, - grad_input, - aligned_height=ctx.output_size[0], - aligned_width=ctx.output_size[1], - spatial_scale=ctx.spatial_scale, - sampling_ratio=ctx.sampling_ratio, - pool_mode=ctx.pool_mode, - aligned=ctx.aligned) - return grad_input, None, None, None, None, None, None - - -roi_align = RoIAlignFunction.apply - - -class RoIAlign(nn.Module): - """RoI align pooling layer. - - Args: - output_size (tuple): h, w - spatial_scale (float): scale the input boxes by this number - sampling_ratio (int): number of inputs samples to take for each - output sample. 0 to take samples densely for current models. - pool_mode (str, 'avg' or 'max'): pooling mode in each bin. - aligned (bool): if False, use the legacy implementation in - MMDetection. If True, align the results more perfectly. - use_torchvision (bool): whether to use roi_align from torchvision. - - Note: - The implementation of RoIAlign when aligned=True is modified from - https://github.com/facebookresearch/detectron2/ - - The meaning of aligned=True: - - Given a continuous coordinate c, its two neighboring pixel - indices (in our pixel model) are computed by floor(c - 0.5) and - ceil(c - 0.5). For example, c=1.3 has pixel neighbors with discrete - indices [0] and [1] (which are sampled from the underlying signal - at continuous coordinates 0.5 and 1.5). But the original roi_align - (aligned=False) does not subtract the 0.5 when computing - neighboring pixel indices and therefore it uses pixels with a - slightly incorrect alignment (relative to our pixel model) when - performing bilinear interpolation. - - With `aligned=True`, - we first appropriately scale the ROI and then shift it by -0.5 - prior to calling roi_align. This produces the correct neighbors; - - The difference does not make a difference to the model's - performance if ROIAlign is used together with conv layers. - """ - - @deprecated_api_warning( - { - 'out_size': 'output_size', - 'sample_num': 'sampling_ratio' - }, - cls_name='RoIAlign') - def __init__(self, - output_size, - spatial_scale=1.0, - sampling_ratio=0, - pool_mode='avg', - aligned=True, - use_torchvision=False): - super(RoIAlign, self).__init__() - - self.output_size = _pair(output_size) - self.spatial_scale = float(spatial_scale) - self.sampling_ratio = int(sampling_ratio) - self.pool_mode = pool_mode - self.aligned = aligned - self.use_torchvision = use_torchvision - - def forward(self, input, rois): - """ - Args: - input: NCHW images - rois: Bx5 boxes. First column is the index into N.\ - The other 4 columns are xyxy. - """ - if self.use_torchvision: - from torchvision.ops import roi_align as tv_roi_align - if 'aligned' in tv_roi_align.__code__.co_varnames: - return tv_roi_align(input, rois, self.output_size, - self.spatial_scale, self.sampling_ratio, - self.aligned) - else: - if self.aligned: - rois -= rois.new_tensor([0.] + - [0.5 / self.spatial_scale] * 4) - return tv_roi_align(input, rois, self.output_size, - self.spatial_scale, self.sampling_ratio) - else: - return roi_align(input, rois, self.output_size, self.spatial_scale, - self.sampling_ratio, self.pool_mode, self.aligned) - - def __repr__(self): - s = self.__class__.__name__ - s += f'(output_size={self.output_size}, ' - s += f'spatial_scale={self.spatial_scale}, ' - s += f'sampling_ratio={self.sampling_ratio}, ' - s += f'pool_mode={self.pool_mode}, ' - s += f'aligned={self.aligned}, ' - s += f'use_torchvision={self.use_torchvision})' - return s diff --git a/spaces/Superlang/ImageProcessor/annotator/uniformer/mmseg/models/losses/__init__.py b/spaces/Superlang/ImageProcessor/annotator/uniformer/mmseg/models/losses/__init__.py deleted file mode 100644 index beca72045694273d63465bac2f27dbc6672271db..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/uniformer/mmseg/models/losses/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -from .accuracy import Accuracy, accuracy -from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy, - cross_entropy, mask_cross_entropy) -from .dice_loss import DiceLoss -from .lovasz_loss import LovaszLoss -from .utils import reduce_loss, weight_reduce_loss, weighted_loss - -__all__ = [ - 'accuracy', 'Accuracy', 'cross_entropy', 'binary_cross_entropy', - 'mask_cross_entropy', 'CrossEntropyLoss', 'reduce_loss', - 'weight_reduce_loss', 'weighted_loss', 'LovaszLoss', 'DiceLoss' -] diff --git a/spaces/Surfrider/surfnet/app.py b/spaces/Surfrider/surfnet/app.py deleted file mode 100644 index d81e830b851dfdb5054c53ec0be34d5e7a239118..0000000000000000000000000000000000000000 --- a/spaces/Surfrider/surfnet/app.py +++ /dev/null @@ -1,421 +0,0 @@ -from webbrowser import get -import gradio as gr -import os -import os.path as op - -import json -from typing import Dict, List, Tuple -import torch -import numpy as np - -import datetime -import logging -import warnings - -# imports for gps & map -import osmnx as ox -import folium -import pandas as pd -import geopandas -import codecs -from tracking.gps import * - -# imports for tracking -from plasticorigins.tools.files import download_from_url, create_unique_folder, load_trash_icons -from plasticorigins.tools.video_readers import IterableFrameReader, SimpleVideoReader -from plasticorigins.detection.centernet.networks.mobilenet import get_mobilenet_v3_small - -from plasticorigins.detection.yolo import load_model, predict_yolo -from plasticorigins.detection.detect import detect -from plasticorigins.tracking.postprocess_and_count_tracks import filter_tracks, postprocess_for_api, count_objects -from plasticorigins.tracking.utils import get_detections_for_video, write_tracking_results_to_file, read_tracking_results, generate_video_with_annotations -from plasticorigins.tracking.track_video import track_video -from plasticorigins.tracking.trackers import get_tracker - -logger = logging.getLogger() -logger.setLevel(logging.DEBUG) -ch = logging.StreamHandler() -ch.setLevel(logging.DEBUG) -formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') -ch.setFormatter(formatter) -logger.addHandler(ch) - -class DotDict(dict): - """dot.notation access to dictionary attributes""" - __getattr__ = dict.get - __setattr__ = dict.__setitem__ - __delattr__ = dict.__delitem__ - -id_categories = { - 0: 'Fragment', #'Sheet / tarp / plastic bag / fragment', - 1: 'Insulating', #'Insulating material', - 2: 'Bottle', #'Bottle-shaped', - 3: 'Can', #'Can-shaped', - 4: 'Drum', - 5: 'Packaging', #'Other packaging', - 6: 'Tire', - 7: 'Fishing net', #'Fishing net / cord', - 8: 'Easily namable', - 9: 'Unclear', - 10: 'Fragment', - 11: 'Fragment' -} - - -config_track = DotDict({ - "yolo_conf_thrld": 0.35, - "yolo_iou_thrld": 0.5, - - "confidence_threshold": 0.004, # for the tracking part - "detection_threshold": 0.3, # for centernet - "downsampling_factor": 4, - "noise_covariances_path": "data/tracking_parameters", - "output_shape": (960,544), - "size": 768, - "skip_frames": 3, #3 - "arch": "mobilenet_v3_small", - "device": "cpu", - "detection_batch_size": 1, - "display": 0, - "kappa": 4, #4 - "tau": 3, #4 - "max_length": 240, - "downscale_output":2 -}) - - -logger.info('---Yolo model...') -# Yolo has warning problems, so we set an env variable to remove it -os.environ["VERBOSE"] = "False" -URL_MODEL = "https://github.com/surfriderfoundationeurope/surfnet/releases/download/v01.2023/yolo_latest.pt" -FILE_MODEL = "yolov5.pt" -model_path = download_from_url(URL_MODEL, FILE_MODEL, "./models", logger) -model_yolo = load_model(model_path, config_track.device, config_track.yolo_conf_thrld, config_track.yolo_iou_thrld) - -logger.info('---Centernet model...') -URL_MODEL = "https://partage.imt.fr/index.php/s/sJi22N6gedN6T4q/download" -FILE_MODEL = "mobilenet_v3_pretrained.pth" -model_path = download_from_url(URL_MODEL, FILE_MODEL, "./models", logger) -model = get_mobilenet_v3_small(num_layers=0, heads={'hm': 1}, head_conv=256) -checkpoint = torch.load(model_path, map_location="cpu") -model.load_state_dict(checkpoint['model'], strict=True) - - -URL_DEMO1 = "https://etlplasticostorageacc.blob.core.windows.net/surfnetbenchmark/video_niv15.mp4" -FILE_DEMO1 = "video_niv15.mp4" -download_from_url(URL_DEMO1, FILE_DEMO1, "./data/", logger) -video1_path = op.join("./data", FILE_DEMO1) -URL_DEMO2 = "https://etlplasticostorageacc.blob.core.windows.net/surfnetbenchmark/video_midouze15.mp4" -FILE_DEMO2 = "video_midouze15.mp4" -download_from_url(URL_DEMO2, FILE_DEMO2, "./data/", logger) -video2_path = op.join("./data", FILE_DEMO2) -URL_DEMO3 = "https://etlplasticostorageacc.blob.core.windows.net/surfnetbenchmark/video_antoine15.mp4" -FILE_DEMO3 = "video_antoine15.mp4" -download_from_url(URL_DEMO3, FILE_DEMO3, "./data/", logger) -video3_path = op.join("./data", FILE_DEMO3) -JSON_FILE_PATH = "data/" - -video_json_correspondance = { - video1_path : JSON_FILE_PATH+"gavepau.json", - video2_path : JSON_FILE_PATH+"midouze.json", - video3_path : JSON_FILE_PATH+"gavepau.json" -} - -labels2icons = load_trash_icons("./data/icons/") - -def track(args): - device = torch.device("cpu") - - engine = get_tracker('EKF') - - detector = None - # centernet version - if args.model_type == "yolo": - logger.info("---Using Yolo") - detector = lambda frame: predict_yolo(model_yolo, frame, size=config_track.size) - elif args.model_type == "centernet": - logger.info("---Using Centernet") - detector = lambda frame: detect(frame, threshold=args.detection_threshold, model=model) - - - transition_variance = np.load(op.join(args.noise_covariances_path, 'transition_variance.npy')) - observation_variance = np.load(op.join(args.noise_covariances_path, 'observation_variance.npy')) - - logger.info(f'---Processing {args.video_path}') - reader = IterableFrameReader(video_filename=args.video_path, - skip_frames=args.skip_frames, - output_shape=args.output_shape, - progress_bar=True, - preload=False, - max_frame=args.max_length) - - - input_shape = reader.input_shape - output_shape = reader.output_shape - - detections = [] - logger.info('---Detecting...') - if args.model_type == "yolo": - with warnings.catch_warnings(): - warnings.filterwarnings("ignore") - - for frame in reader: - detections.append(detector(frame)) - elif args.model_type == "centernet": - detections = get_detections_for_video(reader, detector, batch_size=args.detection_batch_size, device=device) - - logger.info('---Tracking...') - display = None - results = track_video(reader, iter(detections), args, engine, transition_variance, observation_variance, display, is_yolo=args.model_type=="yolo") - reader.video.release() - - # store unfiltered results - datestr = datetime.datetime.now().strftime('%Y%m%d%H%M%S%f') - output_filename = op.splitext(args.video_path)[0] + "_" + datestr + '_unfiltered.txt' - coord_mapping = reader.get_inv_mapping(args.downsampling_factor) - write_tracking_results_to_file( - results, - coord_mapping, # Scale the output back to original video size - output_filename=output_filename, - ) - logger.info('---Filtering...') - - # read from the file - results = read_tracking_results(output_filename) - filtered_results = filter_tracks(results, config_track.kappa, config_track.tau) - # store filtered results - output_filename = op.splitext(args.video_path)[0] + "_" + datestr + '_filtered.txt' - write_tracking_results_to_file( - filtered_results, - lambda x, y: (x, y), # No scaling, already scaled! - output_filename=output_filename, - ) - - return filtered_results - - -def run_model(video_path, model_type, seconds, skip, tau, kappa, gps_file): - logger.info('---video filename: '+ video_path) - - # launch the tracking - config_track.video_path = video_path - config_track.model_type = model_type - config_track.skip_frames = int(skip) - config_track.tau = int(tau) - config_track.kappa = int(kappa) - config_track.max_length = int(seconds)*24 - - out_folder = create_unique_folder("/tmp/", "output") - output_path = op.join(out_folder, "video.mp4") - filtered_results = track(config_track) - - # postprocess - logger.info('---Postprocessing...') - output_json_path = op.join(out_folder, "output.json") - output_json = postprocess_for_api(filtered_results, id_categories) - with open(output_json_path, 'w') as f_out: - json.dump(output_json, f_out) - - # build video output - logger.info('---Generating new video...') - reader = IterableFrameReader(video_filename=config_track.video_path, - skip_frames=0, - progress_bar=True, - preload=False, - max_frame=config_track.max_length) - - # Get GPS Data - video_duration = reader.total_num_frames / reader.fps - gps_data = get_filled_gps(gps_file, video_duration) - - # Generate new video - generate_video_with_annotations(reader, output_json, output_path, - config_track.skip_frames, config_track.downscale_output, - logger, gps_data=gps_data, labels2icons=labels2icons) - output_label = count_objects(output_json, id_categories) - - - # Get Plastic Map - map_frame = None # default value in case no GPS file - if gps_data is not None: - logger.info('---Creating Plastic Map...') - # Get Trash Prediction - with open(output_json_path) as json_file: - predictions = json.load(json_file) - trash_df = get_df_prediction(predictions, reader.fps) - if len(trash_df) != 0 : - # Get Trash prediction alongside GPS data - trash_gps_df = get_trash_gps_df(trash_df,gps_data) - trash_gps_geo_df = get_trash_gps_geo_df(trash_gps_df) - # Create Map - center_lat = trash_gps_df.iloc[0]['Latitude'] - center_long = trash_gps_df.iloc[0]['Longitude'] - map_path = get_plastic_map(center_lat,center_long,trash_gps_geo_df,out_folder) - html_content = codecs.open(map_path, 'r') - map_html = html_content.read() - map_frame = f"""""" - - logger.info('---Surfnet End processing...') - - return output_path, map_frame, output_label, output_json_path - - -def run_model_simple(video_path): - """ Simplified version with less options - """ - gps_file = video_json_correspondance.get(video_path) - model_type, seconds, skip, tau, kappa = "yolo", 10, 3, 3, 4 - - output_path, map_frame, output_label, output_json_path = run_model(video_path, model_type, seconds, skip, tau, kappa, gps_file) - - return output_path, map_frame, output_label - - -def get_filled_gps(file_obj, video_duration)->list: - """Get a filled GPS point list from Plastic Origin mobile GPS JSON track - Args: - file_obj: a file_obj from gradio input File type - video_duration: in seconds - Returns: - gps_data (list): the GPS filled data as a list - """ - - if file_obj is not None: - json_data = parse_json(file_obj) - json_data_list = get_json_gps_list(json_data) - gps_data = fill_gps(json_data_list, video_duration) - return gps_data - else: - return None - - -def get_plastic_map(center_lat,center_long,trash_gps_gdf,out_folder)->str: - """Get the map with plastic trash detection - Args: - center_lat (float): latitude to center map - center_long (float): longitude to center map - trash_gps_gdf (DataFrame): trash & gps geo dataframe - out_folder (str): folder to save html map - Returns: - map_html_path (str): full path to html map - """ - - m = folium.Map([center_lat, center_long], zoom_start=16) - locs = zip(trash_gps_gdf.geometry.y,trash_gps_gdf.geometry.x) - labels = list(trash_gps_gdf['label']) - i = 0 - for location in locs: - folium.CircleMarker(location=location).add_child(folium.Popup(labels[i])).add_to(m) - i = i + 1 - map_html_path = op.join(out_folder,"plasticmap.html") - m.save(map_html_path) - return map_html_path - - -model_type = gr.inputs.Dropdown(choices=["centernet", "yolo"], type="value", default="yolo", label="model") -skip_slider = gr.inputs.Slider(minimum=0, maximum=15, step=1, default=3, label="skip frames") -tau_slider = gr.inputs.Slider(minimum=1, maximum=7, step=1, default=3, label="tau") -kappa_slider = gr.inputs.Slider(minimum=1, maximum=7, step=1, default=4, label="kappa") -seconds_num = gr.inputs.Number(default=10, label="seconds") -gps_in = gr.inputs.File(type="file", label="GPS Upload", optional=True) - -demo = gr.Blocks() -title = "Surfnet AI Demo" -with demo: - with gr.Tabs(): - with gr.TabItem("The Project"): - gr.HTML(""" - - - - - Surfnet AI Demo - - - -

    Welcome to the Surfnet demo, the algo that tracks Plastic Pollution 🌊

    -

    We all dream about swimming in clear blue waters and walking - bare-footed on a beautiful white sand beach. But our dream is - threatened. Plastics are invading every corner of the earth, - from remote alpine lakes to the deepest oceanic trench. - Thankfully, there are many things we can do.🤝 - Plastic Origins, a citizen science project from Surfrider Europe, - using artificial intelligence to map river plastic pollution, is one of them. - This demo is here for you to test the AI model we use to detect and count litter items on riverbanks. -

    -
    -

    - ❓ Read more on www.plasticorigins.eu -
    - 💻 Join the dev team on Github -
    - 🏷️ Help us label images on www.trashroulette.com -
    -
    -

    - 📧 contact : -
    - plasticorigins@surfrider.eu -

    - - -""") - with gr.TabItem("Surfnet AI"): - gr.HTML(""" - - -Left Side Panel - - - - -

    - Surfnet is an AI model that detects trash on riverbanks. - We use it to map river plastic pollution and act to reduce the introduction of litter into the environment. - Developed & Maintain by a bunch of amazing volunteers from the NGO Surfrider Foundation Europe. - It takes a minute or two to generate the outputs, be patient! -

    - -""" ) - #video_in = gr.inputs.Video(type="mp4", source="upload", label="Video Upload", optional=False) - - gr.Interface(fn=run_model_simple, inputs=["playable_video"], - outputs=["playable_video","html","label"], - examples=[[video1_path], - [video2_path], - [video3_path]], - description="Upload a video, or select one below.", - theme="huggingface", - allow_screenshot=False, allow_flagging="never") - - with gr.TabItem("Advanced Options"): - gr.HTML(""" - - -Left Side Panel - - - - -

    - Advanced options You may choose your own videos and parameters to run the AI: the model type (Yolov5 or Centernet), the sampling period of the video (skip frames), tracking parameters such as tau and kappa, the number of seconds you want to process, and the GPS file. -

    - -""" ) - - #video_in = gr.inputs.Video(type="mp4", source="upload", label="Video Upload", optional=False) - - gr.Interface(fn=run_model, inputs=["playable_video", model_type, seconds_num, skip_slider, tau_slider, kappa_slider,gps_in], - outputs=["playable_video","html","label", "file"], - examples=[[video1_path, "yolo", 10, 3, 3, 4, JSON_FILE_PATH+"gavepau.json"], - [video2_path, "yolo", 10, 3, 3, 4, JSON_FILE_PATH+"midouze.json"], - [video3_path, "yolo", 10, 3, 3, 4, JSON_FILE_PATH+"gavepau.json"]], - description="Upload a video, optionnaly a GPS file and you'll get Plastic detection on river.", - theme="huggingface", - allow_screenshot=False, allow_flagging="never") - -demo.launch() diff --git a/spaces/TILK/UrgencyBot/README.md b/spaces/TILK/UrgencyBot/README.md deleted file mode 100644 index 86c0525502fbba9af4e8d7d7be2dbf9c16bf3b14..0000000000000000000000000000000000000000 --- a/spaces/TILK/UrgencyBot/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: UrgencyBot -emoji: 💻 -colorFrom: gray -colorTo: indigo -sdk: gradio -sdk_version: 3.29.0 -app_file: app.py -pinned: false -license: gpl-3.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/_distutils/_functools.py b/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/_distutils/_functools.py deleted file mode 100644 index e7053bac12fdb7b2cc50448f88318cd93f62cc0e..0000000000000000000000000000000000000000 --- a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/_distutils/_functools.py +++ /dev/null @@ -1,20 +0,0 @@ -import functools - - -# from jaraco.functools 3.5 -def pass_none(func): - """ - Wrap func so it's not called if its first param is None - - >>> print_text = pass_none(print) - >>> print_text('text') - text - >>> print_text(None) - """ - - @functools.wraps(func) - def wrapper(param, *args, **kwargs): - if param is not None: - return func(param, *args, **kwargs) - - return wrapper diff --git a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/wheel.py b/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/wheel.py deleted file mode 100644 index 850e43cd01005c5d63ed08a35ad860858b74dce1..0000000000000000000000000000000000000000 --- a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/wheel.py +++ /dev/null @@ -1,231 +0,0 @@ -"""Wheels support.""" - -import email -import itertools -import functools -import os -import posixpath -import re -import zipfile -import contextlib - -from distutils.util import get_platform - -import setuptools -from setuptools.extern.packaging.version import Version as parse_version -from setuptools.extern.packaging.tags import sys_tags -from setuptools.extern.packaging.utils import canonicalize_name -from setuptools.command.egg_info import write_requirements, _egg_basename -from setuptools.archive_util import _unpack_zipfile_obj - - -WHEEL_NAME = re.compile( - r"""^(?P.+?)-(?P\d.*?) - ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) - )\.whl$""", - re.VERBOSE).match - -NAMESPACE_PACKAGE_INIT = \ - "__import__('pkg_resources').declare_namespace(__name__)\n" - - -@functools.lru_cache(maxsize=None) -def _get_supported_tags(): - # We calculate the supported tags only once, otherwise calling - # this method on thousands of wheels takes seconds instead of - # milliseconds. - return {(t.interpreter, t.abi, t.platform) for t in sys_tags()} - - -def unpack(src_dir, dst_dir): - '''Move everything under `src_dir` to `dst_dir`, and delete the former.''' - for dirpath, dirnames, filenames in os.walk(src_dir): - subdir = os.path.relpath(dirpath, src_dir) - for f in filenames: - src = os.path.join(dirpath, f) - dst = os.path.join(dst_dir, subdir, f) - os.renames(src, dst) - for n, d in reversed(list(enumerate(dirnames))): - src = os.path.join(dirpath, d) - dst = os.path.join(dst_dir, subdir, d) - if not os.path.exists(dst): - # Directory does not exist in destination, - # rename it and prune it from os.walk list. - os.renames(src, dst) - del dirnames[n] - # Cleanup. - for dirpath, dirnames, filenames in os.walk(src_dir, topdown=True): - assert not filenames - os.rmdir(dirpath) - - -@contextlib.contextmanager -def disable_info_traces(): - """ - Temporarily disable info traces. - """ - from distutils import log - saved = log.set_threshold(log.WARN) - try: - yield - finally: - log.set_threshold(saved) - - -class Wheel: - - def __init__(self, filename): - match = WHEEL_NAME(os.path.basename(filename)) - if match is None: - raise ValueError('invalid wheel name: %r' % filename) - self.filename = filename - for k, v in match.groupdict().items(): - setattr(self, k, v) - - def tags(self): - '''List tags (py_version, abi, platform) supported by this wheel.''' - return itertools.product( - self.py_version.split('.'), - self.abi.split('.'), - self.platform.split('.'), - ) - - def is_compatible(self): - '''Is the wheel compatible with the current platform?''' - return next((True for t in self.tags() if t in _get_supported_tags()), False) - - def egg_name(self): - return _egg_basename( - self.project_name, - self.version, - platform=(None if self.platform == 'any' else get_platform()), - ) + ".egg" - - def get_dist_info(self, zf): - # find the correct name of the .dist-info dir in the wheel file - for member in zf.namelist(): - dirname = posixpath.dirname(member) - if (dirname.endswith('.dist-info') and - canonicalize_name(dirname).startswith( - canonicalize_name(self.project_name))): - return dirname - raise ValueError("unsupported wheel format. .dist-info not found") - - def install_as_egg(self, destination_eggdir): - '''Install wheel as an egg directory.''' - with zipfile.ZipFile(self.filename) as zf: - self._install_as_egg(destination_eggdir, zf) - - def _install_as_egg(self, destination_eggdir, zf): - dist_basename = '%s-%s' % (self.project_name, self.version) - dist_info = self.get_dist_info(zf) - dist_data = '%s.data' % dist_basename - egg_info = os.path.join(destination_eggdir, 'EGG-INFO') - - self._convert_metadata(zf, destination_eggdir, dist_info, egg_info) - self._move_data_entries(destination_eggdir, dist_data) - self._fix_namespace_packages(egg_info, destination_eggdir) - - @staticmethod - def _convert_metadata(zf, destination_eggdir, dist_info, egg_info): - import pkg_resources - - def get_metadata(name): - with zf.open(posixpath.join(dist_info, name)) as fp: - value = fp.read().decode('utf-8') - return email.parser.Parser().parsestr(value) - - wheel_metadata = get_metadata('WHEEL') - # Check wheel format version is supported. - wheel_version = parse_version(wheel_metadata.get('Wheel-Version')) - wheel_v1 = ( - parse_version('1.0') <= wheel_version < parse_version('2.0dev0') - ) - if not wheel_v1: - raise ValueError( - 'unsupported wheel format version: %s' % wheel_version) - # Extract to target directory. - _unpack_zipfile_obj(zf, destination_eggdir) - # Convert metadata. - dist_info = os.path.join(destination_eggdir, dist_info) - dist = pkg_resources.Distribution.from_location( - destination_eggdir, dist_info, - metadata=pkg_resources.PathMetadata(destination_eggdir, dist_info), - ) - - # Note: Evaluate and strip markers now, - # as it's difficult to convert back from the syntax: - # foobar; "linux" in sys_platform and extra == 'test' - def raw_req(req): - req.marker = None - return str(req) - install_requires = list(map(raw_req, dist.requires())) - extras_require = { - extra: [ - req - for req in map(raw_req, dist.requires((extra,))) - if req not in install_requires - ] - for extra in dist.extras - } - os.rename(dist_info, egg_info) - os.rename( - os.path.join(egg_info, 'METADATA'), - os.path.join(egg_info, 'PKG-INFO'), - ) - setup_dist = setuptools.Distribution( - attrs=dict( - install_requires=install_requires, - extras_require=extras_require, - ), - ) - with disable_info_traces(): - write_requirements( - setup_dist.get_command_obj('egg_info'), - None, - os.path.join(egg_info, 'requires.txt'), - ) - - @staticmethod - def _move_data_entries(destination_eggdir, dist_data): - """Move data entries to their correct location.""" - dist_data = os.path.join(destination_eggdir, dist_data) - dist_data_scripts = os.path.join(dist_data, 'scripts') - if os.path.exists(dist_data_scripts): - egg_info_scripts = os.path.join( - destination_eggdir, 'EGG-INFO', 'scripts') - os.mkdir(egg_info_scripts) - for entry in os.listdir(dist_data_scripts): - # Remove bytecode, as it's not properly handled - # during easy_install scripts install phase. - if entry.endswith('.pyc'): - os.unlink(os.path.join(dist_data_scripts, entry)) - else: - os.rename( - os.path.join(dist_data_scripts, entry), - os.path.join(egg_info_scripts, entry), - ) - os.rmdir(dist_data_scripts) - for subdir in filter(os.path.exists, ( - os.path.join(dist_data, d) - for d in ('data', 'headers', 'purelib', 'platlib') - )): - unpack(subdir, destination_eggdir) - if os.path.exists(dist_data): - os.rmdir(dist_data) - - @staticmethod - def _fix_namespace_packages(egg_info, destination_eggdir): - namespace_packages = os.path.join( - egg_info, 'namespace_packages.txt') - if os.path.exists(namespace_packages): - with open(namespace_packages) as fp: - namespace_packages = fp.read().split() - for mod in namespace_packages: - mod_dir = os.path.join(destination_eggdir, *mod.split('.')) - mod_init = os.path.join(mod_dir, '__init__.py') - if not os.path.exists(mod_dir): - os.mkdir(mod_dir) - if not os.path.exists(mod_init): - with open(mod_init, 'w') as fp: - fp.write(NAMESPACE_PACKAGE_INIT) diff --git a/spaces/Tetel/secondbing/SydneyGPT/main.py b/spaces/Tetel/secondbing/SydneyGPT/main.py deleted file mode 100644 index 8dd056ac3a870fee1be113fabbf9617240825f85..0000000000000000000000000000000000000000 --- a/spaces/Tetel/secondbing/SydneyGPT/main.py +++ /dev/null @@ -1,11 +0,0 @@ -from EdgeGPT import main as EdgeGPTMain - -import SydneyGPTUtils - - -def main() -> None: - EdgeGPTMain.main() - - -if __name__ == "__main__": - main() diff --git a/spaces/Thafx/sdrv1_4/README.md b/spaces/Thafx/sdrv1_4/README.md deleted file mode 100644 index 5891b6282652495041b1b75d33a6c1110043283f..0000000000000000000000000000000000000000 --- a/spaces/Thafx/sdrv1_4/README.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Realistic Vision v1.4 -emoji: ⚡ -colorFrom: red -colorTo: blue -sdk: gradio -sdk_version: 3.18.0 -app_file: app.py -pinned: true -duplicated_from: Thafx/sdrv1_3 -tags: - - stable-diffusion - - stable-diffusion-diffusers - - text-to-image - - realistic-vision -models: - - SG161222/Realistic_Vision_V1.4 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/spaces/Tirendaz/NER-Demo/README.md b/spaces/Tirendaz/NER-Demo/README.md deleted file mode 100644 index 42df8b330f76b1a42e598325088a823e4d99a8f7..0000000000000000000000000000000000000000 --- a/spaces/Tirendaz/NER-Demo/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: NER Demo -emoji: 😻 -colorFrom: yellow -colorTo: indigo -sdk: gradio -sdk_version: 4.1.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/Tristan/static-rlhf-interface/utils.py b/spaces/Tristan/static-rlhf-interface/utils.py deleted file mode 100644 index c75b14b26d9ea8f8cd3f495d51761c54d708931d..0000000000000000000000000000000000000000 --- a/spaces/Tristan/static-rlhf-interface/utils.py +++ /dev/null @@ -1,39 +0,0 @@ -import subprocess - -from huggingface_hub.repository import _lfs_log_progress - - -def force_git_push( - repo, -): - """ - force a simple git push - Blocking. Will return url to commit on remote - repo. - """ - command = "git push --force" - - try: - with _lfs_log_progress(): - process = subprocess.Popen( - command.split(), - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - encoding="utf-8", - cwd=repo.local_dir, - ) - - stdout, stderr = process.communicate() - return_code = process.poll() - process.kill() - - if len(stderr): - print(stderr) - - if return_code: - raise subprocess.CalledProcessError(return_code, process.args, output=stdout, stderr=stderr) - - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - return repo.git_head_commit_url() diff --git a/spaces/TusharGoel/LayoutLM-DocVQA/README.md b/spaces/TusharGoel/LayoutLM-DocVQA/README.md deleted file mode 100644 index 41da33fdf94bb94293385236f855408cca3989b9..0000000000000000000000000000000000000000 --- a/spaces/TusharGoel/LayoutLM-DocVQA/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: TusharGoel LayoutLM Finetuned DocVQA -emoji: 🌍 -colorFrom: purple -colorTo: indigo -sdk: gradio -sdk_version: 3.44.4 -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/USERNAME0/abcdefghi/app.py b/spaces/USERNAME0/abcdefghi/app.py deleted file mode 100644 index 75f7066c991f7a9442c2e4cbe7d8f7dc024bc39c..0000000000000000000000000000000000000000 --- a/spaces/USERNAME0/abcdefghi/app.py +++ /dev/null @@ -1,5 +0,0 @@ -import streamlit as st - -a = st.number_input('A', 0, 10) -b = st.number_input('B', 0, 10) -st.write('A+B=', a+b) \ No newline at end of file diff --git a/spaces/VIPLab/Track-Anything/tracker/inference/__init__.py b/spaces/VIPLab/Track-Anything/tracker/inference/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Visgift/nyami/README.md b/spaces/Visgift/nyami/README.md deleted file mode 100644 index 743109f64e37ccac8d01035a544b648c881ca9d0..0000000000000000000000000000000000000000 --- a/spaces/Visgift/nyami/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Nyami -emoji: 📈 -colorFrom: indigo -colorTo: pink -sdk: streamlit -sdk_version: 1.21.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/VishnuSaiTeja/RogerStaff/README.md b/spaces/VishnuSaiTeja/RogerStaff/README.md deleted file mode 100644 index 66a7d1a65ef60b11421ae94312aa0a1c9f2f0559..0000000000000000000000000000000000000000 --- a/spaces/VishnuSaiTeja/RogerStaff/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: RogerStaff -emoji: 🔥 -colorFrom: indigo -colorTo: yellow -sdk: gradio -sdk_version: 3.44.4 -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/WKTSHNN/simplify_color_values/app.py b/spaces/WKTSHNN/simplify_color_values/app.py deleted file mode 100644 index 3b65c48c1997c98dc9a30b56eff9097512366580..0000000000000000000000000000000000000000 --- a/spaces/WKTSHNN/simplify_color_values/app.py +++ /dev/null @@ -1,102 +0,0 @@ -import gradio as gr -from PIL import Image -import numpy as np - - -def brightness(image): - - # 変数名の設定 - tmp_dir = "./tmp" - img_filename= "image" - ext = image.split('.')[1] - - - #画像取り込み(白黒) - im_gray = np.array(Image.open(f'{image}').convert('L'), np.float64) - - - #9分割 - im_gray_copy = im_gray.copy() - for num in range(im_gray_copy.shape[0]): - - target = im_gray_copy[num] - target[(target>=216.75)&(target<=255)] = 229.5 - target[(target>=191.25)&(target<216.75)] = 204 - target[(target>=165.75)&(target<191.25)] = 178.5 - target[(target>=140.25)&(target<165.75)] = 153 - target[(target>=114.75)&(target<140.25)] = 127.5 - target[(target>=89.25)&(target<114.75)] = 102 - target[(target>=63.75)&(target<89.25)] = 76.5 - target[(target>=38.25)&(target<63.75)] = 51 - target[(target>=0)&(target<38.25)] = 25.5 - - pil_img = Image.fromarray(im_gray_copy.astype(np.uint8)) - - - #5分割 - im_gray_copy2 = im_gray.copy() - for num2 in range(im_gray_copy2.shape[0]): - - target = im_gray_copy2[num2] - target[(target>=204)&(target<=255)] = 229.5 - target[(target>=153)&(target<204)] = 178.5 - target[(target>=102)&(target<153)] = 127.5 - target[(target>=51)&(target<102)] = 76.5 - target[(target>=0)&(target<51)] = 25.5 - - pil_img2 = Image.fromarray(im_gray_copy2.astype(np.uint8)) - - - #3分割 - im_gray_copy3 = im_gray.copy() - for num3 in range(im_gray_copy2.shape[0]): - - target = im_gray_copy3[num3] - target[(target>=178.5)&(target<=255)] = 229.5 - target[(target>=76.5)&(target<178.5)] = 127.5 - target[(target>=0)&(target<76.5)] = 25.5 - - pil_img3 = Image.fromarray(im_gray_copy3.astype(np.uint8)) - - - #明部・中部・暗部の割合を求める - target2 = im_gray_copy3 - area_bright = np.count_nonzero((target2>=178.5)&(target2<=255)) - area_middle = np.count_nonzero((target2>=76.5)&(target2<178.5)) - area_dark = np.count_nonzero((target2>=0)&(target2<76.5)) - - ratio_bright = round(area_bright/target2.size*100) - ratio_middle = round(area_middle/target2.size*100) - ratio_dark = round(area_dark/target2.size*100) - - - return f'{ratio_bright}%', f'{ratio_middle}%', f'{ratio_dark}%', pil_img, pil_img2, pil_img3 - - - -with gr.Blocks() as demo: - gr.Markdown("**This tool simplifies the colors in your image into 3-color, 5-color, and 9-color monochrome.**") - gr.Markdown("Start selecting your picture and then click **Run** to see the output.") - with gr.Row(): - inp = gr.Image(label="select your picture", type='filepath') - - with gr.Column(scale=1): - outputs1 = gr.Textbox(label='明部 / bright tone') - outputs2 = gr.Textbox(label='中間調 / middle tone') - outputs3 = gr.Textbox(label='暗部 / dark tone') - - with gr.Row(): - outputs4 = gr.Image(label='9-color') - outputs5 = gr.Image(label='5-color') - outputs6 = gr.Image(label='3-color') - - btn = gr.Button("Run") - btn.click(fn=brightness, inputs=inp, outputs=[outputs1, outputs2, outputs3, outputs4, outputs5, outputs6]) - - gr.Markdown("**Description**") - gr.Markdown("In paint software, brightness is represented by numbers ranging from 0 (black) to 100 (white). In the case of monochrome images, brightness directly corresponds to variations in shades of gray. We divide this brightness range as shown in the diagram. By grouping specific brightness ranges into a single color, we aim to simplify the brightness levels.") - gr.HTML("") - -demo.launch() - - diff --git a/spaces/XzJosh/nanami-Bert-VITS2/server.py b/spaces/XzJosh/nanami-Bert-VITS2/server.py deleted file mode 100644 index c736ca4f95fec853950eef6654ef79856beffc0a..0000000000000000000000000000000000000000 --- a/spaces/XzJosh/nanami-Bert-VITS2/server.py +++ /dev/null @@ -1,123 +0,0 @@ -from flask import Flask, request, Response -from io import BytesIO -import torch -from av import open as avopen - -import commons -import utils -from models import SynthesizerTrn -from text.symbols import symbols -from text import cleaned_text_to_sequence, get_bert -from text.cleaner import clean_text -from scipy.io import wavfile - -# Flask Init -app = Flask(__name__) -app.config['JSON_AS_ASCII'] = False -def get_text(text, language_str, hps): - norm_text, phone, tone, word2ph = clean_text(text, language_str) - print([f"{p}{t}" for p, t in zip(phone, tone)]) - phone, tone, language = cleaned_text_to_sequence(phone, tone, language_str) - - if hps.data.add_blank: - phone = commons.intersperse(phone, 0) - tone = commons.intersperse(tone, 0) - language = commons.intersperse(language, 0) - for i in range(len(word2ph)): - word2ph[i] = word2ph[i] * 2 - word2ph[0] += 1 - bert = get_bert(norm_text, word2ph, language_str) - - assert bert.shape[-1] == len(phone) - - phone = torch.LongTensor(phone) - tone = torch.LongTensor(tone) - language = torch.LongTensor(language) - - return bert, phone, tone, language - -def infer(text, sdp_ratio, noise_scale, noise_scale_w,length_scale,sid): - bert, phones, tones, lang_ids = get_text(text,"ZH", hps,) - with torch.no_grad(): - x_tst=phones.to(dev).unsqueeze(0) - tones=tones.to(dev).unsqueeze(0) - lang_ids=lang_ids.to(dev).unsqueeze(0) - bert = bert.to(dev).unsqueeze(0) - x_tst_lengths = torch.LongTensor([phones.size(0)]).to(dev) - speakers = torch.LongTensor([hps.data.spk2id[sid]]).to(dev) - audio = net_g.infer(x_tst, x_tst_lengths, speakers, tones, lang_ids,bert, sdp_ratio=sdp_ratio - , noise_scale=noise_scale, noise_scale_w=noise_scale_w, length_scale=length_scale)[0][0,0].data.cpu().float().numpy() - return audio - -def replace_punctuation(text, i=2): - punctuation = ",。?!" - for char in punctuation: - text = text.replace(char, char * i) - return text - -def wav2(i, o, format): - inp = avopen(i, 'rb') - out = avopen(o, 'wb', format=format) - if format == "ogg": format = "libvorbis" - - ostream = out.add_stream(format) - - for frame in inp.decode(audio=0): - for p in ostream.encode(frame): out.mux(p) - - for p in ostream.encode(None): out.mux(p) - - out.close() - inp.close() - -# Load Generator -hps = utils.get_hparams_from_file("./configs/config.json") - -dev='cuda' -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("logs/G_649000.pth", net_g, None,skip_optimizer=True) - -@app.route("/",methods=['GET','POST']) -def main(): - if request.method == 'GET': - try: - speaker = request.args.get('speaker') - text = request.args.get('text').replace("/n","") - sdp_ratio = float(request.args.get("sdp_ratio", 0.2)) - noise = float(request.args.get("noise", 0.5)) - noisew = float(request.args.get("noisew", 0.6)) - length = float(request.args.get("length", 1.2)) - if length >= 2: - return "Too big length" - if len(text) >=200: - return "Too long text" - fmt = request.args.get("format", "wav") - if None in (speaker, text): - return "Missing Parameter" - if fmt not in ("mp3", "wav", "ogg"): - return "Invalid Format" - except: - return "Invalid Parameter" - - with torch.no_grad(): - audio = infer(text, sdp_ratio=sdp_ratio, noise_scale=noise, noise_scale_w=noisew, length_scale=length, sid=speaker) - - with BytesIO() as wav: - wavfile.write(wav, hps.data.sampling_rate, audio) - torch.cuda.empty_cache() - if fmt == "wav": - return Response(wav.getvalue(), mimetype="audio/wav") - wav.seek(0, 0) - with BytesIO() as ofp: - wav2(wav, ofp, fmt) - return Response( - ofp.getvalue(), - mimetype="audio/mpeg" if fmt == "mp3" else "audio/ogg" - ) diff --git a/spaces/YanzBotz/YanzBotz-Models/lib/infer_pack/modules/F0Predictor/DioF0Predictor.py b/spaces/YanzBotz/YanzBotz-Models/lib/infer_pack/modules/F0Predictor/DioF0Predictor.py deleted file mode 100644 index ee3171bcb7c4a5066560723108b56e055f18be45..0000000000000000000000000000000000000000 --- a/spaces/YanzBotz/YanzBotz-Models/lib/infer_pack/modules/F0Predictor/DioF0Predictor.py +++ /dev/null @@ -1,90 +0,0 @@ -from lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor -import pyworld -import numpy as np - - -class DioF0Predictor(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 resize_f0(self, x, target_len): - source = np.array(x) - source[source < 0.001] = np.nan - target = np.interp( - np.arange(0, len(source) * target_len, len(source)) / target_len, - np.arange(0, len(source)), - source, - ) - res = np.nan_to_num(target) - return res - - def compute_f0(self, wav, p_len=None): - if p_len is None: - p_len = wav.shape[0] // self.hop_length - f0, t = pyworld.dio( - wav.astype(np.double), - fs=self.sampling_rate, - f0_floor=self.f0_min, - f0_ceil=self.f0_max, - frame_period=1000 * self.hop_length / self.sampling_rate, - ) - f0 = pyworld.stonemask(wav.astype(np.double), f0, t, self.sampling_rate) - for index, pitch in enumerate(f0): - f0[index] = round(pitch, 1) - return self.interpolate_f0(self.resize_f0(f0, p_len))[0] - - def compute_f0_uv(self, wav, p_len=None): - if p_len is None: - p_len = wav.shape[0] // self.hop_length - f0, t = pyworld.dio( - wav.astype(np.double), - fs=self.sampling_rate, - f0_floor=self.f0_min, - f0_ceil=self.f0_max, - frame_period=1000 * self.hop_length / self.sampling_rate, - ) - f0 = pyworld.stonemask(wav.astype(np.double), f0, t, self.sampling_rate) - for index, pitch in enumerate(f0): - f0[index] = round(pitch, 1) - return self.interpolate_f0(self.resize_f0(f0, p_len)) diff --git a/spaces/YotamNitzan/domain-expansion/torch_utils/misc.py b/spaces/YotamNitzan/domain-expansion/torch_utils/misc.py deleted file mode 100644 index 7829f4d9f168557ce8a9a6dec289aa964234cb8c..0000000000000000000000000000000000000000 --- a/spaces/YotamNitzan/domain-expansion/torch_utils/misc.py +++ /dev/null @@ -1,262 +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. - -import re -import contextlib -import numpy as np -import torch -import warnings -import dnnlib - -#---------------------------------------------------------------------------- -# Cached construction of constant tensors. Avoids CPU=>GPU copy when the -# same constant is used multiple times. - -_constant_cache = dict() - -def constant(value, shape=None, dtype=None, device=None, memory_format=None): - value = np.asarray(value) - if shape is not None: - shape = tuple(shape) - if dtype is None: - dtype = torch.get_default_dtype() - if device is None: - device = torch.device('cpu') - if memory_format is None: - memory_format = torch.contiguous_format - - key = (value.shape, value.dtype, value.tobytes(), shape, dtype, device, memory_format) - tensor = _constant_cache.get(key, None) - if tensor is None: - tensor = torch.as_tensor(value.copy(), dtype=dtype, device=device) - if shape is not None: - tensor, _ = torch.broadcast_tensors(tensor, torch.empty(shape)) - tensor = tensor.contiguous(memory_format=memory_format) - _constant_cache[key] = tensor - return tensor - -#---------------------------------------------------------------------------- -# Replace NaN/Inf with specified numerical values. - -try: - nan_to_num = torch.nan_to_num # 1.8.0a0 -except AttributeError: - def nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None): # pylint: disable=redefined-builtin - assert isinstance(input, torch.Tensor) - if posinf is None: - posinf = torch.finfo(input.dtype).max - if neginf is None: - neginf = torch.finfo(input.dtype).min - assert nan == 0 - return torch.clamp(input.unsqueeze(0).nansum(0), min=neginf, max=posinf, out=out) - -#---------------------------------------------------------------------------- -# Symbolic assert. - -try: - symbolic_assert = torch._assert # 1.8.0a0 # pylint: disable=protected-access -except AttributeError: - symbolic_assert = torch.Assert # 1.7.0 - -#---------------------------------------------------------------------------- -# Context manager to suppress known warnings in torch.jit.trace(). - -class suppress_tracer_warnings(warnings.catch_warnings): - def __enter__(self): - super().__enter__() - warnings.simplefilter('ignore', category=torch.jit.TracerWarning) - return self - -#---------------------------------------------------------------------------- -# Assert that the shape of a tensor matches the given list of integers. -# None indicates that the size of a dimension is allowed to vary. -# Performs symbolic assertion when used in torch.jit.trace(). - -def assert_shape(tensor, ref_shape): - if tensor.ndim != len(ref_shape): - raise AssertionError(f'Wrong number of dimensions: got {tensor.ndim}, expected {len(ref_shape)}') - for idx, (size, ref_size) in enumerate(zip(tensor.shape, ref_shape)): - if ref_size is None: - pass - elif isinstance(ref_size, torch.Tensor): - with suppress_tracer_warnings(): # as_tensor results are registered as constants - symbolic_assert(torch.equal(torch.as_tensor(size), ref_size), f'Wrong size for dimension {idx}') - elif isinstance(size, torch.Tensor): - with suppress_tracer_warnings(): # as_tensor results are registered as constants - symbolic_assert(torch.equal(size, torch.as_tensor(ref_size)), f'Wrong size for dimension {idx}: expected {ref_size}') - elif size != ref_size: - raise AssertionError(f'Wrong size for dimension {idx}: got {size}, expected {ref_size}') - -#---------------------------------------------------------------------------- -# Function decorator that calls torch.autograd.profiler.record_function(). - -def profiled_function(fn): - def decorator(*args, **kwargs): - with torch.autograd.profiler.record_function(fn.__name__): - return fn(*args, **kwargs) - decorator.__name__ = fn.__name__ - return decorator - -#---------------------------------------------------------------------------- -# Sampler for torch.utils.data.DataLoader that loops over the dataset -# indefinitely, shuffling items as it goes. - -class InfiniteSampler(torch.utils.data.Sampler): - def __init__(self, dataset, rank=0, num_replicas=1, shuffle=True, seed=0, window_size=0.5): - assert len(dataset) > 0 - assert num_replicas > 0 - assert 0 <= rank < num_replicas - assert 0 <= window_size <= 1 - super().__init__(dataset) - self.dataset = dataset - self.rank = rank - self.num_replicas = num_replicas - self.shuffle = shuffle - self.seed = seed - self.window_size = window_size - - def __iter__(self): - order = np.arange(len(self.dataset)) - rnd = None - window = 0 - if self.shuffle: - rnd = np.random.RandomState(self.seed) - rnd.shuffle(order) - window = int(np.rint(order.size * self.window_size)) - - idx = 0 - while True: - i = idx % order.size - if idx % self.num_replicas == self.rank: - yield order[i] - if window >= 2: - j = (i - rnd.randint(window)) % order.size - order[i], order[j] = order[j], order[i] - idx += 1 - -#---------------------------------------------------------------------------- -# Utilities for operating with torch.nn.Module parameters and buffers. - -def params_and_buffers(module): - assert isinstance(module, torch.nn.Module) - return list(module.parameters()) + list(module.buffers()) - -def named_params_and_buffers(module): - assert isinstance(module, torch.nn.Module) - return list(module.named_parameters()) + list(module.named_buffers()) - -def copy_params_and_buffers(src_module, dst_module, require_all=False): - assert isinstance(src_module, torch.nn.Module) - assert isinstance(dst_module, torch.nn.Module) - src_tensors = {name: tensor for name, tensor in named_params_and_buffers(src_module)} - for name, tensor in named_params_and_buffers(dst_module): - assert (name in src_tensors) or (not require_all) - if name in src_tensors: - tensor.copy_(src_tensors[name].detach()).requires_grad_(tensor.requires_grad) - -#---------------------------------------------------------------------------- -# Context manager for easily enabling/disabling DistributedDataParallel -# synchronization. - -@contextlib.contextmanager -def ddp_sync(module, sync): - assert isinstance(module, torch.nn.Module) - if sync or not isinstance(module, torch.nn.parallel.DistributedDataParallel): - yield - else: - with module.no_sync(): - yield - -#---------------------------------------------------------------------------- -# Check DistributedDataParallel consistency across processes. - -def check_ddp_consistency(module, ignore_regex=None): - assert isinstance(module, torch.nn.Module) - for name, tensor in named_params_and_buffers(module): - fullname = type(module).__name__ + '.' + name - if ignore_regex is not None and re.fullmatch(ignore_regex, fullname): - continue - tensor = tensor.detach() - other = tensor.clone() - torch.distributed.broadcast(tensor=other, src=0) - assert (nan_to_num(tensor) == nan_to_num(other)).all(), fullname - -#---------------------------------------------------------------------------- -# Print summary table of module hierarchy. - -def print_module_summary(module, inputs, max_nesting=3, skip_redundant=True): - assert isinstance(module, torch.nn.Module) - assert not isinstance(module, torch.jit.ScriptModule) - assert isinstance(inputs, (tuple, list)) - - # Register hooks. - entries = [] - nesting = [0] - def pre_hook(_mod, _inputs): - nesting[0] += 1 - def post_hook(mod, _inputs, outputs): - nesting[0] -= 1 - if nesting[0] <= max_nesting: - outputs = list(outputs) if isinstance(outputs, (tuple, list)) else [outputs] - outputs = [t for t in outputs if isinstance(t, torch.Tensor)] - entries.append(dnnlib.EasyDict(mod=mod, outputs=outputs)) - hooks = [mod.register_forward_pre_hook(pre_hook) for mod in module.modules()] - hooks += [mod.register_forward_hook(post_hook) for mod in module.modules()] - - # Run module. - outputs = module(*inputs) - for hook in hooks: - hook.remove() - - # Identify unique outputs, parameters, and buffers. - tensors_seen = set() - for e in entries: - e.unique_params = [t for t in e.mod.parameters() if id(t) not in tensors_seen] - e.unique_buffers = [t for t in e.mod.buffers() if id(t) not in tensors_seen] - e.unique_outputs = [t for t in e.outputs if id(t) not in tensors_seen] - tensors_seen |= {id(t) for t in e.unique_params + e.unique_buffers + e.unique_outputs} - - # Filter out redundant entries. - if skip_redundant: - entries = [e for e in entries if len(e.unique_params) or len(e.unique_buffers) or len(e.unique_outputs)] - - # Construct table. - rows = [[type(module).__name__, 'Parameters', 'Buffers', 'Output shape', 'Datatype']] - rows += [['---'] * len(rows[0])] - param_total = 0 - buffer_total = 0 - submodule_names = {mod: name for name, mod in module.named_modules()} - for e in entries: - name = '' if e.mod is module else submodule_names[e.mod] - param_size = sum(t.numel() for t in e.unique_params) - buffer_size = sum(t.numel() for t in e.unique_buffers) - output_shapes = [str(list(e.outputs[0].shape)) for t in e.outputs] - output_dtypes = [str(t.dtype).split('.')[-1] for t in e.outputs] - rows += [[ - name + (':0' if len(e.outputs) >= 2 else ''), - str(param_size) if param_size else '-', - str(buffer_size) if buffer_size else '-', - (output_shapes + ['-'])[0], - (output_dtypes + ['-'])[0], - ]] - for idx in range(1, len(e.outputs)): - rows += [[name + f':{idx}', '-', '-', output_shapes[idx], output_dtypes[idx]]] - param_total += param_size - buffer_total += buffer_size - rows += [['---'] * len(rows[0])] - rows += [['Total', str(param_total), str(buffer_total), '-', '-']] - - # Print table. - widths = [max(len(cell) for cell in column) for column in zip(*rows)] - print() - for row in rows: - print(' '.join(cell + ' ' * (width - len(cell)) for cell, width in zip(row, widths))) - print() - return outputs - -#---------------------------------------------------------------------------- diff --git a/spaces/Yusin/docker_test/Dockerfile b/spaces/Yusin/docker_test/Dockerfile deleted file mode 100644 index 16fe92d72e0e5cb97a32e86609171953bd114c32..0000000000000000000000000000000000000000 --- a/spaces/Yusin/docker_test/Dockerfile +++ /dev/null @@ -1,52 +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 ubuntu:22.04 - -RUN apt-get update - -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ - sudo \ - build-essential \ - gettext \ - autoconf \ - automake \ - libproxy-dev \ - libxml2-dev \ - libtool \ - vpnc-scripts \ - pkg-config \ - libgnutls28-dev \ - git \ - expect - -RUN apt-get update \ - && apt-get install -y python3-pip python3-dev \ - && cd /usr/local/bin \ - && ln -s -f /usr/bin/python3 python \ - && pip3 --no-cache-dir install --upgrade pip \ - && rm -rf /var/lib/apt/lists/* - -RUN git clone https://github.com/openconnect/openconnect.git - -WORKDIR /openconnect -RUN ./autogen.sh -RUN ./configure -RUN make - -COPY requirements.txt /openconnect/requirements.txt -RUN python -m pip install -r /openconnect/requirements.txt - -USER root - -RUN mkdir -p /var/run/vpnc -RUN chmod -R 777 /var/run/vpnc - -RUN cat /dev/net/tun - -RUN mkdir -p /dev/net -RUN mknod /dev/net/tun c 10 200 -RUN chmod 600 /dev/net/tun - -COPY aberconnect.sh /openconnect -RUN chmod +x aberconnect.sh -ENTRYPOINT ["./aberconnect.sh"] diff --git a/spaces/Yuzu22/rvc-models/infer_pack/models_onnx.py b/spaces/Yuzu22/rvc-models/infer_pack/models_onnx.py deleted file mode 100644 index 3cdae2f7f8591a1e43b1d8520baa37b7e9744d72..0000000000000000000000000000000000000000 --- a/spaces/Yuzu22/rvc-models/infer_pack/models_onnx.py +++ /dev/null @@ -1,849 +0,0 @@ -import math, pdb, os -from time import time as ttime -import torch -from torch import nn -from torch.nn import functional as F -from infer_pack import modules -from infer_pack import attentions -from infer_pack import commons -from infer_pack.commons import init_weights, get_padding -from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d -from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm -from infer_pack.commons import init_weights -import numpy as np -from infer_pack import commons - - -class TextEncoder256(nn.Module): - def __init__( - self, - out_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - f0=True, - ): - super().__init__() - self.out_channels = out_channels - 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.emb_phone = nn.Linear(256, hidden_channels) - self.lrelu = nn.LeakyReLU(0.1, inplace=True) - if f0 == True: - self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256 - self.encoder = attentions.Encoder( - hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout - ) - self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1) - - def forward(self, phone, pitch, lengths): - if pitch == None: - x = self.emb_phone(phone) - else: - x = self.emb_phone(phone) + self.emb_pitch(pitch) - x = x * math.sqrt(self.hidden_channels) # [b, t, h] - x = self.lrelu(x) - x = torch.transpose(x, 1, -1) # [b, h, t] - x_mask = torch.unsqueeze(commons.sequence_mask(lengths, x.size(2)), 1).to( - x.dtype - ) - x = self.encoder(x * x_mask, x_mask) - stats = self.proj(x) * x_mask - - m, logs = torch.split(stats, self.out_channels, dim=1) - return m, logs, x_mask - - -class TextEncoder256Sim(nn.Module): - def __init__( - self, - out_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - f0=True, - ): - super().__init__() - self.out_channels = out_channels - 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.emb_phone = nn.Linear(256, hidden_channels) - self.lrelu = nn.LeakyReLU(0.1, inplace=True) - if f0 == True: - self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256 - self.encoder = attentions.Encoder( - hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout - ) - self.proj = nn.Conv1d(hidden_channels, out_channels, 1) - - def forward(self, phone, pitch, lengths): - if pitch == None: - x = self.emb_phone(phone) - else: - x = self.emb_phone(phone) + self.emb_pitch(pitch) - x = x * math.sqrt(self.hidden_channels) # [b, t, h] - x = self.lrelu(x) - x = torch.transpose(x, 1, -1) # [b, h, t] - x_mask = torch.unsqueeze(commons.sequence_mask(lengths, x.size(2)), 1).to( - x.dtype - ) - x = self.encoder(x * x_mask, x_mask) - x = self.proj(x) * x_mask - return x, x_mask - - -class ResidualCouplingBlock(nn.Module): - def __init__( - self, - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - n_flows=4, - gin_channels=0, - ): - 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.n_flows = n_flows - self.gin_channels = gin_channels - - self.flows = nn.ModuleList() - for i in range(n_flows): - self.flows.append( - modules.ResidualCouplingLayer( - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=gin_channels, - mean_only=True, - ) - ) - self.flows.append(modules.Flip()) - - def forward(self, x, x_mask, g=None, reverse=False): - if not reverse: - for flow in self.flows: - x, _ = flow(x, x_mask, g=g, reverse=reverse) - else: - for flow in reversed(self.flows): - x = flow(x, x_mask, g=g, reverse=reverse) - return x - - def remove_weight_norm(self): - for i in range(self.n_flows): - self.flows[i * 2].remove_weight_norm() - - -class PosteriorEncoder(nn.Module): - def __init__( - self, - in_channels, - out_channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=0, - ): - super().__init__() - self.in_channels = in_channels - self.out_channels = out_channels - 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.pre = nn.Conv1d(in_channels, hidden_channels, 1) - self.enc = modules.WN( - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=gin_channels, - ) - self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1) - - def forward(self, x, x_lengths, g=None): - x_mask = torch.unsqueeze(commons.sequence_mask(x_lengths, x.size(2)), 1).to( - x.dtype - ) - x = self.pre(x) * x_mask - x = self.enc(x, x_mask, g=g) - stats = self.proj(x) * x_mask - m, logs = torch.split(stats, self.out_channels, dim=1) - z = (m + torch.randn_like(m) * torch.exp(logs)) * x_mask - return z, m, logs, x_mask - - def remove_weight_norm(self): - self.enc.remove_weight_norm() - - -class Generator(torch.nn.Module): - def __init__( - self, - initial_channel, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels=0, - ): - super(Generator, self).__init__() - self.num_kernels = len(resblock_kernel_sizes) - self.num_upsamples = len(upsample_rates) - self.conv_pre = Conv1d( - initial_channel, upsample_initial_channel, 7, 1, padding=3 - ) - resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2 - - self.ups = nn.ModuleList() - for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)): - self.ups.append( - weight_norm( - ConvTranspose1d( - upsample_initial_channel // (2**i), - upsample_initial_channel // (2 ** (i + 1)), - k, - u, - padding=(k - u) // 2, - ) - ) - ) - - self.resblocks = nn.ModuleList() - for i in range(len(self.ups)): - ch = upsample_initial_channel // (2 ** (i + 1)) - for j, (k, d) in enumerate( - zip(resblock_kernel_sizes, resblock_dilation_sizes) - ): - self.resblocks.append(resblock(ch, k, d)) - - self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False) - self.ups.apply(init_weights) - - if gin_channels != 0: - self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1) - - def forward(self, x, g=None): - x = self.conv_pre(x) - if g is not None: - x = x + self.cond(g) - - for i in range(self.num_upsamples): - x = F.leaky_relu(x, modules.LRELU_SLOPE) - x = self.ups[i](x) - xs = None - for j in range(self.num_kernels): - if xs is None: - xs = self.resblocks[i * self.num_kernels + j](x) - else: - xs += self.resblocks[i * self.num_kernels + j](x) - x = xs / self.num_kernels - x = F.leaky_relu(x) - x = self.conv_post(x) - x = torch.tanh(x) - - return x - - def remove_weight_norm(self): - for l in self.ups: - remove_weight_norm(l) - for l in self.resblocks: - l.remove_weight_norm() - - -class SineGen(torch.nn.Module): - """Definition of sine generator - SineGen(samp_rate, harmonic_num = 0, - sine_amp = 0.1, noise_std = 0.003, - voiced_threshold = 0, - flag_for_pulse=False) - samp_rate: sampling rate in Hz - harmonic_num: number of harmonic overtones (default 0) - sine_amp: amplitude of sine-wavefrom (default 0.1) - noise_std: std of Gaussian noise (default 0.003) - voiced_thoreshold: F0 threshold for U/V classification (default 0) - flag_for_pulse: this SinGen is used inside PulseGen (default False) - Note: when flag_for_pulse is True, the first time step of a voiced - segment is always sin(np.pi) or cos(0) - """ - - def __init__( - self, - samp_rate, - harmonic_num=0, - sine_amp=0.1, - noise_std=0.003, - voiced_threshold=0, - flag_for_pulse=False, - ): - super(SineGen, self).__init__() - self.sine_amp = sine_amp - self.noise_std = noise_std - self.harmonic_num = harmonic_num - self.dim = self.harmonic_num + 1 - self.sampling_rate = samp_rate - self.voiced_threshold = voiced_threshold - - def _f02uv(self, f0): - # generate uv signal - uv = torch.ones_like(f0) - uv = uv * (f0 > self.voiced_threshold) - return uv - - def forward(self, f0, upp): - """sine_tensor, uv = forward(f0) - input F0: tensor(batchsize=1, length, dim=1) - f0 for unvoiced steps should be 0 - output sine_tensor: tensor(batchsize=1, length, dim) - output uv: tensor(batchsize=1, length, 1) - """ - with torch.no_grad(): - f0 = f0[:, None].transpose(1, 2) - f0_buf = torch.zeros(f0.shape[0], f0.shape[1], self.dim, device=f0.device) - # fundamental component - f0_buf[:, :, 0] = f0[:, :, 0] - for idx in np.arange(self.harmonic_num): - f0_buf[:, :, idx + 1] = f0_buf[:, :, 0] * ( - idx + 2 - ) # idx + 2: the (idx+1)-th overtone, (idx+2)-th harmonic - rad_values = (f0_buf / self.sampling_rate) % 1 ###%1意味着n_har的乘积无法后处理优化 - rand_ini = torch.rand( - f0_buf.shape[0], f0_buf.shape[2], device=f0_buf.device - ) - rand_ini[:, 0] = 0 - rad_values[:, 0, :] = rad_values[:, 0, :] + rand_ini - tmp_over_one = torch.cumsum(rad_values, 1) # % 1 #####%1意味着后面的cumsum无法再优化 - tmp_over_one *= upp - tmp_over_one = F.interpolate( - tmp_over_one.transpose(2, 1), - scale_factor=upp, - mode="linear", - align_corners=True, - ).transpose(2, 1) - rad_values = F.interpolate( - rad_values.transpose(2, 1), scale_factor=upp, mode="nearest" - ).transpose( - 2, 1 - ) ####### - tmp_over_one %= 1 - tmp_over_one_idx = (tmp_over_one[:, 1:, :] - tmp_over_one[:, :-1, :]) < 0 - cumsum_shift = torch.zeros_like(rad_values) - cumsum_shift[:, 1:, :] = tmp_over_one_idx * -1.0 - sine_waves = torch.sin( - torch.cumsum(rad_values + cumsum_shift, dim=1) * 2 * np.pi - ) - sine_waves = sine_waves * self.sine_amp - uv = self._f02uv(f0) - uv = F.interpolate( - uv.transpose(2, 1), scale_factor=upp, mode="nearest" - ).transpose(2, 1) - noise_amp = uv * self.noise_std + (1 - uv) * self.sine_amp / 3 - noise = noise_amp * torch.randn_like(sine_waves) - sine_waves = sine_waves * uv + noise - return sine_waves, uv, noise - - -class SourceModuleHnNSF(torch.nn.Module): - """SourceModule for hn-nsf - SourceModule(sampling_rate, harmonic_num=0, sine_amp=0.1, - add_noise_std=0.003, voiced_threshod=0) - sampling_rate: sampling_rate in Hz - harmonic_num: number of harmonic above F0 (default: 0) - sine_amp: amplitude of sine source signal (default: 0.1) - add_noise_std: std of additive Gaussian noise (default: 0.003) - note that amplitude of noise in unvoiced is decided - by sine_amp - voiced_threshold: threhold to set U/V given F0 (default: 0) - Sine_source, noise_source = SourceModuleHnNSF(F0_sampled) - F0_sampled (batchsize, length, 1) - Sine_source (batchsize, length, 1) - noise_source (batchsize, length 1) - uv (batchsize, length, 1) - """ - - def __init__( - self, - sampling_rate, - harmonic_num=0, - sine_amp=0.1, - add_noise_std=0.003, - voiced_threshod=0, - is_half=True, - ): - super(SourceModuleHnNSF, self).__init__() - - self.sine_amp = sine_amp - self.noise_std = add_noise_std - self.is_half = is_half - # to produce sine waveforms - self.l_sin_gen = SineGen( - sampling_rate, harmonic_num, sine_amp, add_noise_std, voiced_threshod - ) - - # to merge source harmonics into a single excitation - self.l_linear = torch.nn.Linear(harmonic_num + 1, 1) - self.l_tanh = torch.nn.Tanh() - - def forward(self, x, upp=None): - sine_wavs, uv, _ = self.l_sin_gen(x, upp) - if self.is_half: - sine_wavs = sine_wavs.half() - sine_merge = self.l_tanh(self.l_linear(sine_wavs)) - return sine_merge, None, None # noise, uv - - -class GeneratorNSF(torch.nn.Module): - def __init__( - self, - initial_channel, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels, - sr, - is_half=False, - ): - super(GeneratorNSF, self).__init__() - self.num_kernels = len(resblock_kernel_sizes) - self.num_upsamples = len(upsample_rates) - - self.f0_upsamp = torch.nn.Upsample(scale_factor=np.prod(upsample_rates)) - self.m_source = SourceModuleHnNSF( - sampling_rate=sr, harmonic_num=0, is_half=is_half - ) - self.noise_convs = nn.ModuleList() - self.conv_pre = Conv1d( - initial_channel, upsample_initial_channel, 7, 1, padding=3 - ) - resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2 - - self.ups = nn.ModuleList() - for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)): - c_cur = upsample_initial_channel // (2 ** (i + 1)) - self.ups.append( - weight_norm( - ConvTranspose1d( - upsample_initial_channel // (2**i), - upsample_initial_channel // (2 ** (i + 1)), - k, - u, - padding=(k - u) // 2, - ) - ) - ) - if i + 1 < len(upsample_rates): - stride_f0 = np.prod(upsample_rates[i + 1 :]) - self.noise_convs.append( - Conv1d( - 1, - c_cur, - kernel_size=stride_f0 * 2, - stride=stride_f0, - padding=stride_f0 // 2, - ) - ) - else: - self.noise_convs.append(Conv1d(1, c_cur, kernel_size=1)) - - self.resblocks = nn.ModuleList() - for i in range(len(self.ups)): - ch = upsample_initial_channel // (2 ** (i + 1)) - for j, (k, d) in enumerate( - zip(resblock_kernel_sizes, resblock_dilation_sizes) - ): - self.resblocks.append(resblock(ch, k, d)) - - self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False) - self.ups.apply(init_weights) - - if gin_channels != 0: - self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1) - - self.upp = np.prod(upsample_rates) - - def forward(self, x, f0, g=None): - har_source, noi_source, uv = self.m_source(f0, self.upp) - har_source = har_source.transpose(1, 2) - x = self.conv_pre(x) - if g is not None: - x = x + self.cond(g) - - for i in range(self.num_upsamples): - x = F.leaky_relu(x, modules.LRELU_SLOPE) - x = self.ups[i](x) - x_source = self.noise_convs[i](har_source) - x = x + x_source - xs = None - for j in range(self.num_kernels): - if xs is None: - xs = self.resblocks[i * self.num_kernels + j](x) - else: - xs += self.resblocks[i * self.num_kernels + j](x) - x = xs / self.num_kernels - x = F.leaky_relu(x) - x = self.conv_post(x) - x = torch.tanh(x) - return x - - def remove_weight_norm(self): - for l in self.ups: - remove_weight_norm(l) - for l in self.resblocks: - l.remove_weight_norm() - - -sr2sr = { - "32k": 32000, - "40k": 40000, - "48k": 48000, -} - - -class SynthesizerTrnMs256NSFsid(nn.Module): - def __init__( - self, - spec_channels, - segment_size, - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - spk_embed_dim, - gin_channels, - sr, - **kwargs - ): - super().__init__() - if type(sr) == type("strr"): - sr = sr2sr[sr] - self.spec_channels = spec_channels - self.inter_channels = inter_channels - 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.resblock = resblock - self.resblock_kernel_sizes = resblock_kernel_sizes - self.resblock_dilation_sizes = resblock_dilation_sizes - self.upsample_rates = upsample_rates - self.upsample_initial_channel = upsample_initial_channel - self.upsample_kernel_sizes = upsample_kernel_sizes - self.segment_size = segment_size - self.gin_channels = gin_channels - # self.hop_length = hop_length# - self.spk_embed_dim = spk_embed_dim - self.enc_p = TextEncoder256( - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - ) - self.dec = GeneratorNSF( - inter_channels, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels=gin_channels, - sr=sr, - is_half=kwargs["is_half"], - ) - self.enc_q = PosteriorEncoder( - spec_channels, - inter_channels, - hidden_channels, - 5, - 1, - 16, - gin_channels=gin_channels, - ) - self.flow = ResidualCouplingBlock( - inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels - ) - self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels) - print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim) - - def remove_weight_norm(self): - self.dec.remove_weight_norm() - self.flow.remove_weight_norm() - self.enc_q.remove_weight_norm() - - def forward(self, phone, phone_lengths, pitch, nsff0, sid, rnd, max_len=None): - g = self.emb_g(sid).unsqueeze(-1) - m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths) - z_p = (m_p + torch.exp(logs_p) * rnd) * x_mask - z = self.flow(z_p, x_mask, g=g, reverse=True) - o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g) - return o - - -class SynthesizerTrnMs256NSFsid_sim(nn.Module): - """ - Synthesizer for Training - """ - - def __init__( - self, - spec_channels, - segment_size, - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - spk_embed_dim, - # hop_length, - gin_channels=0, - use_sdp=True, - **kwargs - ): - super().__init__() - self.spec_channels = spec_channels - self.inter_channels = inter_channels - 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.resblock = resblock - self.resblock_kernel_sizes = resblock_kernel_sizes - self.resblock_dilation_sizes = resblock_dilation_sizes - self.upsample_rates = upsample_rates - self.upsample_initial_channel = upsample_initial_channel - self.upsample_kernel_sizes = upsample_kernel_sizes - self.segment_size = segment_size - self.gin_channels = gin_channels - # self.hop_length = hop_length# - self.spk_embed_dim = spk_embed_dim - self.enc_p = TextEncoder256Sim( - inter_channels, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size, - p_dropout, - ) - self.dec = GeneratorNSF( - inter_channels, - resblock, - resblock_kernel_sizes, - resblock_dilation_sizes, - upsample_rates, - upsample_initial_channel, - upsample_kernel_sizes, - gin_channels=gin_channels, - is_half=kwargs["is_half"], - ) - - self.flow = ResidualCouplingBlock( - inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels - ) - self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels) - print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim) - - def remove_weight_norm(self): - self.dec.remove_weight_norm() - self.flow.remove_weight_norm() - self.enc_q.remove_weight_norm() - - def forward( - self, phone, phone_lengths, pitch, pitchf, ds, max_len=None - ): # y是spec不需要了现在 - g = self.emb_g(ds.unsqueeze(0)).unsqueeze(-1) # [b, 256, 1]##1是t,广播的 - x, x_mask = self.enc_p(phone, pitch, phone_lengths) - x = self.flow(x, x_mask, g=g, reverse=True) - o = self.dec((x * x_mask)[:, :, :max_len], pitchf, g=g) - return o - - -class MultiPeriodDiscriminator(torch.nn.Module): - def __init__(self, use_spectral_norm=False): - super(MultiPeriodDiscriminator, self).__init__() - periods = [2, 3, 5, 7, 11, 17] - # periods = [3, 5, 7, 11, 17, 23, 37] - - discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)] - discs = discs + [ - DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods - ] - self.discriminators = nn.ModuleList(discs) - - def forward(self, y, y_hat): - y_d_rs = [] # - y_d_gs = [] - fmap_rs = [] - fmap_gs = [] - for i, d in enumerate(self.discriminators): - y_d_r, fmap_r = d(y) - y_d_g, fmap_g = d(y_hat) - # for j in range(len(fmap_r)): - # print(i,j,y.shape,y_hat.shape,fmap_r[j].shape,fmap_g[j].shape) - y_d_rs.append(y_d_r) - y_d_gs.append(y_d_g) - fmap_rs.append(fmap_r) - fmap_gs.append(fmap_g) - - return y_d_rs, y_d_gs, fmap_rs, fmap_gs - - -class DiscriminatorS(torch.nn.Module): - def __init__(self, use_spectral_norm=False): - super(DiscriminatorS, self).__init__() - norm_f = weight_norm if use_spectral_norm == False else spectral_norm - self.convs = nn.ModuleList( - [ - norm_f(Conv1d(1, 16, 15, 1, padding=7)), - norm_f(Conv1d(16, 64, 41, 4, groups=4, padding=20)), - norm_f(Conv1d(64, 256, 41, 4, groups=16, padding=20)), - norm_f(Conv1d(256, 1024, 41, 4, groups=64, padding=20)), - norm_f(Conv1d(1024, 1024, 41, 4, groups=256, padding=20)), - norm_f(Conv1d(1024, 1024, 5, 1, padding=2)), - ] - ) - self.conv_post = norm_f(Conv1d(1024, 1, 3, 1, padding=1)) - - def forward(self, x): - fmap = [] - - for l in self.convs: - x = l(x) - x = F.leaky_relu(x, modules.LRELU_SLOPE) - fmap.append(x) - x = self.conv_post(x) - fmap.append(x) - x = torch.flatten(x, 1, -1) - - return x, fmap - - -class DiscriminatorP(torch.nn.Module): - def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=False): - super(DiscriminatorP, self).__init__() - self.period = period - self.use_spectral_norm = use_spectral_norm - norm_f = weight_norm if use_spectral_norm == False else spectral_norm - self.convs = nn.ModuleList( - [ - norm_f( - Conv2d( - 1, - 32, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 32, - 128, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 128, - 512, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 512, - 1024, - (kernel_size, 1), - (stride, 1), - padding=(get_padding(kernel_size, 1), 0), - ) - ), - norm_f( - Conv2d( - 1024, - 1024, - (kernel_size, 1), - 1, - padding=(get_padding(kernel_size, 1), 0), - ) - ), - ] - ) - self.conv_post = norm_f(Conv2d(1024, 1, (3, 1), 1, padding=(1, 0))) - - def forward(self, x): - fmap = [] - - # 1d to 2d - b, c, t = x.shape - if t % self.period != 0: # pad first - n_pad = self.period - (t % self.period) - x = F.pad(x, (0, n_pad), "reflect") - t = t + n_pad - x = x.view(b, c, t // self.period, self.period) - - for l in self.convs: - x = l(x) - x = F.leaky_relu(x, modules.LRELU_SLOPE) - fmap.append(x) - x = self.conv_post(x) - fmap.append(x) - x = torch.flatten(x, 1, -1) - - return x, fmap diff --git a/spaces/Zengyf-CVer/Gradio-YOLOv8-Det/__init__.py b/spaces/Zengyf-CVer/Gradio-YOLOv8-Det/__init__.py deleted file mode 100644 index a8a98f8df29d8f62fbd9b9cd15ab5192dc96467c..0000000000000000000000000000000000000000 --- a/spaces/Zengyf-CVer/Gradio-YOLOv8-Det/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__author__ = "曾逸夫(Zeng Yifu)" -__email__ = "zyfiy1314@163.com" diff --git a/spaces/achimoraites/TextClassification-roberta-base_ag_news/app.py b/spaces/achimoraites/TextClassification-roberta-base_ag_news/app.py deleted file mode 100644 index d7b438f0e0725558eee1870329b5d4f4282553b8..0000000000000000000000000000000000000000 --- a/spaces/achimoraites/TextClassification-roberta-base_ag_news/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/achimoraites/roberta-base_ag_news").launch() \ No newline at end of file diff --git a/spaces/adorp/ControlNet-v1-1-duplicate/app_scribble_interactive.py b/spaces/adorp/ControlNet-v1-1-duplicate/app_scribble_interactive.py deleted file mode 100644 index 3550bf67211d14febd1a48cbafdbb523383d60f9..0000000000000000000000000000000000000000 --- a/spaces/adorp/ControlNet-v1-1-duplicate/app_scribble_interactive.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python - -import gradio as gr -import numpy as np - -from utils import randomize_seed_fn - - -def create_canvas(w, h): - return np.zeros(shape=(h, w, 3), dtype=np.uint8) + 255 - - -def create_demo(process, max_images=12, default_num_images=3): - with gr.Blocks() as demo: - with gr.Row(): - with gr.Column(): - canvas_width = gr.Slider(label='Canvas width', - minimum=256, - maximum=512, - value=512, - step=1) - canvas_height = gr.Slider(label='Canvas height', - minimum=256, - maximum=512, - value=512, - step=1) - create_button = gr.Button('Open drawing canvas!') - image = gr.Image(tool='sketch', brush_radius=10) - prompt = gr.Textbox(label='Prompt') - run_button = gr.Button('Run') - with gr.Accordion('Advanced options', open=False): - num_samples = gr.Slider(label='Number of images', - minimum=1, - maximum=max_images, - value=default_num_images, - step=1) - image_resolution = gr.Slider(label='Image resolution', - minimum=256, - maximum=512, - value=512, - step=256) - num_steps = gr.Slider(label='Number of steps', - minimum=1, - maximum=100, - value=20, - step=1) - guidance_scale = gr.Slider(label='Guidance scale', - minimum=0.1, - maximum=30.0, - value=9.0, - step=0.1) - seed = gr.Slider(label='Seed', - minimum=0, - maximum=1000000, - step=1, - value=0, - randomize=True) - randomize_seed = gr.Checkbox(label='Randomize seed', - value=True) - a_prompt = gr.Textbox( - label='Additional prompt', - value='best quality, extremely detailed') - n_prompt = gr.Textbox( - label='Negative prompt', - value= - 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality' - ) - with gr.Column(): - result = gr.Gallery(label='Output', show_label=False).style( - columns=2, object_fit='scale-down') - - create_button.click(fn=create_canvas, - inputs=[canvas_width, canvas_height], - outputs=image, - queue=False) - inputs = [ - image, - prompt, - a_prompt, - n_prompt, - num_samples, - image_resolution, - num_steps, - guidance_scale, - seed, - ] - prompt.submit( - fn=randomize_seed_fn, - inputs=[seed, randomize_seed], - outputs=seed, - queue=False, - ).then( - fn=process, - inputs=inputs, - outputs=result, - ) - run_button.click( - fn=randomize_seed_fn, - inputs=[seed, randomize_seed], - outputs=seed, - queue=False, - ).then( - fn=process, - inputs=inputs, - outputs=result, - ) - return demo - - -if __name__ == '__main__': - from model import Model - model = Model(task_name='scribble') - demo = create_demo(model.process_scribble_interactive) - demo.queue().launch() diff --git a/spaces/akhaliq/Holistic/app.py b/spaces/akhaliq/Holistic/app.py deleted file mode 100644 index d871fc9229840b805634a3c00af26b16038b63b0..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/Holistic/app.py +++ /dev/null @@ -1,62 +0,0 @@ -import mediapipe as mp -import gradio as gr -import cv2 -import torch -# Images -torch.hub.download_url_to_file('https://i.imgur.com/9koaC6b.png', 'pose.png') - -import mediapipe as mp -mp_holistic = mp.solutions.holistic - -# Prepare DrawingSpec for drawing the face landmarks later. -mp_drawing = mp.solutions.drawing_utils -drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1) - -def inference(image): - # Run MediaPipe Holistic and draw pose landmarks. - with mp_holistic.Holistic(static_image_mode=True, min_detection_confidence=0.5, model_complexity=2) as holistic: - # Convert the BGR image to RGB and process it with MediaPipe Pose. - results = holistic.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) - - # Print nose coordinates. - image_hight, image_width, _ = image.shape - if results.pose_landmarks: - print( - f'Nose coordinates: (' - f'{results.pose_landmarks.landmark[mp_holistic.PoseLandmark.NOSE].x * image_width}, ' - f'{results.pose_landmarks.landmark[mp_holistic.PoseLandmark.NOSE].y * image_hight})' - ) - - # Draw pose landmarks. - annotated_image = image.copy() - mp_drawing.draw_landmarks(annotated_image, results.left_hand_landmarks, mp_holistic.HAND_CONNECTIONS) - mp_drawing.draw_landmarks(annotated_image, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS) - mp_drawing.draw_landmarks( - image=annotated_image, - landmark_list=results.face_landmarks, - connections=mp_holistic.FACEMESH_TESSELATION, - landmark_drawing_spec=drawing_spec, - connection_drawing_spec=drawing_spec) - mp_drawing.draw_landmarks( - image=annotated_image, - landmark_list=results.pose_landmarks, - connections=mp_holistic.POSE_CONNECTIONS, - landmark_drawing_spec=drawing_spec, - connection_drawing_spec=drawing_spec) - return annotated_image - - -title = "Holistic Tracking" -description = "Gradio demo for Holistic Tracking, Simultaneous and semantically consistent tracking of 33 pose, 21 per-hand, and 468 facial landmarks. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below." -article = "

    MediaPipe Holistic — Simultaneous Face, Hand and Pose Prediction, on Device | Github Repo

    " -gr.Interface( - inference, - [gr.inputs.Image(label="Input")], - gr.outputs.Image(type="pil", label="Output"), - title=title, - description=description, - article=article, - examples=[ - ["pose.png"] - ] - ).launch() \ No newline at end of file diff --git a/spaces/akhaliq/JoJoGAN/e4e/models/stylegan2/__init__.py b/spaces/akhaliq/JoJoGAN/e4e/models/stylegan2/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/akhaliq/SummerTime/model/third_party/HMNet/Utils/distributed.py b/spaces/akhaliq/SummerTime/model/third_party/HMNet/Utils/distributed.py deleted file mode 100644 index 979c66822b499aa49dfebcdb6e639dc70966fae6..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/SummerTime/model/third_party/HMNet/Utils/distributed.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT license. - -import os -import torch - - -def distributed(opt, is_nocuda): - cluster = opt["cluster"] - world_size = 1 - local_size = 1 - rank = 0 - local_rank = 0 - is_master = True - run = None - - if is_nocuda or not torch.cuda.is_available(): - device = torch.device("cpu") - n_gpu = 0 - else: - if "OMPI_COMM_WORLD_SIZE" in os.environ: - world_size = int(os.environ["OMPI_COMM_WORLD_SIZE"]) - local_size = int(os.environ["OMPI_COMM_WORLD_LOCAL_SIZE"]) - rank = int(os.environ["OMPI_COMM_WORLD_RANK"]) - local_rank = int(os.environ["OMPI_COMM_WORLD_LOCAL_RANK"]) - is_master = rank == 0 - - torch.cuda.set_device(local_rank) - device = torch.device("cuda", local_rank) - n_gpu = 1 - # the following assumes that all processes run on a single node - if torch.distributed.is_available() and world_size > 1: - # Initializes the distributed backend which will take care of sychronizing nodes/GPUs - os.environ["WORLD_SIZE"] = str(world_size) - os.environ["RANK"] = str(rank) - os.environ["MASTER_ADDR"] = "127.0.0.1" - os.environ["MASTER_PORT"] = ( - opt["master_port"] if "master_port" in opt else "35551" - ) - torch.distributed.init_process_group( - backend="nccl" - ) # using environment variable initialization - print("Distributed package is available. Process group initialized.") - - return device, n_gpu, world_size, local_size, rank, local_rank, is_master, run diff --git a/spaces/akhaliq/VQMIVC/ParallelWaveGAN/egs/template_single_spk/voc1/local/data_prep.sh b/spaces/akhaliq/VQMIVC/ParallelWaveGAN/egs/template_single_spk/voc1/local/data_prep.sh deleted file mode 100644 index b2044d8f4bc045ec1052547a2657bbc0ff35fce4..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/VQMIVC/ParallelWaveGAN/egs/template_single_spk/voc1/local/data_prep.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -# Copyright 2020 Tomoki Hayashi -# MIT License (https://opensource.org/licenses/MIT) - -# shellcheck disable=SC1091 -. ./path.sh || exit 1; - -fs=22050 -num_dev=100 -num_eval=100 -train_set="train_nodev" -dev_set="dev" -eval_set="eval" -shuffle=false - -# shellcheck disable=SC1091 -. utils/parse_options.sh || exit 1; - -db_root=$1 -data_dir=$2 - -# check arguments -if [ $# != 2 ]; then - echo "Usage: $0 [Options] " - echo "" - echo "Options:" - echo " --num_dev: number of development uttreances (default=250)." - echo " --num_eval: number of evaluation uttreances (default=250)." - echo " --train_set: name of train set (default=train_nodev)." - echo " --dev_set: name of dev set (default=dev)." - echo " --eval_set: name of eval set (default=eval)." - echo " --shuffle: whether to perform shuffle in making dev / eval set (default=false)." - exit 1 -fi - -set -euo pipefail - -[ ! -e "${data_dir}/all" ] && mkdir -p "${data_dir}/all" - -# set filenames -scp="${data_dir}/all/wav.scp" - -# check file existence -[ -e "${scp}" ] && rm "${scp}" - -# make all scp -find "${db_root}" -follow -name "*.wav" | sort | while read -r filename; do - id=$(basename "${filename}" | sed -e "s/\.[^\.]*$//g") - echo "${id} cat ${filename} | sox -t wav - -c 1 -b 16 -t wav - rate ${fs} |" >> "${scp}" -done - -# split -num_all=$(wc -l < "${scp}") -num_deveval=$((num_dev + num_eval)) -num_train=$((num_all - num_deveval)) -if [ ${num_eval} -ne 0 ]; then - utils/split_data.sh \ - --num_first "${num_train}" \ - --num_second "${num_deveval}" \ - --shuffle "${shuffle}" \ - "${data_dir}/all" \ - "${data_dir}/${train_set}" \ - "${data_dir}/deveval" - utils/split_data.sh \ - --num_first "${num_dev}" \ - --num_second "${num_eval}" \ - --shuffle "${shuffle}" \ - "${data_dir}/deveval" \ - "${data_dir}/${dev_set}" \ - "${data_dir}/${eval_set}" -else - utils/split_data.sh \ - --num_first "${num_train}" \ - --num_second "${num_deveval}" \ - --shuffle "${shuffle}" \ - "${data_dir}/all" \ - "${data_dir}/${train_set}" \ - "${data_dir}/${dev_set}" - cp -r "${data_dir}/${dev_set}" "${data_dir}/${eval_set}" -fi - -# remove tmp directories -rm -rf "${data_dir}/all" -rm -rf "${data_dir}/deveval" - -echo "Successfully prepared data." diff --git a/spaces/ali-ghamdan/realesrgan-models/docs/anime_comparisons_CN.md b/spaces/ali-ghamdan/realesrgan-models/docs/anime_comparisons_CN.md deleted file mode 100644 index 43ba58344ed9554d5b30e2815d1b7d4ab8bc503f..0000000000000000000000000000000000000000 --- a/spaces/ali-ghamdan/realesrgan-models/docs/anime_comparisons_CN.md +++ /dev/null @@ -1,68 +0,0 @@ -# 动漫视频模型比较 - -[English](anime_comparisons.md) **|** [简体中文](anime_comparisons_CN.md) - -## 更新 - -- 2022/04/24: 发布 **AnimeVideo-v3**. 主要做了以下更新: - - **更自然** - - **更少瑕疵** - - **颜色保持得更好** - - **更好的纹理恢复** - - **虚化背景处理** - -## 比较 - -我们将 RealESRGAN-AnimeVideo-v3 与以下方法进行了比较。我们的 RealESRGAN-AnimeVideo-v3 可以以更快的推理速度获得更好的结果。 - -- [waifu2x](https://github.com/nihui/waifu2x-ncnn-vulkan). 超参数: `tile=0`, `noiselevel=2` -- [Real-CUGAN](https://github.com/bilibili/ailab/tree/main/Real-CUGAN): 我们使用了[20220227](https://github.com/bilibili/ailab/releases/tag/Real-CUGAN-add-faster-low-memory-mode)版本, 超参: `cache_mode=0`, `tile=0`, `alpha=1`. -- 我们的 RealESRGAN-AnimeVideo-v3 - -## 结果 - -您可能需要**放大**以比较详细信息, 或者**单击图像**以查看完整尺寸。 请注意下面表格的图片是从原图里裁剪patch并且resize后的结果,您可以从 -[Google Drive](https://drive.google.com/drive/folders/1bc_Hje1Nqop9NDkUvci2VACSjL7HZMRp?usp=sharing) 里下载原始的输入和输出。 - -**更自然的结果,更好的虚化背景恢复** - -| 输入 | waifu2x | Real-CUGAN | RealESRGAN
    AnimeVideo-v3 | -| :---: | :---: | :---: | :---: | -|![157083983-bec52c67-9a5e-4eed-afef-01fe6cd2af85_patch](https://user-images.githubusercontent.com/11482921/164452769-5d8cb4f8-1708-42d2-b941-f44a6f136feb.png) | ![](https://user-images.githubusercontent.com/11482921/164452767-c825cdec-f721-4ff1-aef1-fec41f146c4c.png) | ![](https://user-images.githubusercontent.com/11482921/164452755-3be50895-e3d4-432d-a7b9-9085c2a8e771.png) | ![](https://user-images.githubusercontent.com/11482921/164452771-be300656-379a-4323-a755-df8025a8c451.png) | -|![a0010_patch](https://user-images.githubusercontent.com/11482921/164454047-22eeb493-3fa9-4142-9fc2-6f2a1c074cd5.png) | ![](https://user-images.githubusercontent.com/11482921/164454046-d5e79f8f-00a0-4b55-bc39-295d0d69747a.png) | ![](https://user-images.githubusercontent.com/11482921/164454040-87886b11-9d08-48bd-862f-0d4aed72eb19.png) | ![](https://user-images.githubusercontent.com/11482921/164454055-73dc9f02-286e-4d5c-8f70-c13742e08f42.png) | -|![00000044_patch](https://user-images.githubusercontent.com/11482921/164451232-bacf64fc-e55a-44db-afbb-6b31ab0f8973.png) | ![](https://user-images.githubusercontent.com/11482921/164451318-f309b61a-75b8-4b74-b5f3-595725f1cf0b.png) | ![](https://user-images.githubusercontent.com/11482921/164451348-994f8a35-adbe-4a4b-9c61-feaa294af06a.png) | ![](https://user-images.githubusercontent.com/11482921/164451361-9b7d376e-6f75-4648-b752-542b44845d1c.png) | - -**更少瑕疵,更好的细节纹理** - -| 输入 | waifu2x | Real-CUGAN | RealESRGAN
    AnimeVideo-v3 | -| :---: | :---: | :---: | :---: | -|![00000053_patch](https://user-images.githubusercontent.com/11482921/164448411-148a7e5c-cfcd-4504-8bc7-e318eb883bb6.png) | ![](https://user-images.githubusercontent.com/11482921/164448633-dfc15224-b6d2-4403-a3c9-4bb819979364.png) | ![](https://user-images.githubusercontent.com/11482921/164448771-0d359509-5293-4d4c-8e3c-86a2a314ea88.png) | ![](https://user-images.githubusercontent.com/11482921/164448848-1a4ff99e-075b-4458-9db7-2c89e8160aa0.png) | -|![Disney_v4_22_018514_s2_patch](https://user-images.githubusercontent.com/11482921/164451898-83311cdf-bd3e-450f-b9f6-34d7fea3ab79.png) | ![](https://user-images.githubusercontent.com/11482921/164451894-6c56521c-6561-40d6-a3a5-8dde2c167b8a.png) | ![](https://user-images.githubusercontent.com/11482921/164451888-af9b47e3-39dc-4f3e-b0d7-d372d8191e2a.png) | ![](https://user-images.githubusercontent.com/11482921/164451901-31ca4dd4-9847-4baa-8cde-ad50f4053dcf.png) | -|![Japan_v2_0_007261_s2_patch](https://user-images.githubusercontent.com/11482921/164454578-73c77392-77de-49c5-b03c-c36631723192.png) | ![](https://user-images.githubusercontent.com/11482921/164454574-b1ede5f0-4520-4eaa-8f59-086751a34e62.png) | ![](https://user-images.githubusercontent.com/11482921/164454567-4cb3fdd8-6a2d-4016-85b2-a305a8ff80e4.png) | ![](https://user-images.githubusercontent.com/11482921/164454583-7f243f20-eca3-4500-ac43-eb058a4a101a.png) | -|![huluxiongdi_2_patch](https://user-images.githubusercontent.com/11482921/164453482-0726c842-337e-40ec-bf6c-f902ee956a8b.png) | ![](https://user-images.githubusercontent.com/11482921/164453480-71d5e091-5bfa-4c77-9c57-4e37f66ca0a3.png) | ![](https://user-images.githubusercontent.com/11482921/164453468-c295d3c9-3661-45f0-9ecd-406a1877f76e.png) | ![](https://user-images.githubusercontent.com/11482921/164453486-3091887c-587c-450e-b6fe-905cb518d57e.png) | - -**其他更好的结果** - -| 输入 | waifu2x | Real-CUGAN | RealESRGAN
    AnimeVideo-v3 | -| :---: | :---: | :---: | :---: | -|![Japan_v2_1_128525_s1_patch](https://user-images.githubusercontent.com/11482921/164454933-67697f7c-b6ef-47dc-bfca-822a78af8acf.png) | ![](https://user-images.githubusercontent.com/11482921/164454931-9450de7c-f0b3-4638-9c1e-0668e0c41ef0.png) | ![](https://user-images.githubusercontent.com/11482921/164454926-ed746976-786d-41c5-8a83-7693cd774c3a.png) | ![](https://user-images.githubusercontent.com/11482921/164454936-8abdf0f0-fb30-40eb-8281-3b46c0bcb9ae.png) | -|![tianshuqitan_2_patch](https://user-images.githubusercontent.com/11482921/164456948-807c1476-90b6-4507-81da-cb986d01600c.png) | ![](https://user-images.githubusercontent.com/11482921/164456943-25e89de9-d7e5-4f61-a2e1-96786af6ae9e.png) | ![](https://user-images.githubusercontent.com/11482921/164456954-b468c447-59f5-4594-9693-3683e44ba3e6.png) | ![](https://user-images.githubusercontent.com/11482921/164456957-640f910c-3b04-407c-ac20-044d72e19735.png) | -|![00000051_patch](https://user-images.githubusercontent.com/11482921/164456044-e9a6b3fa-b24e-4eb7-acf9-1f7746551b1e.png) ![00000051_patch](https://user-images.githubusercontent.com/11482921/164456421-b67245b0-767d-4250-9105-80bbe507ecfc.png) | ![](https://user-images.githubusercontent.com/11482921/164456040-85763cf2-cb28-4ba3-abb6-1dbb48c55713.png) ![](https://user-images.githubusercontent.com/11482921/164456419-59cf342e-bc1e-4044-868c-e1090abad313.png) | ![](https://user-images.githubusercontent.com/11482921/164456031-4244bb7b-8649-4e01-86f4-40c2099c5afd.png) ![](https://user-images.githubusercontent.com/11482921/164456411-b6afcbe9-c054-448d-a6df-96d3ba3047f8.png) | ![](https://user-images.githubusercontent.com/11482921/164456035-12e270be-fd52-46d4-b18a-3d3b680731fe.png) ![](https://user-images.githubusercontent.com/11482921/164456417-dcaa8b62-f497-427d-b2d2-f390f1200fb9.png) | -|![00000099_patch](https://user-images.githubusercontent.com/11482921/164455312-6411b6e1-5823-4131-a4b0-a6be8a9ae89f.png) | ![](https://user-images.githubusercontent.com/11482921/164455310-f2b99646-3a22-47a4-805b-dc451ac86ddb.png) | ![](https://user-images.githubusercontent.com/11482921/164455294-35471b42-2826-4451-b7ec-6de01344954c.png) | ![](https://user-images.githubusercontent.com/11482921/164455305-fa4c9758-564a-4081-8b4e-f11057a0404d.png) | -|![00000016_patch](https://user-images.githubusercontent.com/11482921/164455672-447353c9-2da2-4fcb-ba4a-7dd6b94c19c1.png) | ![](https://user-images.githubusercontent.com/11482921/164455669-df384631-baaa-42f8-9150-40f658471558.png) | ![](https://user-images.githubusercontent.com/11482921/164455657-68006bf0-138d-4981-aaca-8aa927d2f78a.png) | ![](https://user-images.githubusercontent.com/11482921/164455664-0342b93e-a62a-4b36-a90e-7118f3f1e45d.png) | - -## 推理速度比较 - -### PyTorch - -请注意,我们只报告了**模型推理**的时间, 而忽略了读写硬盘的时间. - -| GPU | 输入尺寸 | waifu2x | Real-CUGAN | RealESRGAN-AnimeVideo-v3 -| :---: | :---: | :---: | :---: | :---: | -| V100 | 1921 x 1080 | - | 3.4 fps | **10.0** fps | -| V100 | 1280 x 720 | - | 7.2 fps | **22.6** fps | -| V100 | 640 x 480 | - | 24.4 fps | **65.9** fps | - -### ncnn - -- [ ] TODO diff --git a/spaces/aliabid94/AutoGPT/autogpt/memory/redismem.py b/spaces/aliabid94/AutoGPT/autogpt/memory/redismem.py deleted file mode 100644 index 082a812c5362cc9f19e35bf1bb10269b558f7724..0000000000000000000000000000000000000000 --- a/spaces/aliabid94/AutoGPT/autogpt/memory/redismem.py +++ /dev/null @@ -1,156 +0,0 @@ -"""Redis memory provider.""" -from __future__ import annotations - -from typing import Any - -import numpy as np -import redis -from colorama import Fore, Style -from redis.commands.search.field import TextField, VectorField -from redis.commands.search.indexDefinition import IndexDefinition, IndexType -from redis.commands.search.query import Query - -from autogpt.llm_utils import create_embedding_with_ada -from autogpt.logs import logger -from autogpt.memory.base import MemoryProviderSingleton - -SCHEMA = [ - TextField("data"), - VectorField( - "embedding", - "HNSW", - {"TYPE": "FLOAT32", "DIM": 1536, "DISTANCE_METRIC": "COSINE"}, - ), -] - - -class RedisMemory(MemoryProviderSingleton): - def __init__(self, cfg): - """ - Initializes the Redis memory provider. - - Args: - cfg: The config object. - - Returns: None - """ - redis_host = cfg.redis_host - redis_port = cfg.redis_port - redis_password = cfg.redis_password - self.dimension = 1536 - self.redis = redis.Redis( - host=redis_host, - port=redis_port, - password=redis_password, - db=0, # Cannot be changed - ) - self.cfg = cfg - - # Check redis connection - try: - self.redis.ping() - except redis.ConnectionError as e: - logger.typewriter_log( - "FAILED TO CONNECT TO REDIS", - Fore.RED, - Style.BRIGHT + str(e) + Style.RESET_ALL, - ) - logger.double_check( - "Please ensure you have setup and configured Redis properly for use. " - + f"You can check out {Fore.CYAN + Style.BRIGHT}" - f"https://github.com/Torantulino/Auto-GPT#redis-setup{Style.RESET_ALL}" - " to ensure you've set up everything correctly." - ) - exit(1) - - if cfg.wipe_redis_on_start: - self.redis.flushall() - try: - self.redis.ft(f"{cfg.memory_index}").create_index( - fields=SCHEMA, - definition=IndexDefinition( - prefix=[f"{cfg.memory_index}:"], index_type=IndexType.HASH - ), - ) - except Exception as e: - print("Error creating Redis search index: ", e) - existing_vec_num = self.redis.get(f"{cfg.memory_index}-vec_num") - self.vec_num = int(existing_vec_num.decode("utf-8")) if existing_vec_num else 0 - - def add(self, data: str) -> str: - """ - Adds a data point to the memory. - - Args: - data: The data to add. - - Returns: Message indicating that the data has been added. - """ - if "Command Error:" in data: - return "" - vector = create_embedding_with_ada(data) - vector = np.array(vector).astype(np.float32).tobytes() - data_dict = {b"data": data, "embedding": vector} - pipe = self.redis.pipeline() - pipe.hset(f"{self.cfg.memory_index}:{self.vec_num}", mapping=data_dict) - _text = ( - f"Inserting data into memory at index: {self.vec_num}:\n" f"data: {data}" - ) - self.vec_num += 1 - pipe.set(f"{self.cfg.memory_index}-vec_num", self.vec_num) - pipe.execute() - return _text - - def get(self, data: str) -> list[Any] | None: - """ - Gets the data from the memory that is most relevant to the given data. - - Args: - data: The data to compare to. - - Returns: The most relevant data. - """ - return self.get_relevant(data, 1) - - def clear(self) -> str: - """ - Clears the redis server. - - Returns: A message indicating that the memory has been cleared. - """ - self.redis.flushall() - return "Obliviated" - - def get_relevant(self, data: str, num_relevant: int = 5) -> list[Any] | None: - """ - Returns all the data in the memory that is relevant to the given data. - Args: - data: The data to compare to. - num_relevant: The number of relevant data to return. - - Returns: A list of the most relevant data. - """ - query_embedding = create_embedding_with_ada(data) - base_query = f"*=>[KNN {num_relevant} @embedding $vector AS vector_score]" - query = ( - Query(base_query) - .return_fields("data", "vector_score") - .sort_by("vector_score") - .dialect(2) - ) - query_vector = np.array(query_embedding).astype(np.float32).tobytes() - - try: - results = self.redis.ft(f"{self.cfg.memory_index}").search( - query, query_params={"vector": query_vector} - ) - except Exception as e: - print("Error calling Redis search: ", e) - return None - return [result.data for result in results.docs] - - def get_stats(self): - """ - Returns: The stats of the memory index. - """ - return self.redis.ft(f"{self.cfg.memory_index}").info() diff --git a/spaces/allknowingroger/Image-Models-Test115/README.md b/spaces/allknowingroger/Image-Models-Test115/README.md deleted file mode 100644 index c03258a816da426ad2dc3ef0b0577e1b419d7515..0000000000000000000000000000000000000000 --- a/spaces/allknowingroger/Image-Models-Test115/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: More Image Models -emoji: 😻 -colorFrom: red -colorTo: gray -sdk: gradio -sdk_version: 3.23.0 -app_file: app.py -duplicated_from: allknowingroger/Image-Models-Test114 ---- - - \ No newline at end of file diff --git a/spaces/andryMLOPS/ASTA-GPT-3.8_web_ui/g4f/Provider/Providers/Lockchat.py b/spaces/andryMLOPS/ASTA-GPT-3.8_web_ui/g4f/Provider/Providers/Lockchat.py deleted file mode 100644 index 1bce74035403bf8615e68ccfcc9deb7e0151817a..0000000000000000000000000000000000000000 --- a/spaces/andryMLOPS/ASTA-GPT-3.8_web_ui/g4f/Provider/Providers/Lockchat.py +++ /dev/null @@ -1,32 +0,0 @@ -import requests -import os -import json -from ...typing import sha256, Dict, get_type_hints -url = 'http://supertest.lockchat.app' -model = ['gpt-4', 'gpt-3.5-turbo'] -supports_stream = True -needs_auth = False - -def _create_completion(model: str, messages: list, stream: bool, temperature: float = 0.7, **kwargs): - - payload = { - "temperature": 0.7, - "messages": messages, - "model": model, - "stream": True, - } - headers = { - "user-agent": "ChatX/39 CFNetwork/1408.0.4 Darwin/22.5.0", - } - response = requests.post("http://supertest.lockchat.app/v1/chat/completions", - json=payload, headers=headers, stream=True) - for token in response.iter_lines(): - if b'The model: `gpt-4` does not exist' in token: - print('error, retrying...') - _create_completion(model=model, messages=messages, stream=stream, temperature=temperature, **kwargs) - if b"content" in token: - token = json.loads(token.decode('utf-8').split('data: ')[1])['choices'][0]['delta'].get('content') - if token: yield (token) - -params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \ - '(%s)' % ', '.join([f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]]) \ No newline at end of file diff --git a/spaces/aodianyun/stable-diffusion-webui/modules/ui_extensions.py b/spaces/aodianyun/stable-diffusion-webui/modules/ui_extensions.py deleted file mode 100644 index 12f395cef3a6e1e0ad28d1577c0208794b897335..0000000000000000000000000000000000000000 --- a/spaces/aodianyun/stable-diffusion-webui/modules/ui_extensions.py +++ /dev/null @@ -1,354 +0,0 @@ -import json -import os.path -import shutil -import sys -import time -import traceback - -import git - -import gradio as gr -import html -import shutil -import errno - -from modules import extensions, shared, paths -from modules.call_queue import wrap_gradio_gpu_call - -available_extensions = {"extensions": []} - - -def check_access(): - assert not shared.cmd_opts.disable_extension_access, "extension access disabled because of command line flags" - - -def apply_and_restart(disable_list, update_list): - check_access() - - disabled = json.loads(disable_list) - assert type(disabled) == list, f"wrong disable_list data for apply_and_restart: {disable_list}" - - update = json.loads(update_list) - assert type(update) == list, f"wrong update_list data for apply_and_restart: {update_list}" - - update = set(update) - - for ext in extensions.extensions: - if ext.name not in update: - continue - - try: - ext.fetch_and_reset_hard() - except Exception: - print(f"Error getting updates for {ext.name}:", file=sys.stderr) - print(traceback.format_exc(), file=sys.stderr) - - shared.opts.disabled_extensions = disabled - shared.opts.save(shared.config_filename) - - shared.state.interrupt() - shared.state.need_restart = True - - -def check_updates(id_task, disable_list): - check_access() - - disabled = json.loads(disable_list) - assert type(disabled) == list, f"wrong disable_list data for apply_and_restart: {disable_list}" - - exts = [ext for ext in extensions.extensions if ext.remote is not None and ext.name not in disabled] - shared.state.job_count = len(exts) - - for ext in exts: - shared.state.textinfo = ext.name - - try: - ext.check_updates() - except Exception: - print(f"Error checking updates for {ext.name}:", file=sys.stderr) - print(traceback.format_exc(), file=sys.stderr) - - shared.state.nextjob() - - return extension_table(), "" - - -def extension_table(): - code = f""" - - - - - - - - - - - """ - - for ext in extensions.extensions: - remote = f"""{html.escape("built-in" if ext.is_builtin else ext.remote or '')}""" - - if ext.can_update: - ext_status = f"""""" - else: - ext_status = ext.status - - code += f""" - - - - - {ext_status} - - """ - - code += """ - -
    ExtensionURLVersionUpdate
    {remote}{ext.version}
    - """ - - return code - - -def normalize_git_url(url): - if url is None: - return "" - - url = url.replace(".git", "") - return url - - -def install_extension_from_url(dirname, url): - check_access() - - assert url, 'No URL specified' - - if dirname is None or dirname == "": - *parts, last_part = url.split('/') - last_part = normalize_git_url(last_part) - - dirname = last_part - - target_dir = os.path.join(extensions.extensions_dir, dirname) - assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}' - - normalized_url = normalize_git_url(url) - assert len([x for x in extensions.extensions if normalize_git_url(x.remote) == normalized_url]) == 0, 'Extension with this URL is already installed' - - tmpdir = os.path.join(paths.data_path, "tmp", dirname) - - try: - shutil.rmtree(tmpdir, True) - - repo = git.Repo.clone_from(url, tmpdir) - repo.remote().fetch() - - try: - os.rename(tmpdir, target_dir) - except OSError as err: - # TODO what does this do on windows? I think it'll be a different error code but I don't have a system to check it - # Shouldn't cause any new issues at least but we probably want to handle it there too. - if err.errno == errno.EXDEV: - # Cross device link, typical in docker or when tmp/ and extensions/ are on different file systems - # Since we can't use a rename, do the slower but more versitile shutil.move() - shutil.move(tmpdir, target_dir) - else: - # Something else, not enough free space, permissions, etc. rethrow it so that it gets handled. - raise(err) - - import launch - launch.run_extension_installer(target_dir) - - extensions.list_extensions() - return [extension_table(), html.escape(f"Installed into {target_dir}. Use Installed tab to restart.")] - finally: - shutil.rmtree(tmpdir, True) - - -def install_extension_from_index(url, hide_tags, sort_column): - ext_table, message = install_extension_from_url(None, url) - - code, _ = refresh_available_extensions_from_data(hide_tags, sort_column) - - return code, ext_table, message - - -def refresh_available_extensions(url, hide_tags, sort_column): - global available_extensions - - import urllib.request - with urllib.request.urlopen(url) as response: - text = response.read() - - available_extensions = json.loads(text) - - code, tags = refresh_available_extensions_from_data(hide_tags, sort_column) - - return url, code, gr.CheckboxGroup.update(choices=tags), '' - - -def refresh_available_extensions_for_tags(hide_tags, sort_column): - code, _ = refresh_available_extensions_from_data(hide_tags, sort_column) - - return code, '' - - -sort_ordering = [ - # (reverse, order_by_function) - (True, lambda x: x.get('added', 'z')), - (False, lambda x: x.get('added', 'z')), - (False, lambda x: x.get('name', 'z')), - (True, lambda x: x.get('name', 'z')), - (False, lambda x: 'z'), -] - - -def refresh_available_extensions_from_data(hide_tags, sort_column): - extlist = available_extensions["extensions"] - installed_extension_urls = {normalize_git_url(extension.remote): extension.name for extension in extensions.extensions} - - tags = available_extensions.get("tags", {}) - tags_to_hide = set(hide_tags) - hidden = 0 - - code = f""" - - - - - - - - - - """ - - sort_reverse, sort_function = sort_ordering[sort_column if 0 <= sort_column < len(sort_ordering) else 0] - - for ext in sorted(extlist, key=sort_function, reverse=sort_reverse): - name = ext.get("name", "noname") - added = ext.get('added', 'unknown') - url = ext.get("url", None) - description = ext.get("description", "") - extension_tags = ext.get("tags", []) - - if url is None: - continue - - existing = installed_extension_urls.get(normalize_git_url(url), None) - extension_tags = extension_tags + ["installed"] if existing else extension_tags - - if len([x for x in extension_tags if x in tags_to_hide]) > 0: - hidden += 1 - continue - - install_code = f"""""" - - tags_text = ", ".join([f"{x}" for x in extension_tags]) - - code += f""" - - - - - - - """ - - for tag in [x for x in extension_tags if x not in tags]: - tags[tag] = tag - - code += """ - -
    ExtensionDescriptionAction
    {html.escape(name)}
    {tags_text}
    {html.escape(description)}

    Added: {html.escape(added)}

    {install_code}
    - """ - - if hidden > 0: - code += f"

    Extension hidden: {hidden}

    " - - return code, list(tags) - - -def create_ui(): - import modules.ui - - with gr.Blocks(analytics_enabled=False) as ui: - with gr.Tabs(elem_id="tabs_extensions") as tabs: - with gr.TabItem("Installed"): - - with gr.Row(elem_id="extensions_installed_top"): - apply = gr.Button(value="Apply and restart UI", variant="primary") - check = gr.Button(value="Check for updates") - extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False) - extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False) - - info = gr.HTML() - extensions_table = gr.HTML(lambda: extension_table()) - - apply.click( - fn=apply_and_restart, - _js="extensions_apply", - inputs=[extensions_disabled_list, extensions_update_list], - outputs=[], - ) - - check.click( - fn=wrap_gradio_gpu_call(check_updates, extra_outputs=[gr.update()]), - _js="extensions_check", - inputs=[info, extensions_disabled_list], - outputs=[extensions_table, info], - ) - - with gr.TabItem("Available"): - with gr.Row(): - refresh_available_extensions_button = gr.Button(value="Load from:", variant="primary") - available_extensions_index = gr.Text(value="https://raw.githubusercontent.com/wiki/AUTOMATIC1111/stable-diffusion-webui/Extensions-index.md", label="Extension index URL").style(container=False) - extension_to_install = gr.Text(elem_id="extension_to_install", visible=False) - install_extension_button = gr.Button(elem_id="install_extension_button", visible=False) - - with gr.Row(): - hide_tags = gr.CheckboxGroup(value=["ads", "localization", "installed"], label="Hide extensions with tags", choices=["script", "ads", "localization", "installed"]) - sort_column = gr.Radio(value="newest first", label="Order", choices=["newest first", "oldest first", "a-z", "z-a", "internal order", ], type="index") - - install_result = gr.HTML() - available_extensions_table = gr.HTML() - - refresh_available_extensions_button.click( - fn=modules.ui.wrap_gradio_call(refresh_available_extensions, extra_outputs=[gr.update(), gr.update(), gr.update()]), - inputs=[available_extensions_index, hide_tags, sort_column], - outputs=[available_extensions_index, available_extensions_table, hide_tags, install_result], - ) - - install_extension_button.click( - fn=modules.ui.wrap_gradio_call(install_extension_from_index, extra_outputs=[gr.update(), gr.update()]), - inputs=[extension_to_install, hide_tags, sort_column], - outputs=[available_extensions_table, extensions_table, install_result], - ) - - hide_tags.change( - fn=modules.ui.wrap_gradio_call(refresh_available_extensions_for_tags, extra_outputs=[gr.update()]), - inputs=[hide_tags, sort_column], - outputs=[available_extensions_table, install_result] - ) - - sort_column.change( - fn=modules.ui.wrap_gradio_call(refresh_available_extensions_for_tags, extra_outputs=[gr.update()]), - inputs=[hide_tags, sort_column], - outputs=[available_extensions_table, install_result] - ) - - with gr.TabItem("Install from URL"): - install_url = gr.Text(label="URL for extension's git repository") - install_dirname = gr.Text(label="Local directory name", placeholder="Leave empty for auto") - install_button = gr.Button(value="Install", variant="primary") - install_result = gr.HTML(elem_id="extension_install_result") - - install_button.click( - fn=modules.ui.wrap_gradio_call(install_extension_from_url, extra_outputs=[gr.update()]), - inputs=[install_dirname, install_url], - outputs=[extensions_table, install_result], - ) - - return ui diff --git a/spaces/artificialguybr/video-dubbing/TTS/tests/inference_tests/test_synthesizer.py b/spaces/artificialguybr/video-dubbing/TTS/tests/inference_tests/test_synthesizer.py deleted file mode 100644 index 40e830178c20493f5b1a6c670a9aeb1d2ce8992f..0000000000000000000000000000000000000000 --- a/spaces/artificialguybr/video-dubbing/TTS/tests/inference_tests/test_synthesizer.py +++ /dev/null @@ -1,78 +0,0 @@ -import os -import unittest - -from tests import get_tests_input_path -from TTS.config import load_config -from TTS.tts.models import setup_model -from TTS.utils.io import save_checkpoint -from TTS.utils.synthesizer import Synthesizer - - -class SynthesizerTest(unittest.TestCase): - # pylint: disable=R0201 - def _create_random_model(self): - # pylint: disable=global-statement - config = load_config(os.path.join(get_tests_input_path(), "dummy_model_config.json")) - model = setup_model(config) - output_path = os.path.join(get_tests_input_path()) - save_checkpoint(config, model, None, None, 10, 1, output_path) - - def test_in_out(self): - self._create_random_model() - tts_root_path = get_tests_input_path() - tts_checkpoint = os.path.join(tts_root_path, "checkpoint_10.pth") - tts_config = os.path.join(tts_root_path, "dummy_model_config.json") - synthesizer = Synthesizer(tts_checkpoint, tts_config, None, None) - synthesizer.tts("Better this test works!!") - - def test_split_into_sentences(self): - """Check demo server sentences split as expected""" - print("\n > Testing demo server sentence splitting") - # pylint: disable=attribute-defined-outside-init, protected-access - self.seg = Synthesizer._get_segmenter("en") - sis = Synthesizer.split_into_sentences - assert sis(self, "Hello. Two sentences") == ["Hello.", "Two sentences"] - assert sis(self, "He went to meet the adviser from Scott, Waltman & Co. next morning.") == [ - "He went to meet the adviser from Scott, Waltman & Co. next morning." - ] - assert sis(self, "Let's run it past Sarah and co. They'll want to see this.") == [ - "Let's run it past Sarah and co.", - "They'll want to see this.", - ] - assert sis(self, "Where is Bobby Jr.'s rabbit?") == ["Where is Bobby Jr.'s rabbit?"] - assert sis(self, "Please inform the U.K. authorities right away.") == [ - "Please inform the U.K. authorities right away." - ] - assert sis(self, "Were David and co. at the event?") == ["Were David and co. at the event?"] - assert sis(self, "paging dr. green, please come to theatre four immediately.") == [ - "paging dr. green, please come to theatre four immediately." - ] - assert sis(self, "The email format is Firstname.Lastname@example.com. I think you reversed them.") == [ - "The email format is Firstname.Lastname@example.com.", - "I think you reversed them.", - ] - assert sis( - self, - "The demo site is: https://top100.example.com/subsection/latestnews.html. Please send us your feedback.", - ) == [ - "The demo site is: https://top100.example.com/subsection/latestnews.html.", - "Please send us your feedback.", - ] - assert sis(self, "Scowling at him, 'You are not done yet!' she yelled.") == [ - "Scowling at him, 'You are not done yet!' she yelled." - ] # with the final lowercase "she" we see it's all one sentence - assert sis(self, "Hey!! So good to see you.") == ["Hey!!", "So good to see you."] - assert sis(self, "He went to Yahoo! but I don't know the division.") == [ - "He went to Yahoo! but I don't know the division." - ] - assert sis(self, "If you can't remember a quote, “at least make up a memorable one that's plausible...\"") == [ - "If you can't remember a quote, “at least make up a memorable one that's plausible...\"" - ] - assert sis(self, "The address is not google.com.") == ["The address is not google.com."] - assert sis(self, "1.) The first item 2.) The second item") == ["1.) The first item", "2.) The second item"] - assert sis(self, "1) The first item 2) The second item") == ["1) The first item", "2) The second item"] - assert sis(self, "a. The first item b. The second item c. The third list item") == [ - "a. The first item", - "b. The second item", - "c. The third list item", - ] diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Crypto/Protocol/__init__.py b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Crypto/Protocol/__init__.py deleted file mode 100644 index efdf034f76d91b9e3c79415c54212cb9a9e7835f..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Crypto/Protocol/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# =================================================================== -# -# Copyright (c) 2014, Legrandin -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. 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. -# -# 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. -# =================================================================== - -__all__ = ['KDF', 'SecretSharing'] diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Crypto/SelfTest/Cipher/test_DES3.py b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Crypto/SelfTest/Cipher/test_DES3.py deleted file mode 100644 index 8d6a648510606c70116a5e88099db4939a6542c6..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Crypto/SelfTest/Cipher/test_DES3.py +++ /dev/null @@ -1,195 +0,0 @@ -# -*- coding: utf-8 -*- -# -# SelfTest/Cipher/DES3.py: Self-test for the Triple-DES cipher -# -# Written in 2008 by Dwayne C. Litzenberger -# -# =================================================================== -# The contents of this file are dedicated to the public domain. To -# the extent that dedication to the public domain is not available, -# everyone is granted a worldwide, perpetual, royalty-free, -# non-exclusive license to exercise all rights associated with the -# contents of this file for any purpose whatsoever. -# No rights are reserved. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# =================================================================== - -"""Self-test suite for Crypto.Cipher.DES3""" - -import unittest -from binascii import hexlify, unhexlify - -from Crypto.Cipher import DES3 - -from Crypto.Util.strxor import strxor_c -from Crypto.Util.py3compat import bchr, tostr -from Crypto.SelfTest.loader import load_test_vectors -from Crypto.SelfTest.st_common import list_test_cases - -# This is a list of (plaintext, ciphertext, key, description) tuples. -test_data = [ - # Test vector from Appendix B of NIST SP 800-67 - # "Recommendation for the Triple Data Encryption Algorithm (TDEA) Block - # Cipher" - # http://csrc.nist.gov/publications/nistpubs/800-67/SP800-67.pdf - ('54686520717566636b2062726f776e20666f78206a756d70', - 'a826fd8ce53b855fcce21c8112256fe668d5c05dd9b6b900', - '0123456789abcdef23456789abcdef01456789abcdef0123', - 'NIST SP800-67 B.1'), - - # This test is designed to test the DES3 API, not the correctness of the - # output. - ('21e81b7ade88a259', '5c577d4d9b20c0f8', - '9b397ebf81b1181e282f4bb8adbadc6b', 'Two-key 3DES'), -] - -# NIST CAVP test vectors - -nist_tdes_mmt_files = ("TECBMMT2.rsp", "TECBMMT3.rsp") - -for tdes_file in nist_tdes_mmt_files: - - test_vectors = load_test_vectors( - ("Cipher", "TDES"), - tdes_file, - "TDES ECB (%s)" % tdes_file, - {"count": lambda x: int(x)}) or [] - - for index, tv in enumerate(test_vectors): - - # The test vector file contains some directive lines - if isinstance(tv, str): - continue - - key = tv.key1 + tv.key2 + tv.key3 - test_data_item = (tostr(hexlify(tv.plaintext)), - tostr(hexlify(tv.ciphertext)), - tostr(hexlify(key)), - "%s (%s)" % (tdes_file, index)) - test_data.append(test_data_item) - - -class CheckParity(unittest.TestCase): - - def test_parity_option2(self): - before_2k = unhexlify("CABF326FA56734324FFCCABCDEFACABF") - after_2k = DES3.adjust_key_parity(before_2k) - self.assertEqual(after_2k, - unhexlify("CBBF326EA46734324FFDCBBCDFFBCBBF")) - - def test_parity_option3(self): - before_3k = unhexlify("AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCC") - after_3k = DES3.adjust_key_parity(before_3k) - self.assertEqual(after_3k, - unhexlify("ABABABABABABABABBABABABABABABABACDCDCDCDCDCDCDCD")) - - def test_degradation(self): - sub_key1 = bchr(1) * 8 - sub_key2 = bchr(255) * 8 - - # K1 == K2 - self.assertRaises(ValueError, DES3.adjust_key_parity, - sub_key1 * 2 + sub_key2) - - # K2 == K3 - self.assertRaises(ValueError, DES3.adjust_key_parity, - sub_key1 + sub_key2 * 2) - - # K1 == K2 == K3 - self.assertRaises(ValueError, DES3.adjust_key_parity, - sub_key1 * 3) - - # K1 == K2 (with different parity) - self.assertRaises(ValueError, DES3.adjust_key_parity, - sub_key1 + strxor_c(sub_key1, 1) + sub_key2) - - -class DegenerateToDESTest(unittest.TestCase): - - def runTest(self): - sub_key1 = bchr(1) * 8 - sub_key2 = bchr(255) * 8 - - # K1 == K2 - self.assertRaises(ValueError, DES3.new, - sub_key1 * 2 + sub_key2, - DES3.MODE_ECB) - - # K2 == K3 - self.assertRaises(ValueError, DES3.new, - sub_key1 + sub_key2 * 2, - DES3.MODE_ECB) - - # K1 == K2 == K3 - self.assertRaises(ValueError, DES3.new, - sub_key1 * 3, - DES3.MODE_ECB) - - # K2 == K3 (parity is ignored) - self.assertRaises(ValueError, DES3.new, - sub_key1 + sub_key2 + strxor_c(sub_key2, 0x1), - DES3.MODE_ECB) - - -class TestOutput(unittest.TestCase): - - def runTest(self): - # Encrypt/Decrypt data and test output parameter - - cipher = DES3.new(b'4'*8 + b'G'*8 + b'T'*8, DES3.MODE_ECB) - - pt = b'5' * 16 - ct = cipher.encrypt(pt) - - output = bytearray(16) - res = cipher.encrypt(pt, output=output) - self.assertEqual(ct, output) - self.assertEqual(res, None) - - res = cipher.decrypt(ct, output=output) - self.assertEqual(pt, output) - self.assertEqual(res, None) - - output = memoryview(bytearray(16)) - cipher.encrypt(pt, output=output) - self.assertEqual(ct, output) - - cipher.decrypt(ct, output=output) - self.assertEqual(pt, output) - - self.assertRaises(TypeError, cipher.encrypt, pt, output=b'0'*16) - self.assertRaises(TypeError, cipher.decrypt, ct, output=b'0'*16) - - shorter_output = bytearray(7) - self.assertRaises(ValueError, cipher.encrypt, pt, output=shorter_output) - self.assertRaises(ValueError, cipher.decrypt, ct, output=shorter_output) - - -def get_tests(config={}): - from .common import make_block_tests - - tests = [] - tests = make_block_tests(DES3, "DES3", test_data) - tests.append(DegenerateToDESTest()) - tests += list_test_cases(CheckParity) - tests += [TestOutput()] - return tests - - -if __name__ == '__main__': - import unittest - - def suite(): - unittest.TestSuite(get_tests()) - - unittest.main(defaultTest='suite') - -# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Cython/Compiler/__init__.py b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Cython/Compiler/__init__.py deleted file mode 100644 index fa81adaff68e06d8e915a6afa375f62f7e5a8fad..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/Cython/Compiler/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# empty file diff --git a/spaces/avans06/whisper-webui-translate/src/segments.py b/spaces/avans06/whisper-webui-translate/src/segments.py deleted file mode 100644 index ec2650dceade5d0b2022264f6419115eab085aea..0000000000000000000000000000000000000000 --- a/spaces/avans06/whisper-webui-translate/src/segments.py +++ /dev/null @@ -1,55 +0,0 @@ -from typing import Any, Dict, List - -import copy - -def merge_timestamps(timestamps: List[Dict[str, Any]], merge_window: float = 5, max_merge_size: float = 30, padding_left: float = 1, padding_right: float = 1): - result = [] - - if len(timestamps) == 0: - return result - if max_merge_size is None: - return timestamps - - if padding_left is None: - padding_left = 0 - if padding_right is None: - padding_right = 0 - - processed_time = 0 - current_segment = None - - for i in range(len(timestamps)): - next_segment = timestamps[i] - - delta = next_segment['start'] - processed_time - - # Note that segments can still be longer than the max merge size, they just won't be merged in that case - if current_segment is None or (merge_window is not None and delta > merge_window) \ - or next_segment['end'] - current_segment['start'] > max_merge_size: - # Finish the current segment - if current_segment is not None: - # Add right padding - finish_padding = min(padding_right, delta / 2) if delta < padding_left + padding_right else padding_right - current_segment['end'] += finish_padding - delta -= finish_padding - - result.append(current_segment) - - # Start a new segment - current_segment = copy.deepcopy(next_segment) - - # Pad the segment - current_segment['start'] = current_segment['start'] - min(padding_left, delta) - processed_time = current_segment['end'] - - else: - # Merge the segment - current_segment['end'] = next_segment['end'] - processed_time = current_segment['end'] - - # Add the last segment - if current_segment is not None: - current_segment['end'] += padding_right - result.append(current_segment) - - return result \ No newline at end of file diff --git a/spaces/awacke1/HTML5-BabylonJS-Javascript-3DAnimation/backup2.html b/spaces/awacke1/HTML5-BabylonJS-Javascript-3DAnimation/backup2.html deleted file mode 100644 index 5125daa465b07cf2a29ab3a70befe8769c2d4011..0000000000000000000000000000000000000000 --- a/spaces/awacke1/HTML5-BabylonJS-Javascript-3DAnimation/backup2.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Babylon.js Game Example - - - - - - - - - diff --git a/spaces/badayvedat/LLaVA/llava/model/language_model/mpt/modeling_mpt.py b/spaces/badayvedat/LLaVA/llava/model/language_model/mpt/modeling_mpt.py deleted file mode 100644 index 13313441b13fc7a66cb65fd21b482a5de982e2c8..0000000000000000000000000000000000000000 --- a/spaces/badayvedat/LLaVA/llava/model/language_model/mpt/modeling_mpt.py +++ /dev/null @@ -1,331 +0,0 @@ -"""A simple, flexible implementation of a GPT model. - -Inspired by https://github.com/karpathy/minGPT/blob/master/mingpt/model.py -""" -import math -import warnings -from typing import List, Optional, Tuple, Union -import torch -import torch.nn as nn -import torch.nn.functional as F -from transformers import PreTrainedModel, PreTrainedTokenizer, PreTrainedTokenizerFast -from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast -from .attention import attn_bias_shape, build_attn_bias -from .blocks import MPTBlock -from .custom_embedding import SharedEmbedding -from .norm import NORM_CLASS_REGISTRY -from .configuration_mpt import MPTConfig -from .adapt_tokenizer import AutoTokenizerForMOD, adapt_tokenizer_for_denoising -from .hf_prefixlm_converter import add_bidirectional_mask_if_missing, convert_hf_causal_lm_to_prefix_lm -from .meta_init_context import init_empty_weights -from .param_init_fns import MODEL_INIT_REGISTRY, generic_param_init_fn_ -try: - from .flash_attn_triton import flash_attn_func -except: - pass -Tokenizer = Union[PreTrainedTokenizer, PreTrainedTokenizerFast] - -class MPTPreTrainedModel(PreTrainedModel): - config_class = MPTConfig - base_model_prefix = 'model' - _no_split_modules = ['MPTBlock'] - -class MPTModel(MPTPreTrainedModel): - - def __init__(self, config: MPTConfig): - config._validate_config() - super().__init__(config) - self.attn_impl = config.attn_config['attn_impl'] - self.prefix_lm = config.attn_config['prefix_lm'] - self.attn_uses_sequence_id = config.attn_config['attn_uses_sequence_id'] - self.alibi = config.attn_config['alibi'] - self.alibi_bias_max = config.attn_config['alibi_bias_max'] - if config.init_device == 'mixed': - if dist.get_local_rank() == 0: - config.init_device = 'cpu' - else: - config.init_device = 'meta' - if config.norm_type.lower() not in NORM_CLASS_REGISTRY.keys(): - norm_options = ' | '.join(NORM_CLASS_REGISTRY.keys()) - raise NotImplementedError(f'Requested norm type ({config.norm_type}) is not implemented within this repo (Options: {norm_options}).') - norm_class = NORM_CLASS_REGISTRY[config.norm_type.lower()] - self.embedding_fraction = config.embedding_fraction - self.wte = SharedEmbedding(config.vocab_size, config.d_model, device=config.init_device) - if not self.alibi: - self.wpe = torch.nn.Embedding(config.max_seq_len, config.d_model, device=config.init_device) - self.emb_drop = nn.Dropout(config.emb_pdrop) - self.blocks = nn.ModuleList([MPTBlock(device=config.init_device, **config.to_dict()) for _ in range(config.n_layers)]) - self.norm_f = norm_class(config.d_model, device=config.init_device) - if config.init_device != 'meta': - print(f'You are using config.init_device={config.init_device!r}, but you can also use config.init_device="meta" with Composer + FSDP for fast initialization.') - self.apply(self.param_init_fn) - self.is_causal = not self.prefix_lm - self._attn_bias_initialized = False - self.attn_bias = None - self.attn_bias_shape = attn_bias_shape(self.attn_impl, config.n_heads, config.max_seq_len, self.alibi, prefix_lm=self.prefix_lm, causal=self.is_causal, use_sequence_id=self.attn_uses_sequence_id) - if config.no_bias: - for module in self.modules(): - if hasattr(module, 'bias') and isinstance(module.bias, nn.Parameter): - if config.verbose: - warnings.warn(f'Removing bias ({module.bias}) from {module}.') - module.register_parameter('bias', None) - if config.verbose and config.verbose > 2: - print(self) - if 'verbose' not in self.config.init_config: - self.config.init_config['verbose'] = self.config.verbose - if self.config.init_config['verbose'] > 1: - init_fn_name = self.config.init_config['name'] - warnings.warn(f'Using {init_fn_name} initialization.') - self.gradient_checkpointing = False - - def get_input_embeddings(self): - return self.wte - - def set_input_embeddings(self, value): - self.wte = value - - @torch.no_grad() - def _attn_bias(self, device, dtype, attention_mask: Optional[torch.ByteTensor]=None, prefix_mask: Optional[torch.ByteTensor]=None, sequence_id: Optional[torch.LongTensor]=None): - if not self._attn_bias_initialized: - if self.attn_bias_shape: - self.attn_bias = torch.zeros(self.attn_bias_shape, device=device, dtype=dtype) - self.attn_bias = build_attn_bias(self.attn_impl, self.attn_bias, self.config.n_heads, self.config.max_seq_len, causal=self.is_causal, alibi=self.alibi, alibi_bias_max=self.alibi_bias_max) - self._attn_bias_initialized = True - if self.attn_impl == 'flash': - return (self.attn_bias, attention_mask) - if self.attn_bias is not None: - self.attn_bias = self.attn_bias.to(dtype=dtype, device=device) - attn_bias = self.attn_bias - if self.prefix_lm: - assert isinstance(attn_bias, torch.Tensor) - assert isinstance(prefix_mask, torch.Tensor) - attn_bias = self._apply_prefix_mask(attn_bias, prefix_mask) - if self.attn_uses_sequence_id and sequence_id is not None: - assert isinstance(attn_bias, torch.Tensor) - attn_bias = self._apply_sequence_id(attn_bias, sequence_id) - if attention_mask is not None: - s_k = attention_mask.shape[-1] - if attn_bias is None: - attn_bias = torch.zeros((1, 1, 1, s_k), device=device, dtype=dtype) - else: - _s_k = max(0, attn_bias.size(-1) - s_k) - attn_bias = attn_bias[:, :, :, _s_k:] - if prefix_mask is not None and attention_mask.shape != prefix_mask.shape: - raise ValueError(f'attention_mask shape={attention_mask.shape} ' + f'and prefix_mask shape={prefix_mask.shape} are not equal.') - min_val = torch.finfo(attn_bias.dtype).min - attn_bias = attn_bias.masked_fill(~attention_mask.view(-1, 1, 1, s_k), min_val) - return (attn_bias, None) - - def _apply_prefix_mask(self, attn_bias: torch.Tensor, prefix_mask: torch.Tensor): - (s_k, s_q) = attn_bias.shape[-2:] - if s_k != self.config.max_seq_len or s_q != self.config.max_seq_len: - raise ValueError('attn_bias does not match the expected shape. ' + f'The last two dimensions should both be {self.config.max_length} ' + f'but are {s_k} and {s_q}.') - seq_len = prefix_mask.shape[-1] - if seq_len > self.config.max_seq_len: - raise ValueError(f'prefix_mask sequence length cannot exceed max_seq_len={self.config.max_seq_len}') - attn_bias = attn_bias[..., :seq_len, :seq_len] - causal = torch.tril(torch.ones((seq_len, seq_len), dtype=torch.bool, device=prefix_mask.device)).view(1, 1, seq_len, seq_len) - prefix = prefix_mask.view(-1, 1, 1, seq_len) - cannot_attend = ~torch.logical_or(causal, prefix.bool()) - min_val = torch.finfo(attn_bias.dtype).min - attn_bias = attn_bias.masked_fill(cannot_attend, min_val) - return attn_bias - - def _apply_sequence_id(self, attn_bias: torch.Tensor, sequence_id: torch.LongTensor): - seq_len = sequence_id.shape[-1] - if seq_len > self.config.max_seq_len: - raise ValueError(f'sequence_id sequence length cannot exceed max_seq_len={self.config.max_seq_len}') - attn_bias = attn_bias[..., :seq_len, :seq_len] - cannot_attend = torch.logical_not(torch.eq(sequence_id.view(-1, seq_len, 1), sequence_id.view(-1, 1, seq_len))).unsqueeze(1) - min_val = torch.finfo(attn_bias.dtype).min - attn_bias = attn_bias.masked_fill(cannot_attend, min_val) - return attn_bias - - def forward(self, input_ids: torch.LongTensor, past_key_values: Optional[List[Tuple[torch.FloatTensor]]]=None, attention_mask: Optional[torch.ByteTensor]=None, prefix_mask: Optional[torch.ByteTensor]=None, sequence_id: Optional[torch.LongTensor]=None, return_dict: Optional[bool]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, use_cache: Optional[bool]=None, inputs_embeds: Optional[torch.Tensor]=None): - return_dict = return_dict if return_dict is not None else self.config.return_dict - use_cache = use_cache if use_cache is not None else self.config.use_cache - if attention_mask is not None: - attention_mask = attention_mask.bool() - if prefix_mask is not None: - prefix_mask = prefix_mask.bool() - if not return_dict: - raise NotImplementedError('return_dict False is not implemented yet for MPT') - if output_attentions: - if self.attn_impl != 'torch': - raise NotImplementedError('output_attentions is not implemented for MPT when using attn_impl `flash` or `triton`.') - if attention_mask is not None and attention_mask[:, 0].sum() != attention_mask.shape[0] and self.training: - raise NotImplementedError('MPT does not support training with left padding.') - if self.prefix_lm and prefix_mask is None: - raise ValueError('prefix_mask is a required argument when MPT is configured with prefix_lm=True.') - if self.training: - if self.attn_uses_sequence_id and sequence_id is None: - raise ValueError('sequence_id is a required argument when MPT is configured with attn_uses_sequence_id=True ' + 'and the model is in train mode.') - elif self.attn_uses_sequence_id is False and sequence_id is not None: - warnings.warn('MPT received non-None input for `sequence_id` but is configured with attn_uses_sequence_id=False. ' + 'This input will be ignored. If you want the model to use `sequence_id`, set attn_uses_sequence_id to True.') - if input_ids is not None: - S = input_ids.size(1) - assert S <= self.config.max_seq_len, f'Cannot forward input with seq_len={S}, this model only supports seq_len<={self.config.max_seq_len}' - tok_emb = self.wte(input_ids) - else: - assert inputs_embeds is not None - assert self.alibi, 'inputs_embeds is not implemented for MPT unless for alibi.' - S = inputs_embeds.size(1) - tok_emb = inputs_embeds - if self.alibi: - x = tok_emb - else: - past_position = 0 - if past_key_values is not None: - if len(past_key_values) != self.config.n_layers: - raise ValueError(f'past_key_values must provide a past_key_value for each attention ' + f'layer in the network (len(past_key_values)={len(past_key_values)!r}; self.config.n_layers={self.config.n_layers!r}).') - past_position = past_key_values[0][0].size(1) - if self.attn_impl == 'torch': - past_position = past_key_values[0][0].size(3) - if S + past_position > self.config.max_seq_len: - raise ValueError(f'Cannot forward input with past sequence length {past_position} and current sequence length {S + 1}, this model only supports total sequence length <= {self.config.max_seq_len}.') - pos = torch.arange(past_position, S + past_position, dtype=torch.long, device=input_ids.device).unsqueeze(0) - if attention_mask is not None: - pos = torch.clamp(pos - torch.cumsum((~attention_mask).to(torch.int32), dim=1)[:, past_position:], min=0) - pos_emb = self.wpe(pos) - x = tok_emb + pos_emb - if self.embedding_fraction == 1: - x = self.emb_drop(x) - else: - x_shrunk = x * self.embedding_fraction + x.detach() * (1 - self.embedding_fraction) - assert isinstance(self.emb_drop, nn.Module) - x = self.emb_drop(x_shrunk) - (attn_bias, attention_mask) = self._attn_bias(device=x.device, dtype=torch.float32, attention_mask=attention_mask, prefix_mask=prefix_mask, sequence_id=sequence_id) - if use_cache and past_key_values is None: - past_key_values = [() for _ in range(self.config.n_layers)] - all_hidden_states = () if output_hidden_states else None - all_self_attns = () if output_attentions else None - for (b_idx, block) in enumerate(self.blocks): - if output_hidden_states: - assert all_hidden_states is not None - all_hidden_states = all_hidden_states + (x,) - past_key_value = past_key_values[b_idx] if past_key_values is not None else None - if self.gradient_checkpointing and self.training: - (x, attn_weights, past_key_value) = torch.utils.checkpoint.checkpoint(block, x, past_key_value, attn_bias, attention_mask, self.is_causal) - else: - (x, attn_weights, past_key_value) = block(x, past_key_value=past_key_value, attn_bias=attn_bias, attention_mask=attention_mask, is_causal=self.is_causal) - if past_key_values is not None: - past_key_values[b_idx] = past_key_value - if output_attentions: - assert all_self_attns is not None - all_self_attns = all_self_attns + (attn_weights,) - x = self.norm_f(x) - if output_hidden_states: - assert all_hidden_states is not None - all_hidden_states = all_hidden_states + (x,) - return BaseModelOutputWithPast(last_hidden_state=x, past_key_values=past_key_values, hidden_states=all_hidden_states, attentions=all_self_attns) - - def param_init_fn(self, module): - init_fn_name = self.config.init_config['name'] - MODEL_INIT_REGISTRY[init_fn_name](module=module, n_layers=self.config.n_layers, d_model=self.config.d_model, **self.config.init_config) - - def fsdp_wrap_fn(self, module): - return isinstance(module, MPTBlock) - - def activation_checkpointing_fn(self, module): - return isinstance(module, MPTBlock) - -class MPTForCausalLM(MPTPreTrainedModel): - - def __init__(self, config: MPTConfig): - super().__init__(config) - if not config.tie_word_embeddings: - raise ValueError('MPTForCausalLM only supports tied word embeddings') - print(f'Instantiating an MPTForCausalLM model from {__file__}') - self.transformer = MPTModel(config) - for child in self.transformer.children(): - if isinstance(child, torch.nn.ModuleList): - continue - if isinstance(child, torch.nn.Module): - child._fsdp_wrap = True - self.logit_scale = None - if config.logit_scale is not None: - logit_scale = config.logit_scale - if isinstance(logit_scale, str): - if logit_scale == 'inv_sqrt_d_model': - logit_scale = 1 / math.sqrt(config.d_model) - else: - raise ValueError(f"logit_scale={logit_scale!r} is not recognized as an option; use numeric value or 'inv_sqrt_d_model'.") - self.logit_scale = logit_scale - - def get_input_embeddings(self): - return self.transformer.wte - - def set_input_embeddings(self, value): - self.transformer.wte = value - - def get_output_embeddings(self): - return self.transformer.wte - - def set_output_embeddings(self, new_embeddings): - self.transformer.wte = new_embeddings - - def set_decoder(self, decoder): - self.transformer = decoder - - def get_decoder(self): - return self.transformer - - def forward(self, input_ids: torch.LongTensor, past_key_values: Optional[List[Tuple[torch.FloatTensor]]]=None, attention_mask: Optional[torch.ByteTensor]=None, prefix_mask: Optional[torch.ByteTensor]=None, sequence_id: Optional[torch.LongTensor]=None, labels: Optional[torch.LongTensor]=None, return_dict: Optional[bool]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, use_cache: Optional[bool]=None, inputs_embeds: Optional[torch.FloatTensor]=None): - return_dict = return_dict if return_dict is not None else self.config.return_dict - use_cache = use_cache if use_cache is not None else self.config.use_cache - if inputs_embeds is not None: - raise NotImplementedError('inputs_embeds has to be None (for hf/peft support).') - outputs = self.transformer(input_ids=input_ids, past_key_values=past_key_values, attention_mask=attention_mask, prefix_mask=prefix_mask, sequence_id=sequence_id, return_dict=return_dict, output_attentions=output_attentions, output_hidden_states=output_hidden_states, use_cache=use_cache) - logits = self.transformer.wte(outputs.last_hidden_state.to(self.transformer.wte.weight.device), True) - if self.logit_scale is not None: - if self.logit_scale == 0: - warnings.warn(f'Multiplying logits by self.logit_scale={self.logit_scale!r}. This will produce uniform (uninformative) outputs.') - logits *= self.logit_scale - loss = None - if labels is not None: - labels = torch.roll(labels, shifts=-1) - labels[:, -1] = -100 - loss = F.cross_entropy(logits.view(-1, logits.size(-1)), labels.to(logits.device).view(-1)) - return CausalLMOutputWithPast(loss=loss, logits=logits, past_key_values=outputs.past_key_values, hidden_states=outputs.hidden_states, attentions=outputs.attentions) - - def param_init_fn(self, module): - init_fn_name = self.config.init_config['name'] - MODEL_INIT_REGISTRY[init_fn_name](module=module, n_layers=self.config.n_layers, d_model=self.config.d_model, **self.config.init_config) - - def fsdp_wrap_fn(self, module): - return isinstance(module, MPTBlock) - - def activation_checkpointing_fn(self, module): - return isinstance(module, MPTBlock) - - def prepare_inputs_for_generation(self, input_ids, past_key_values=None, inputs_embeds=None, **kwargs): - if inputs_embeds is not None: - raise NotImplementedError('inputs_embeds is not implemented for MPT yet') - attention_mask = kwargs['attention_mask'].bool() - if attention_mask[:, -1].sum() != attention_mask.shape[0]: - raise NotImplementedError('MPT does not support generation with right padding.') - if self.transformer.attn_uses_sequence_id and self.training: - sequence_id = torch.zeros_like(input_ids[:1]) - else: - sequence_id = None - if past_key_values is not None: - input_ids = input_ids[:, -1].unsqueeze(-1) - if self.transformer.prefix_lm: - prefix_mask = torch.ones_like(attention_mask) - if kwargs.get('use_cache') == False: - raise NotImplementedError('MPT with prefix_lm=True does not support use_cache=False.') - else: - prefix_mask = None - return {'input_ids': input_ids, 'attention_mask': attention_mask, 'prefix_mask': prefix_mask, 'sequence_id': sequence_id, 'past_key_values': past_key_values, 'use_cache': kwargs.get('use_cache', True)} - - @staticmethod - def _reorder_cache(past_key_values, beam_idx): - """Used by HuggingFace generate when using beam search with kv-caching. - - See https://github.com/huggingface/transformers/blob/3ec7a47664ebe40c40f4b722f6bb1cd30c3821ec/src/transformers/models/gpt2/modeling_gpt2.py#L1122-L1133 - for an example in transformers. - """ - reordered_past = [] - for layer_past in past_key_values: - reordered_past += [tuple((past_state.index_select(0, beam_idx) for past_state in layer_past))] - return reordered_past \ No newline at end of file diff --git a/spaces/badmonk/model/README.md b/spaces/badmonk/model/README.md deleted file mode 100644 index f50d7ed38081f141b5c0c2f67486ba917044e67f..0000000000000000000000000000000000000000 --- a/spaces/badmonk/model/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: MODEL -emoji: 💀 -colorFrom: gray -colorTo: gray -sdk: gradio -sdk_version: 3.23.0 -app_file: app.py -pinned: true ---- - - \ No newline at end of file diff --git a/spaces/banana-projects/web3d/node_modules/three/examples/js/postprocessing/SSAARenderPass.js b/spaces/banana-projects/web3d/node_modules/three/examples/js/postprocessing/SSAARenderPass.js deleted file mode 100644 index 76c1848ff5abda06a3fec8cc6eaa8d6ebac05675..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/examples/js/postprocessing/SSAARenderPass.js +++ /dev/null @@ -1,181 +0,0 @@ -/** -* -* Supersample Anti-Aliasing Render Pass -* -* @author bhouston / http://clara.io/ -* -* This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results. -* -* References: https://en.wikipedia.org/wiki/Supersampling -* -*/ - -THREE.SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) { - - THREE.Pass.call( this ); - - this.scene = scene; - this.camera = camera; - - this.sampleLevel = 4; // specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16. - this.unbiased = true; - - // as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black. - this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000; - this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; - - if ( THREE.CopyShader === undefined ) console.error( "THREE.SSAARenderPass relies on THREE.CopyShader" ); - - var copyShader = THREE.CopyShader; - this.copyUniforms = THREE.UniformsUtils.clone( copyShader.uniforms ); - - this.copyMaterial = new THREE.ShaderMaterial( { - uniforms: this.copyUniforms, - vertexShader: copyShader.vertexShader, - fragmentShader: copyShader.fragmentShader, - premultipliedAlpha: true, - transparent: true, - blending: THREE.AdditiveBlending, - depthTest: false, - depthWrite: false - } ); - - this.fsQuad = new THREE.Pass.FullScreenQuad( this.copyMaterial ); - -}; - -THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { - - constructor: THREE.SSAARenderPass, - - dispose: function () { - - if ( this.sampleRenderTarget ) { - - this.sampleRenderTarget.dispose(); - this.sampleRenderTarget = null; - - } - - }, - - setSize: function ( width, height ) { - - if ( this.sampleRenderTarget ) this.sampleRenderTarget.setSize( width, height ); - - }, - - render: function ( renderer, writeBuffer, readBuffer ) { - - if ( ! this.sampleRenderTarget ) { - - this.sampleRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat } ); - this.sampleRenderTarget.texture.name = "SSAARenderPass.sample"; - - } - - var jitterOffsets = THREE.SSAARenderPass.JitterVectors[ Math.max( 0, Math.min( this.sampleLevel, 5 ) ) ]; - - var autoClear = renderer.autoClear; - renderer.autoClear = false; - - var oldClearColor = renderer.getClearColor().getHex(); - var oldClearAlpha = renderer.getClearAlpha(); - - var baseSampleWeight = 1.0 / jitterOffsets.length; - var roundingRange = 1 / 32; - this.copyUniforms[ "tDiffuse" ].value = this.sampleRenderTarget.texture; - - var width = readBuffer.width, height = readBuffer.height; - - // render the scene multiple times, each slightly jitter offset from the last and accumulate the results. - for ( var i = 0; i < jitterOffsets.length; i ++ ) { - - var jitterOffset = jitterOffsets[ i ]; - - if ( this.camera.setViewOffset ) { - - this.camera.setViewOffset( width, height, - jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625, // 0.0625 = 1 / 16 - width, height ); - - } - - var sampleWeight = baseSampleWeight; - - if ( this.unbiased ) { - - // the theory is that equal weights for each sample lead to an accumulation of rounding errors. - // The following equation varies the sampleWeight per sample so that it is uniformly distributed - // across a range of values whose rounding errors cancel each other out. - - var uniformCenteredDistribution = ( - 0.5 + ( i + 0.5 ) / jitterOffsets.length ); - sampleWeight += roundingRange * uniformCenteredDistribution; - - } - - this.copyUniforms[ "opacity" ].value = sampleWeight; - renderer.setClearColor( this.clearColor, this.clearAlpha ); - renderer.setRenderTarget( this.sampleRenderTarget ); - renderer.clear(); - renderer.render( this.scene, this.camera ); - - renderer.setRenderTarget( this.renderToScreen ? null : writeBuffer ); - - if ( i === 0 ) { - - renderer.setClearColor( 0x000000, 0.0 ); - renderer.clear(); - - } - - this.fsQuad.render( renderer ); - - } - - if ( this.camera.clearViewOffset ) this.camera.clearViewOffset(); - - renderer.autoClear = autoClear; - renderer.setClearColor( oldClearColor, oldClearAlpha ); - - } - -} ); - - -// These jitter vectors are specified in integers because it is easier. -// I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5) -// before being used, thus these integers need to be scaled by 1/16. -// -// Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 -THREE.SSAARenderPass.JitterVectors = [ - [ - [ 0, 0 ] - ], - [ - [ 4, 4 ], [ - 4, - 4 ] - ], - [ - [ - 2, - 6 ], [ 6, - 2 ], [ - 6, 2 ], [ 2, 6 ] - ], - [ - [ 1, - 3 ], [ - 1, 3 ], [ 5, 1 ], [ - 3, - 5 ], - [ - 5, 5 ], [ - 7, - 1 ], [ 3, 7 ], [ 7, - 7 ] - ], - [ - [ 1, 1 ], [ - 1, - 3 ], [ - 3, 2 ], [ 4, - 1 ], - [ - 5, - 2 ], [ 2, 5 ], [ 5, 3 ], [ 3, - 5 ], - [ - 2, 6 ], [ 0, - 7 ], [ - 4, - 6 ], [ - 6, 4 ], - [ - 8, 0 ], [ 7, - 4 ], [ 6, 7 ], [ - 7, - 8 ] - ], - [ - [ - 4, - 7 ], [ - 7, - 5 ], [ - 3, - 5 ], [ - 5, - 4 ], - [ - 1, - 4 ], [ - 2, - 2 ], [ - 6, - 1 ], [ - 4, 0 ], - [ - 7, 1 ], [ - 1, 2 ], [ - 6, 3 ], [ - 3, 3 ], - [ - 7, 6 ], [ - 3, 6 ], [ - 5, 7 ], [ - 1, 7 ], - [ 5, - 7 ], [ 1, - 6 ], [ 6, - 5 ], [ 4, - 4 ], - [ 2, - 3 ], [ 7, - 2 ], [ 1, - 1 ], [ 4, - 1 ], - [ 2, 1 ], [ 6, 2 ], [ 0, 4 ], [ 4, 4 ], - [ 2, 5 ], [ 7, 5 ], [ 5, 6 ], [ 3, 7 ] - ] -]; diff --git a/spaces/banana-projects/web3d/node_modules/three/src/cameras/StereoCamera.d.ts b/spaces/banana-projects/web3d/node_modules/three/src/cameras/StereoCamera.d.ts deleted file mode 100644 index cf27ebddd26891cd83d49378e3d38b6d8f68a60f..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/src/cameras/StereoCamera.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { PerspectiveCamera } from './PerspectiveCamera'; -import { Camera } from './Camera'; - -export class StereoCamera extends Camera { - constructor(); - - type: 'StereoCamera'; - - aspect: number; - eyeSep: number; - cameraL: PerspectiveCamera; - cameraR: PerspectiveCamera; - - update(camera: PerspectiveCamera): void; -} diff --git a/spaces/banana-projects/web3d/node_modules/three/src/renderers/shaders/ShaderChunk/uv2_vertex.glsl.js b/spaces/banana-projects/web3d/node_modules/three/src/renderers/shaders/ShaderChunk/uv2_vertex.glsl.js deleted file mode 100644 index 0c9fb86482df046aeeaf6bb407935dfe70d6b667..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/src/renderers/shaders/ShaderChunk/uv2_vertex.glsl.js +++ /dev/null @@ -1,7 +0,0 @@ -export default /* glsl */` -#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - - vUv2 = uv2; - -#endif -`; diff --git a/spaces/bioriAsaeru/text-to-voice/El Guerrero Tolteca A Book that Will Change Your Life Forever (PDF Download).md b/spaces/bioriAsaeru/text-to-voice/El Guerrero Tolteca A Book that Will Change Your Life Forever (PDF Download).md deleted file mode 100644 index 139d68509bf09853aba61335e578542abd3fe36d..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/El Guerrero Tolteca A Book that Will Change Your Life Forever (PDF Download).md +++ /dev/null @@ -1,6 +0,0 @@ -

    el guerrero tolteca pdf download


    Downloadhttps://urloso.com/2uyObi



    -
    - aaccfb2cb3
    -
    -
    -

    diff --git a/spaces/bioriAsaeru/text-to-voice/Laadla Hai Full Movie Free Download In Mp4l Anil Kapoor and Sridevis Romantic Chemistry in this Bollywood Classic.md b/spaces/bioriAsaeru/text-to-voice/Laadla Hai Full Movie Free Download In Mp4l Anil Kapoor and Sridevis Romantic Chemistry in this Bollywood Classic.md deleted file mode 100644 index e9c33e6f9ad6b497ad91a13af12e910fc0b8f172..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/Laadla Hai Full Movie Free Download In Mp4l Anil Kapoor and Sridevis Romantic Chemistry in this Bollywood Classic.md +++ /dev/null @@ -1,8 +0,0 @@ - -

    Mp3 Juice is the most popular free mp3 search engine tool and music downloader, is very popular. MP3 Juice is a great tool to convert and download youtube videos and music. The Mp3 Juice website is the best way to quickly and easily download mp3 music. Its simplicity makes Mp3juice easy to use, so anyone can search for and download high-quality audio files

    -

    This website offers unlimited downloading of youtube music and Mp3 juice song free download in HD quality. You can also click "PLAY" to play the audio file before you download it. Mp3juices take only 2-5 seconds to convert and download audio files.

    -

    Laadla Hai Full Movie Free Download In Mp4l


    Download >>>>> https://urloso.com/2uyP0c



    -

    You can access this free mp3 download website online via an internet connection or WiFi. Bookmark this website to make it easy to access on a regular basis. Once you have downloaded the audio file, open it in any audio player to listen offline in high-quality.

    -

    MP3 juice music is easy to navigate through and provides a simple interface for downloading the audio. You might be wondering why people prefer mp3juices to get mp3 juice for free. This tool provides high-speed audio downloads, and users don't need to give any personal information.

    aaccfb2cb3
    -
    -
    \ No newline at end of file diff --git a/spaces/birsardar/stable-diffusion-mat-outpainting-primer/metrics/inception_score.py b/spaces/birsardar/stable-diffusion-mat-outpainting-primer/metrics/inception_score.py deleted file mode 100644 index 3822c1435901a47e8c192b52cd3ed1ce5de67acd..0000000000000000000000000000000000000000 --- a/spaces/birsardar/stable-diffusion-mat-outpainting-primer/metrics/inception_score.py +++ /dev/null @@ -1,38 +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. - -"""Inception Score (IS) from the paper "Improved techniques for training -GANs". Matches the original implementation by Salimans et al. at -https://github.com/openai/improved-gan/blob/master/inception_score/model.py""" - -import numpy as np -from . import metric_utils - -#---------------------------------------------------------------------------- - -def compute_is(opts, num_gen, num_splits): - # Direct TorchScript translation of http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz - detector_url = 'https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/metrics/inception-2015-12-05.pt' - detector_kwargs = dict(no_output_bias=True) # Match the original implementation by not applying bias in the softmax layer. - - gen_probs = metric_utils.compute_feature_stats_for_generator( - opts=opts, detector_url=detector_url, detector_kwargs=detector_kwargs, - capture_all=True, max_items=num_gen).get_all() - - if opts.rank != 0: - return float('nan'), float('nan') - - scores = [] - for i in range(num_splits): - part = gen_probs[i * num_gen // num_splits : (i + 1) * num_gen // num_splits] - kl = part * (np.log(part) - np.log(np.mean(part, axis=0, keepdims=True))) - kl = np.mean(np.sum(kl, axis=1)) - scores.append(np.exp(kl)) - return float(np.mean(scores)), float(np.std(scores)) - -#---------------------------------------------------------------------------- diff --git a/spaces/bla/tranny/App/Embedding/utils/Summarizer.py b/spaces/bla/tranny/App/Embedding/utils/Summarizer.py deleted file mode 100644 index b4533dbd595d5f3dd6a0ddc10b762cd2847be100..0000000000000000000000000000000000000000 --- a/spaces/bla/tranny/App/Embedding/utils/Summarizer.py +++ /dev/null @@ -1,118 +0,0 @@ -from langchain import OpenAI -from langchain.chains.summarize import load_summarize_chain -from langchain.text_splitter import RecursiveCharacterTextSplitter -from langchain import PromptTemplate -import openai,os - -openai.api_base = os.environ.get("api_base") -openai.api_key = os.environ.get("api_key") -openai_api_key = openai.api_key - - -import json -def read_transcriptions_from_file(file_path): - transcriptions = [] - with open(file_path, 'r') as file: - lines = file.readlines() - for line in lines: - part = json.loads(line) - - transcriptions.append(part) - return transcriptions -def combine_n_segments(transcriptions, n=2000): - combined_segments = [] - current_segment = None - - for i, transcription in enumerate(transcriptions): - if current_segment is None: - current_segment = transcription - else: - # Calculate the new end time based on the current segment and the next transcription - current_segment['end'] = transcription['end'] - # Combine the texts with a space between - current_segment['text'] += transcription['text'] - - # If the next transcription is not continuous or n segments are combined, start a new segment - if (transcription['end'] != current_segment['end']) or (i % n == n - 1): - combined_segments.append(current_segment) - current_segment = None - - # Append the last segment if needed - if current_segment is not None: - combined_segments.append(current_segment) - - return combined_segments - - - - -llm = OpenAI( - temperature=0 ,openai_api_key=openai.api_key, openai_api_base=openai.api_base -) - - -paul_graham_essay = "./sample.txt" - -with open(paul_graham_essay, "r") as file: - essay = file.read() - -essay = read_transcriptions_from_file("./sample.txt") -essay = combine_n_segments(essay) - -def generate_summary(data): - template = """ {data} """.format(data=data) - chunk_size = 2500 - inc = 100 - max_tokens = 2000 - min_tokens = 1500 - max_token_doc = 0 - - # choose the appropriate chunk size - while True: - # initialize text splitter - text_splitter = RecursiveCharacterTextSplitter( - separators=["\n\n", "\n"], - chunk_size=chunk_size, - # chunk_overlap=int(chunk_size * 0.1), - ) - docs = text_splitter.create_documents([template]) - temp =[] - for doc in docs: - temp.append(llm.get_num_tokens(doc.page_content)) - max_token_doc = max(temp) - if max_tokens < max_token_doc or max_token_doc < min_tokens: - if max_tokens < max_token_doc: - chunk_size -= inc - else: - chunk_size += inc - print(max_token_doc,chunk_size) - continue - - else: - break - map_prompt = """ - ### Write a summary of the following, video transcript segment, return a detailed summary citing the time stamps which are in seconds - ### cite using seconds ONLY - "{text}" - Detailed SUMMARY: -""" - - - map_prompt_template = PromptTemplate(template=map_prompt, input_variables=["text"]) - combine_prompt = """ - ### Write a summary of the following, video transcript segment summaries, return a detailed summary. - Return your response citing the time stamps which are in seconds. - #cite using seconds ONLY - ```{text}``` - SUMMARY: - """ - combine_prompt_template = PromptTemplate(template=combine_prompt, input_variables=["text"]) - summary_chain = load_summarize_chain(llm=llm, - chain_type='map_reduce', - map_prompt=map_prompt_template, - combine_prompt=combine_prompt_template, - verbose=True - ) - summary=summary_chain.run(docs) - print(summary) -generate_summary(essay) diff --git a/spaces/bradarrML/stablediffusion-infinity/PyPatchMatch/patch_match.py b/spaces/bradarrML/stablediffusion-infinity/PyPatchMatch/patch_match.py deleted file mode 100644 index 14febe43c78f49120c8be9f02941c3c1f8fdc3b1..0000000000000000000000000000000000000000 --- a/spaces/bradarrML/stablediffusion-infinity/PyPatchMatch/patch_match.py +++ /dev/null @@ -1,263 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# File : patch_match.py -# Author : Jiayuan Mao -# Email : maojiayuan@gmail.com -# Date : 01/09/2020 -# -# Distributed under terms of the MIT license. - -import ctypes -import os.path as osp -from typing import Optional, Union - -import numpy as np -from PIL import Image - - -import os -if os.name!="nt": - # Otherwise, fall back to the subprocess. - import subprocess - print('Compiling and loading c extensions from "{}".'.format(osp.realpath(osp.dirname(__file__)))) - # subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__)) - subprocess.check_call("make clean && make", cwd=osp.dirname(__file__), shell=True) - - -__all__ = ['set_random_seed', 'set_verbose', 'inpaint', 'inpaint_regularity'] - - -class CShapeT(ctypes.Structure): - _fields_ = [ - ('width', ctypes.c_int), - ('height', ctypes.c_int), - ('channels', ctypes.c_int), - ] - - -class CMatT(ctypes.Structure): - _fields_ = [ - ('data_ptr', ctypes.c_void_p), - ('shape', CShapeT), - ('dtype', ctypes.c_int) - ] - -import tempfile -from urllib.request import urlopen, Request -import shutil -from pathlib import Path -from tqdm import tqdm - -def download_url_to_file(url, dst, hash_prefix=None, progress=True): - r"""Download object at the given URL to a local path. - - Args: - url (string): URL of the object to download - dst (string): Full path where object will be saved, e.g. ``/tmp/temporary_file`` - hash_prefix (string, optional): If not None, the SHA256 downloaded file should start with ``hash_prefix``. - Default: None - progress (bool, optional): whether or not to display a progress bar to stderr - Default: True - https://pytorch.org/docs/stable/_modules/torch/hub.html#load_state_dict_from_url - """ - file_size = None - req = Request(url) - u = urlopen(req) - meta = u.info() - if hasattr(meta, 'getheaders'): - content_length = meta.getheaders("Content-Length") - else: - content_length = meta.get_all("Content-Length") - if content_length is not None and len(content_length) > 0: - file_size = int(content_length[0]) - - # We deliberately save it in a temp file and move it after - # download is complete. This prevents a local working checkpoint - # being overridden by a broken download. - dst = os.path.expanduser(dst) - dst_dir = os.path.dirname(dst) - f = tempfile.NamedTemporaryFile(delete=False, dir=dst_dir) - - try: - with tqdm(total=file_size, disable=not progress, - unit='B', unit_scale=True, unit_divisor=1024) as pbar: - while True: - buffer = u.read(8192) - if len(buffer) == 0: - break - f.write(buffer) - pbar.update(len(buffer)) - - f.close() - shutil.move(f.name, dst) - finally: - f.close() - if os.path.exists(f.name): - os.remove(f.name) - -if os.name!="nt": - PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.so')) -else: - if not os.path.exists(osp.join(osp.dirname(__file__), 'libpatchmatch.dll')): - download_url_to_file(url="https://github.com/lkwq007/PyPatchMatch/releases/download/v0.1/libpatchmatch.dll",dst=osp.join(osp.dirname(__file__), 'libpatchmatch.dll')) - if not os.path.exists(osp.join(osp.dirname(__file__), 'opencv_world460.dll')): - download_url_to_file(url="https://github.com/lkwq007/PyPatchMatch/releases/download/v0.1/opencv_world460.dll",dst=osp.join(osp.dirname(__file__), 'opencv_world460.dll')) - if not os.path.exists(osp.join(osp.dirname(__file__), 'libpatchmatch.dll')): - print("[Dependency Missing] Please download https://github.com/lkwq007/PyPatchMatch/releases/download/v0.1/libpatchmatch.dll and put it into the PyPatchMatch folder") - if not os.path.exists(osp.join(osp.dirname(__file__), 'opencv_world460.dll')): - print("[Dependency Missing] Please download https://github.com/lkwq007/PyPatchMatch/releases/download/v0.1/opencv_world460.dll and put it into the PyPatchMatch folder") - PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.dll')) - -PMLIB.PM_set_random_seed.argtypes = [ctypes.c_uint] -PMLIB.PM_set_verbose.argtypes = [ctypes.c_int] -PMLIB.PM_free_pymat.argtypes = [CMatT] -PMLIB.PM_inpaint.argtypes = [CMatT, CMatT, ctypes.c_int] -PMLIB.PM_inpaint.restype = CMatT -PMLIB.PM_inpaint_regularity.argtypes = [CMatT, CMatT, CMatT, ctypes.c_int, ctypes.c_float] -PMLIB.PM_inpaint_regularity.restype = CMatT -PMLIB.PM_inpaint2.argtypes = [CMatT, CMatT, CMatT, ctypes.c_int] -PMLIB.PM_inpaint2.restype = CMatT -PMLIB.PM_inpaint2_regularity.argtypes = [CMatT, CMatT, CMatT, CMatT, ctypes.c_int, ctypes.c_float] -PMLIB.PM_inpaint2_regularity.restype = CMatT - - -def set_random_seed(seed: int): - PMLIB.PM_set_random_seed(ctypes.c_uint(seed)) - - -def set_verbose(verbose: bool): - PMLIB.PM_set_verbose(ctypes.c_int(verbose)) - - -def inpaint( - image: Union[np.ndarray, Image.Image], - mask: Optional[Union[np.ndarray, Image.Image]] = None, - *, - global_mask: Optional[Union[np.ndarray, Image.Image]] = None, - patch_size: int = 15 -) -> np.ndarray: - """ - PatchMatch based inpainting proposed in: - - PatchMatch : A Randomized Correspondence Algorithm for Structural Image Editing - C.Barnes, E.Shechtman, A.Finkelstein and Dan B.Goldman - SIGGRAPH 2009 - - Args: - image (Union[np.ndarray, Image.Image]): the input image, should be 3-channel RGB/BGR. - mask (Union[np.array, Image.Image], optional): the mask of the hole(s) to be filled, should be 1-channel. - If not provided (None), the algorithm will treat all purely white pixels as the holes (255, 255, 255). - global_mask (Union[np.array, Image.Image], optional): the target mask of the output image. - patch_size (int): the patch size for the inpainting algorithm. - - Return: - result (np.ndarray): the repaired image, of the same size as the input image. - """ - - if isinstance(image, Image.Image): - image = np.array(image) - image = np.ascontiguousarray(image) - assert image.ndim == 3 and image.shape[2] == 3 and image.dtype == 'uint8' - - if mask is None: - mask = (image == (255, 255, 255)).all(axis=2, keepdims=True).astype('uint8') - mask = np.ascontiguousarray(mask) - else: - mask = _canonize_mask_array(mask) - - if global_mask is None: - ret_pymat = PMLIB.PM_inpaint(np_to_pymat(image), np_to_pymat(mask), ctypes.c_int(patch_size)) - else: - global_mask = _canonize_mask_array(global_mask) - ret_pymat = PMLIB.PM_inpaint2(np_to_pymat(image), np_to_pymat(mask), np_to_pymat(global_mask), ctypes.c_int(patch_size)) - - ret_npmat = pymat_to_np(ret_pymat) - PMLIB.PM_free_pymat(ret_pymat) - - return ret_npmat - - -def inpaint_regularity( - image: Union[np.ndarray, Image.Image], - mask: Optional[Union[np.ndarray, Image.Image]], - ijmap: np.ndarray, - *, - global_mask: Optional[Union[np.ndarray, Image.Image]] = None, - patch_size: int = 15, guide_weight: float = 0.25 -) -> np.ndarray: - if isinstance(image, Image.Image): - image = np.array(image) - image = np.ascontiguousarray(image) - - assert isinstance(ijmap, np.ndarray) and ijmap.ndim == 3 and ijmap.shape[2] == 3 and ijmap.dtype == 'float32' - ijmap = np.ascontiguousarray(ijmap) - - assert image.ndim == 3 and image.shape[2] == 3 and image.dtype == 'uint8' - if mask is None: - mask = (image == (255, 255, 255)).all(axis=2, keepdims=True).astype('uint8') - mask = np.ascontiguousarray(mask) - else: - mask = _canonize_mask_array(mask) - - - if global_mask is None: - ret_pymat = PMLIB.PM_inpaint_regularity(np_to_pymat(image), np_to_pymat(mask), np_to_pymat(ijmap), ctypes.c_int(patch_size), ctypes.c_float(guide_weight)) - else: - global_mask = _canonize_mask_array(global_mask) - ret_pymat = PMLIB.PM_inpaint2_regularity(np_to_pymat(image), np_to_pymat(mask), np_to_pymat(global_mask), np_to_pymat(ijmap), ctypes.c_int(patch_size), ctypes.c_float(guide_weight)) - - ret_npmat = pymat_to_np(ret_pymat) - PMLIB.PM_free_pymat(ret_pymat) - - return ret_npmat - - -def _canonize_mask_array(mask): - if isinstance(mask, Image.Image): - mask = np.array(mask) - if mask.ndim == 2 and mask.dtype == 'uint8': - mask = mask[..., np.newaxis] - assert mask.ndim == 3 and mask.shape[2] == 1 and mask.dtype == 'uint8' - return np.ascontiguousarray(mask) - - -dtype_pymat_to_ctypes = [ - ctypes.c_uint8, - ctypes.c_int8, - ctypes.c_uint16, - ctypes.c_int16, - ctypes.c_int32, - ctypes.c_float, - ctypes.c_double, -] - - -dtype_np_to_pymat = { - 'uint8': 0, - 'int8': 1, - 'uint16': 2, - 'int16': 3, - 'int32': 4, - 'float32': 5, - 'float64': 6, -} - - -def np_to_pymat(npmat): - assert npmat.ndim == 3 - return CMatT( - ctypes.cast(npmat.ctypes.data, ctypes.c_void_p), - CShapeT(npmat.shape[1], npmat.shape[0], npmat.shape[2]), - dtype_np_to_pymat[str(npmat.dtype)] - ) - - -def pymat_to_np(pymat): - npmat = np.ctypeslib.as_array( - ctypes.cast(pymat.data_ptr, ctypes.POINTER(dtype_pymat_to_ctypes[pymat.dtype])), - (pymat.shape.height, pymat.shape.width, pymat.shape.channels) - ) - ret = np.empty(npmat.shape, npmat.dtype) - ret[:] = npmat - return ret - diff --git a/spaces/brjathu/HMR2.0/hmr2/models/losses.py b/spaces/brjathu/HMR2.0/hmr2/models/losses.py deleted file mode 100644 index 0949d0630b7308aaa05be79a759931115b002bb9..0000000000000000000000000000000000000000 --- a/spaces/brjathu/HMR2.0/hmr2/models/losses.py +++ /dev/null @@ -1,92 +0,0 @@ -import torch -import torch.nn as nn - -class Keypoint2DLoss(nn.Module): - - def __init__(self, loss_type: str = 'l1'): - """ - 2D keypoint loss module. - Args: - loss_type (str): Choose between l1 and l2 losses. - """ - super(Keypoint2DLoss, self).__init__() - if loss_type == 'l1': - self.loss_fn = nn.L1Loss(reduction='none') - elif loss_type == 'l2': - self.loss_fn = nn.MSELoss(reduction='none') - else: - raise NotImplementedError('Unsupported loss function') - - def forward(self, pred_keypoints_2d: torch.Tensor, gt_keypoints_2d: torch.Tensor) -> torch.Tensor: - """ - Compute 2D reprojection loss on the keypoints. - Args: - pred_keypoints_2d (torch.Tensor): Tensor of shape [B, S, N, 2] containing projected 2D keypoints (B: batch_size, S: num_samples, N: num_keypoints) - gt_keypoints_2d (torch.Tensor): Tensor of shape [B, S, N, 3] containing the ground truth 2D keypoints and confidence. - Returns: - torch.Tensor: 2D keypoint loss. - """ - conf = gt_keypoints_2d[:, :, -1].unsqueeze(-1).clone() - batch_size = conf.shape[0] - loss = (conf * self.loss_fn(pred_keypoints_2d, gt_keypoints_2d[:, :, :-1])).sum(dim=(1,2)) - return loss.sum() - - -class Keypoint3DLoss(nn.Module): - - def __init__(self, loss_type: str = 'l1'): - """ - 3D keypoint loss module. - Args: - loss_type (str): Choose between l1 and l2 losses. - """ - super(Keypoint3DLoss, self).__init__() - if loss_type == 'l1': - self.loss_fn = nn.L1Loss(reduction='none') - elif loss_type == 'l2': - self.loss_fn = nn.MSELoss(reduction='none') - else: - raise NotImplementedError('Unsupported loss function') - - def forward(self, pred_keypoints_3d: torch.Tensor, gt_keypoints_3d: torch.Tensor, pelvis_id: int = 39): - """ - Compute 3D keypoint loss. - Args: - pred_keypoints_3d (torch.Tensor): Tensor of shape [B, S, N, 3] containing the predicted 3D keypoints (B: batch_size, S: num_samples, N: num_keypoints) - gt_keypoints_3d (torch.Tensor): Tensor of shape [B, S, N, 4] containing the ground truth 3D keypoints and confidence. - Returns: - torch.Tensor: 3D keypoint loss. - """ - batch_size = pred_keypoints_3d.shape[0] - gt_keypoints_3d = gt_keypoints_3d.clone() - pred_keypoints_3d = pred_keypoints_3d - pred_keypoints_3d[:, pelvis_id, :].unsqueeze(dim=1) - gt_keypoints_3d[:, :, :-1] = gt_keypoints_3d[:, :, :-1] - gt_keypoints_3d[:, pelvis_id, :-1].unsqueeze(dim=1) - conf = gt_keypoints_3d[:, :, -1].unsqueeze(-1).clone() - gt_keypoints_3d = gt_keypoints_3d[:, :, :-1] - loss = (conf * self.loss_fn(pred_keypoints_3d, gt_keypoints_3d)).sum(dim=(1,2)) - return loss.sum() - -class ParameterLoss(nn.Module): - - def __init__(self): - """ - SMPL parameter loss module. - """ - super(ParameterLoss, self).__init__() - self.loss_fn = nn.MSELoss(reduction='none') - - def forward(self, pred_param: torch.Tensor, gt_param: torch.Tensor, has_param: torch.Tensor): - """ - Compute SMPL parameter loss. - Args: - pred_param (torch.Tensor): Tensor of shape [B, S, ...] containing the predicted parameters (body pose / global orientation / betas) - gt_param (torch.Tensor): Tensor of shape [B, S, ...] containing the ground truth SMPL parameters. - Returns: - torch.Tensor: L2 parameter loss loss. - """ - batch_size = pred_param.shape[0] - num_dims = len(pred_param.shape) - mask_dimension = [batch_size] + [1] * (num_dims-1) - has_param = has_param.type(pred_param.type()).view(*mask_dimension) - loss_param = (has_param * self.loss_fn(pred_param, gt_param)) - return loss_param.sum() diff --git "a/spaces/bugbounted/Whisper-Auto-Subtitled-Video-Generator/pages/03_\360\237\223\235_Upload_Video_File_and_Transcript.py" "b/spaces/bugbounted/Whisper-Auto-Subtitled-Video-Generator/pages/03_\360\237\223\235_Upload_Video_File_and_Transcript.py" deleted file mode 100644 index 270df7f9ca1164ac24ae98bd56d3b7dffce11e93..0000000000000000000000000000000000000000 --- "a/spaces/bugbounted/Whisper-Auto-Subtitled-Video-Generator/pages/03_\360\237\223\235_Upload_Video_File_and_Transcript.py" +++ /dev/null @@ -1,130 +0,0 @@ -import streamlit as st -from streamlit_lottie import st_lottie -from utils import write_vtt, write_srt -import ffmpeg -import requests -from typing import Iterator -from io import StringIO -import numpy as np -import pathlib -import os - - -st.set_page_config(page_title="تولید کننده ویدیو زیرنویس خودکار", page_icon=":movie_camera:", layout="wide") - -# Define a function that we can use to load lottie files from a link. -@st.cache(allow_output_mutation=True) -def load_lottieurl(url: str): - r = requests.get(url) - if r.status_code != 200: - return None - return r.json() - - -APP_DIR = pathlib.Path(__file__).parent.absolute() - -LOCAL_DIR = APP_DIR / "local_transcript" -LOCAL_DIR.mkdir(exist_ok=True) -save_dir = LOCAL_DIR / "output" -save_dir.mkdir(exist_ok=True) - - -col1, col2 = st.columns([1, 3]) -with col1: - lottie = load_lottieurl("https://assets6.lottiefiles.com/packages/lf20_cjnxwrkt.json") - st_lottie(lottie) - -with col2: - st.write(""" - ## تولید کننده ویدئو زیرنویس خودکار - ##### ➠ یک فایل ویدیویی و یک رونوشت را به صورت فایل .srt یا .vtt آپلود کنید و یک ویدیو با زیرنویس دریافت کنید. - ##### ➠ با افزایش طول ویدئو، زمان پردازش افزایش خواهد یافت. """) - - -def getSubs(segments: Iterator[dict], format: str, maxLineWidth: int) -> str: - segmentStream = StringIO() - - if format == 'vtt': - write_vtt(segments, file=segmentStream, maxLineWidth=maxLineWidth) - elif format == 'srt': - write_srt(segments, file=segmentStream, maxLineWidth=maxLineWidth) - else: - raise Exception("Unknown format " + format) - - segmentStream.seek(0) - return segmentStream.read() - - -def split_video_audio(uploaded_file): - with open(f"{save_dir}/input.mp4", "wb") as f: - f.write(uploaded_file.read()) - audio = ffmpeg.input(f"{save_dir}/input.mp4") - audio = ffmpeg.output(audio, f"{save_dir}/output.wav", acodec="pcm_s16le", ac=1, ar="16k") - ffmpeg.run(audio, overwrite_output=True) - - -def main(): - uploaded_video = st.file_uploader("Upload Video File", type=["mp4", "avi", "mov", "mkv"]) - # get the name of the input_file - if uploaded_video is not None: - filename = uploaded_video.name[:-4] - else: - filename = None - transcript_file = st.file_uploader("Upload Transcript File", type=["srt", "vtt"]) - if transcript_file is not None: - transcript_name = transcript_file.name - else: - transcript_name = None - if uploaded_video is not None and transcript_file is not None: - if transcript_name[-3:] == "vtt": - with open("uploaded_transcript.vtt", "wb") as f: - f.writelines(transcript_file) - f.close() - with open(os.path.join(os.getcwd(), "uploaded_transcript.vtt"), "rb") as f: - vtt_file = f.read() - if st.button("Generate Video with Subtitles"): - with st.spinner("Generating Subtitled Video"): - split_video_audio(uploaded_video) - video_file = ffmpeg.input(f"{save_dir}/input.mp4") - audio_file = ffmpeg.input(f"{save_dir}/output.wav") - ffmpeg.concat(video_file.filter("subtitles", "uploaded_transcript.vtt"), audio_file, v=1, a=1).output("final.mp4").global_args('-report').run(quiet=True, overwrite_output=True) - video_with_subs = open("final.mp4", "rb") - col3, col4 = st.columns(2) - with col3: - st.video(uploaded_video) - with col4: - st.video(video_with_subs) - st.download_button(label="Download Video with Subtitles", - data=video_with_subs, - file_name=f"{filename}_with_subs.mp4") - - elif transcript_name[-3:] == "srt": - with open("uploaded_transcript.srt", "wb") as f: - f.writelines(transcript_file) - f.close() - with open(os.path.join(os.getcwd(), "uploaded_transcript.srt"), "rb") as f: - srt_file = f.read() - if st.button("Generate Video with Subtitles"): - with st.spinner("Generating Subtitled Video"): - split_video_audio(uploaded_video) - video_file = ffmpeg.input(f"{save_dir}/input.mp4") - audio_file = ffmpeg.input(f"{save_dir}/output.wav") - ffmpeg.concat(video_file.filter("subtitles", "uploaded_transcript.srt"), audio_file, v=1, a=1).output("final.mp4").run(quiet=True, overwrite_output=True) - video_with_subs = open("final.mp4", "rb") - col3, col4 = st.columns(2) - with col3: - st.video(uploaded_video) - with col4: - st.video(video_with_subs) - st.download_button(label="Download Video with Subtitles", - data=video_with_subs, - file_name=f"{filename}_with_subs.mp4") - else: - st.error("Please upload a .srt or .vtt file") - else: - st.info("Please upload a video file and a transcript file") - - -if __name__ == "__main__": - main() - st.markdown("###### Made with :heart: by [@bugbounted](https://github.com/bugbounted)") diff --git a/spaces/camenduru-com/VITS-Umamusume-voice-synthesizer/text/ngu_dialect.py b/spaces/camenduru-com/VITS-Umamusume-voice-synthesizer/text/ngu_dialect.py deleted file mode 100644 index ce3e12bbf0469426872eed5f681985d3e1be9b26..0000000000000000000000000000000000000000 --- a/spaces/camenduru-com/VITS-Umamusume-voice-synthesizer/text/ngu_dialect.py +++ /dev/null @@ -1,30 +0,0 @@ -import re -import opencc - - -dialects = {'SZ': 'suzhou', 'WX': 'wuxi', 'CZ': 'changzhou', 'HZ': 'hangzhou', - 'SX': 'shaoxing', 'NB': 'ningbo', 'JJ': 'jingjiang', 'YX': 'yixing', - 'JD': 'jiading', 'ZR': 'zhenru', 'PH': 'pinghu', 'TX': 'tongxiang', - 'JS': 'jiashan', 'HN': 'xiashi', 'LP': 'linping', 'XS': 'xiaoshan', - 'FY': 'fuyang', 'RA': 'ruao', 'CX': 'cixi', 'SM': 'sanmen', - 'TT': 'tiantai', 'WZ': 'wenzhou', 'SC': 'suichang', 'YB': 'youbu'} - -converters = {} - -for dialect in dialects.values(): - try: - converters[dialect] = opencc.OpenCC(dialect) - except: - pass - - -def ngu_dialect_to_ipa(text, dialect): - dialect = dialects[dialect] - text = converters[dialect].convert(text).replace('-','').replace('$',' ') - text = re.sub(r'[、;:]', ',', text) - text = re.sub(r'\s*,\s*', ', ', text) - text = re.sub(r'\s*。\s*', '. ', text) - text = re.sub(r'\s*?\s*', '? ', text) - text = re.sub(r'\s*!\s*', '! ', text) - text = re.sub(r'\s*$', '', text) - return text diff --git a/spaces/chendl/compositional_test/transformers/examples/research_projects/codeparrot/scripts/codeparrot_training.py b/spaces/chendl/compositional_test/transformers/examples/research_projects/codeparrot/scripts/codeparrot_training.py deleted file mode 100644 index 2510e02c94700dd8c2e7156e8c4e6cc46e7d9515..0000000000000000000000000000000000000000 --- a/spaces/chendl/compositional_test/transformers/examples/research_projects/codeparrot/scripts/codeparrot_training.py +++ /dev/null @@ -1,326 +0,0 @@ -import logging -import os -import time -from argparse import Namespace -from pathlib import Path - -import datasets -import torch -from accelerate import Accelerator, DistributedType -from arguments import TrainingArguments -from datasets import load_dataset -from huggingface_hub import Repository -from torch.optim import AdamW -from torch.utils.data import IterableDataset -from torch.utils.data.dataloader import DataLoader -from torch.utils.data.datapipes.iter.combinatorics import ShufflerIterDataPipe - -import transformers -from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, get_scheduler, set_seed - - -class ConstantLengthDataset(IterableDataset): - """ - Iterable dataset that returns constant length chunks of tokens from stream of text files. - Args: - tokenizer (Tokenizer): The processor used for proccessing the data. - dataset (dataset.Dataset): Dataset with text files. - infinite (bool): If True the iterator is reset after dataset reaches end else stops. - seq_length (int): Length of token sequences to return. - num_of_sequences (int): Number of token sequences to keep in buffer. - chars_per_token (int): Number of characters per token used to estimate number of tokens in text buffer. - tokenized (bool): If true we use a pretokenized dataset. - """ - - def __init__( - self, - tokenizer, - dataset, - infinite=False, - seq_length=1024, - num_of_sequences=1024, - chars_per_token=3.6, - tokenized=False, - ): - self.tokenizer = tokenizer - self.concat_token_id = tokenizer.bos_token_id - self.dataset = dataset - self.seq_length = seq_length - self.epoch = 0 - self.infinite = infinite - self.current_size = 0 - self.tokenized = tokenized - - if self.tokenized: - self.max_buffer_size = seq_length * num_of_sequences - self.content_field = "input_ids" - else: - self.max_buffer_size = seq_length * chars_per_token * num_of_sequences - self.content_field = "content" - - def __iter__(self): - iterator = iter(self.dataset) - more_examples = True - while more_examples: - buffer, buffer_len = [], 0 - while True: - if buffer_len >= self.max_buffer_size: - break - try: - buffer.append(next(iterator)[self.content_field]) - buffer_len += len(buffer[-1]) - except StopIteration: - if self.infinite: - iterator = iter(self.dataset) - self.epoch += 1 - logger.info(f"Dataset epoch: {self.epoch}") - else: - more_examples = False - break - if self.tokenized: - tokenized_inputs = buffer - else: - tokenized_inputs = self.tokenizer(buffer, truncation=False)["input_ids"] - all_token_ids = [] - for tokenized_input in tokenized_inputs: - all_token_ids.extend(tokenized_input + [self.concat_token_id]) - for i in range(0, len(all_token_ids), self.seq_length): - input_ids = all_token_ids[i : i + self.seq_length] - if len(input_ids) == self.seq_length: - self.current_size += 1 - yield torch.tensor(input_ids) - - def shuffle(self, buffer_size=1000): - return ShufflerIterDataPipe(self, buffer_size=buffer_size) - - -def setup_logging(args): - project_name = args.model_ckpt.split("/")[-1] - logger = logging.getLogger(__name__) - log_dir = Path(args.save_dir) / "log/" - log_dir.mkdir(exist_ok=True) - filename = f"debug_{accelerator.process_index}.log" - logging.basicConfig( - format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", - datefmt="%m/%d/%Y %H:%M:%S", - level=logging.INFO, - handlers=[logging.FileHandler(log_dir / filename), logging.StreamHandler()], - ) - if accelerator.is_main_process: # we only want to setup logging once - accelerator.init_trackers(project_name, vars(args)) - run_name = accelerator.trackers[0].run.name - logger.setLevel(logging.INFO) - datasets.utils.logging.set_verbosity_info() - transformers.utils.logging.set_verbosity_info() - else: - run_name = "" - logger.setLevel(logging.ERROR) - datasets.utils.logging.set_verbosity_error() - transformers.utils.logging.set_verbosity_error() - return logger, run_name - - -def create_dataloaders(args): - ds_kwargs = {"streaming": True} - train_data = load_dataset(args.dataset_name_train, split="train", **ds_kwargs) - train_data = train_data.shuffle(buffer_size=args.shuffle_buffer, seed=args.seed) - valid_data = load_dataset(args.dataset_name_valid, split="train", **ds_kwargs) - train_dataset = ConstantLengthDataset( - tokenizer, train_data, infinite=True, seq_length=args.seq_length, tokenized=args.tokenized - ) - valid_dataset = ConstantLengthDataset( - tokenizer, valid_data, infinite=False, seq_length=args.seq_length, tokenized=args.tokenized - ) - train_dataset = train_dataset.shuffle(buffer_size=args.shuffle_buffer) - train_dataloader = DataLoader(train_dataset, batch_size=args.train_batch_size, shuffle=True) - eval_dataloader = DataLoader(valid_dataset, batch_size=args.valid_batch_size) - return train_dataloader, eval_dataloader - - -def get_grouped_params(model, args, no_decay=["bias", "ln_1.weight", "ln_2.weight", "ln_f.weight"]): - params_with_wd, params_without_wd = [], [] - for n, p in model.named_parameters(): - if any(nd in n for nd in no_decay): - params_without_wd.append(p) - else: - params_with_wd.append(p) - return [ - {"params": params_with_wd, "weight_decay": args.weight_decay}, - {"params": params_without_wd, "weight_decay": 0.0}, - ] - - -def log_metrics(step, metrics): - logger.info(f"Step {step}: {metrics}") - if accelerator.is_main_process: - accelerator.log(metrics, step) - - -def compute_tflops(elapsed_time, accelerator, args): - # TFLOPs formula (from Equation 3 in Section 5.1 of https://arxiv.org/pdf/2104.04473.pdf). - config_model = accelerator.unwrap_model(model).config - checkpoint_factor = 4 if args.gradient_checkpointing else 3 - batch_size = args.train_batch_size * accelerator.state.num_processes * args.gradient_accumulation_steps - factor = 24 * checkpoint_factor * batch_size * args.seq_length * config_model.n_layer * (config_model.n_embd**2) - flops_per_iteration = factor * ( - 1.0 - + (args.seq_length / (6.0 * config_model.n_embd)) - + (tokenizer.vocab_size / (16.0 * config_model.n_layer * config_model.n_embd)) - ) - tflops = flops_per_iteration / (elapsed_time * accelerator.state.num_processes * (10**12)) - return tflops - - -def evaluate(args): - model.eval() - losses = [] - for step, batch in enumerate(eval_dataloader): - with torch.no_grad(): - outputs = model(batch, labels=batch) - loss = outputs.loss.repeat(args.valid_batch_size) - losses.append(accelerator.gather(loss)) - if args.max_eval_steps > 0 and step >= args.max_eval_steps: - break - losses = torch.cat(losses) - loss = losses[: eval_dataloader.dataset.current_size].mean() - try: - perplexity = torch.exp(loss) - except OverflowError: - perplexity = float("inf") - return loss.item(), perplexity.item() - - -# Settings -parser = HfArgumentParser(TrainingArguments) -args = parser.parse_args() - -# Accelerator -accelerator = Accelerator(log_with=["wandb", "tensorboard"], logging_dir=f"{args.save_dir}/log") -acc_state = {str(k): str(v) for k, v in accelerator.state.__dict__.items()} - -args = Namespace(**vars(args), **acc_state) -samples_per_step = accelerator.state.num_processes * args.train_batch_size -set_seed(args.seed) - -# Clone model repository -if accelerator.is_main_process: - hf_repo = Repository(args.save_dir, clone_from=args.model_ckpt) - -# Logging -logger, run_name = setup_logging(args) -logger.info(accelerator.state) - -# Checkout new branch on repo -if accelerator.is_main_process: - hf_repo.git_checkout(run_name, create_branch_ok=True) - -# Load model and tokenizer -model = AutoModelForCausalLM.from_pretrained(args.save_dir) -if args.gradient_checkpointing: - model.gradient_checkpointing_enable() -tokenizer = AutoTokenizer.from_pretrained(args.save_dir) - -# Load dataset and dataloader -train_dataloader, eval_dataloader = create_dataloaders(args) - -# Prepare the optimizer and learning rate scheduler -optimizer = AdamW(get_grouped_params(model, args), lr=args.learning_rate) -lr_scheduler = get_scheduler( - name=args.lr_scheduler_type, - optimizer=optimizer, - num_warmup_steps=args.num_warmup_steps, - num_training_steps=args.max_train_steps, -) -accelerator.register_for_checkpointing(lr_scheduler) - - -def get_lr(): - return optimizer.param_groups[0]["lr"] - - -# Prepare everything with our `accelerator`. -model, optimizer, train_dataloader, eval_dataloader = accelerator.prepare( - model, optimizer, train_dataloader, eval_dataloader -) - -# load in the weights and states from a previous save -if args.resume_from_checkpoint: - if args.resume_from_checkpoint is not None or args.resume_from_checkpoint != "": - accelerator.print(f"Resumed from checkpoint: {args.resume_from_checkpoint}") - accelerator.load_state(args.resume_from_checkpoint) - path = os.path.basename(args.resume_from_checkpoint) - else: - # Get the most recent checkpoint - dirs = [f.name for f in os.scandir(args.save_dir) if f.is_dir() and "step" in str(f)] - dirs.sort(key=os.path.getctime) - path = dirs[-1] # Sorts folders by date modified, most recent checkpoint is the last - # Extract the step of the checkpoint to continue from there - training_difference = os.path.splitext(path)[0] - resume_step = int(training_difference.replace("step_", "")) - -# Train model -model.train() -completed_steps = 0 -t_start = time.time() -loss_tracking = 0 -for step, batch in enumerate(train_dataloader, start=1): - if args.resume_from_checkpoint and step < resume_step: - continue # we need to skip steps until we reach the resumed step - loss = model(batch, labels=batch, use_cache=False).loss - avg_loss = accelerator.gather(loss.repeat(args.train_batch_size)).mean() - loss_tracking += avg_loss.item() / args.gradient_accumulation_steps - log_metrics(step, {"samples": step * samples_per_step, "loss_per_step/train": loss.item()}) - loss = loss / args.gradient_accumulation_steps - if step % args.gradient_accumulation_steps != 0: - # Prevent backward from doing gradient all_reduce in every step - if accelerator.distributed_type == DistributedType.MULTI_GPU: - with model.no_sync(): - accelerator.backward(loss) - else: - accelerator.backward(loss) - else: - lr = get_lr() - accelerator.backward(loss) - accelerator.clip_grad_norm_(model.parameters(), 1.0) - optimizer.step() - lr_scheduler.step() - optimizer.zero_grad() - elapsed_time = time.time() - t_start - tflops = compute_tflops(elapsed_time, accelerator, args) - log_metrics( - step, - { - "steps": completed_steps, - "loss/train": loss_tracking, - "lr": lr, - "tflops": tflops, - "time_per_iteration": elapsed_time, - }, - ) - t_start = time.time() - loss_tracking = 0 - completed_steps += 1 - if step % args.save_checkpoint_steps == 0: - logger.info("Evaluating and saving model checkpoint") - eval_loss, perplexity = evaluate(args) - log_metrics(step, {"loss/eval": eval_loss, "perplexity": perplexity}) - accelerator.wait_for_everyone() - save_dir = os.path.join(args.save_dir, f"step_{step}") - accelerator.save_state(save_dir) - if accelerator.is_main_process: - hf_repo.push_to_hub(commit_message=f"step {step}") - model.train() - if completed_steps >= args.max_train_steps: - break - -# Evaluate and save the last checkpoint -logger.info("Evaluating and saving model after training") -eval_loss, perplexity = evaluate(args) -log_metrics(step, {"loss/eval": eval_loss, "perplexity": perplexity}) -accelerator.wait_for_everyone() -unwrapped_model = accelerator.unwrap_model(model) -unwrapped_model.save_pretrained(args.save_dir, save_function=accelerator.save) -save_dir = os.path.join(args.save_dir, f"step_{step}") -accelerator.save_state(save_dir) -if accelerator.is_main_process: - hf_repo.push_to_hub(commit_message="final model") diff --git a/spaces/chrisjay/masakhane-benchmarks/app.py b/spaces/chrisjay/masakhane-benchmarks/app.py deleted file mode 100644 index 8e8440f27e1d15200c3e54b227748cb3058144b8..0000000000000000000000000000000000000000 --- a/spaces/chrisjay/masakhane-benchmarks/app.py +++ /dev/null @@ -1,109 +0,0 @@ -import gradio as gr -import yaml -from joeynmt.prediction import load_params_for_prediction,translate_for_hf_space -from huggingface_hub import hf_hub_download - -language_map = {'English':'en','Swahili':'sw','Fon':'fon','Igbo':'ig', - 'Arabic':'ar','Shona':'sn','Ẹ̀dó':'bin','Hausa':'ha', - 'Efik':'efi','Twi':'twi','Afrikaans':'af','Yoruba':'yo','Urhobo':'urh','Dendi':'ddn','̀Ẹ̀sán':'ish','Isoko':'iso', - 'Kamba':'kam','Luo':'luo','Southern Ndebele':'nr','Tshivenda':'ve'} - - -#List of available languages I worked on. -#... -available_language_pairs =['en-sw','en-af','en-ar','en-ddn','en-ish','en-iso','en-kam','en-luo','en-nr','en-ve','efi-en','en-bin','en-ha','en-ig','en-fon','en-twi','sn-en','sw-en','yo-en','en-urh'] -available_languages = list(language_map.keys()) - -def load_config(path="configs/default.yaml") -> dict: - """ - CODE ADAPTED FROM: https://github.com/joeynmt/joeynmt - Loads and parses a YAML configuration file. - - :param path: path to YAML configuration file - :return: configuration dictionary - """ - with open(path, 'r', encoding="utf-8") as ymlfile: - - cfg = yaml.safe_load(ymlfile) - return cfg - -def load_model(source_language,target_language): - #source_language = language_map[source_language_] - #target_language = language_map[target_language_] - - - translation_dir = 'main' - - try: - file_yaml = hf_hub_download("chrisjay/masakhane_benchmarks", filename=f"{source_language}-{target_language}/{translation_dir}/config.yaml",force_filename='config.yaml') - src_vocab = hf_hub_download("chrisjay/masakhane_benchmarks", filename=f"{source_language}-{target_language}/{translation_dir}/src_vocab.txt") - trg_vocab = hf_hub_download("chrisjay/masakhane_benchmarks", filename=f"{source_language}-{target_language}/{translation_dir}/trg_vocab.txt") - best_ckpt = hf_hub_download("chrisjay/masakhane_benchmarks", filename=f"{source_language}-{target_language}/{translation_dir}/best.ckpt") - except Exception: - raise Exception(f'It seems we do not have a working configuration repo yet for {source_language} -> {target_language}. \n You could help us by creating it here: https://huggingface.co/chrisjay/masakhane_benchmarks/tree/main') - - - parsed_yaml_file = load_config(file_yaml) - parsed_yaml_file['data']['src_vocab']=src_vocab - parsed_yaml_file['data']['trg_vocab']=trg_vocab - - params = load_params_for_prediction(parsed_yaml_file,best_ckpt) - return params - - -#Load models of all available language pairs -model_mapping = {} -examples_available_models=[] # Keep track of models that loaded successfully and display only them in the Examples. -for availabe_lang in available_language_pairs: - try: - model_mapping.update({availabe_lang:load_model(availabe_lang.split('-')[0],availabe_lang.split('-')[1])}) - examples_available_models.append([f"{list(language_map.keys())[list(language_map.values()).index(availabe_lang.split('-')[0])]}",f"{list(language_map.keys())[list(language_map.values()).index(availabe_lang.split('-')[1])]}"]) #idea to extract key from value got from https://stackoverflow.com/questions/8023306/get-key-by-value-in-dictionary - except Exception: - continue - -if examples_available_models==[]: - raise Exception(f'Available models for Space cannot be empty!') - - -def get_translation(source_language,target_language,source_sentence=None,source_file=None): - ''' - This takes a sentence and gets the translation. - ''' - - source_language_ = language_map[source_language] - target_language_ = language_map[target_language] - - - source = source_sentence - translation_type='sentence' - if source_file!=None: - translation_type='file' - source = source_file.name - try: - params = model_mapping[f'{source_language_}-{target_language_}'] - pred = translate_for_hf_space(params,source,translation_type) - except Exception: - return f'There was an issue loading the translation model for {source_language} -> {target_language}. Try another pair please' - - return pred[0] if source_file==None else pred - - - - -title = "Interact with Masakhane Benchmark Models" -description = "This enables you to interact with some of the Masakhane Benchmark Models and keep up with their improvement. Some of these models undergo finetuning on a regular basis. This way, you can easily use the best model with no hassles." - -iface = gr.Interface(fn=get_translation, - inputs=[gr.inputs.Dropdown(choices = available_languages,default='English'), - gr.inputs.Dropdown(choices = available_languages,default='Swahili'), - gr.inputs.Textbox(label="Input"), - gr.inputs.File(file_count="single", type="file", label='Or upload txt file containing sentences', optional=True)], - outputs=gr.outputs.Textbox(type="auto", label='Translation'), - title=title, - description=description, - examples=examples_available_models, - enable_queue=True, - theme='huggingface') -iface.launch() - - diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/PIL/JpegImagePlugin.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/PIL/JpegImagePlugin.py deleted file mode 100644 index dfc7e6e9f569e05e3a1f9e3fd1407b5f202a6d56..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/PIL/JpegImagePlugin.py +++ /dev/null @@ -1,849 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# JPEG (JFIF) file handling -# -# See "Digital Compression and Coding of Continuous-Tone Still Images, -# Part 1, Requirements and Guidelines" (CCITT T.81 / ISO 10918-1) -# -# History: -# 1995-09-09 fl Created -# 1995-09-13 fl Added full parser -# 1996-03-25 fl Added hack to use the IJG command line utilities -# 1996-05-05 fl Workaround Photoshop 2.5 CMYK polarity bug -# 1996-05-28 fl Added draft support, JFIF version (0.1) -# 1996-12-30 fl Added encoder options, added progression property (0.2) -# 1997-08-27 fl Save mode 1 images as BW (0.3) -# 1998-07-12 fl Added YCbCr to draft and save methods (0.4) -# 1998-10-19 fl Don't hang on files using 16-bit DQT's (0.4.1) -# 2001-04-16 fl Extract DPI settings from JFIF files (0.4.2) -# 2002-07-01 fl Skip pad bytes before markers; identify Exif files (0.4.3) -# 2003-04-25 fl Added experimental EXIF decoder (0.5) -# 2003-06-06 fl Added experimental EXIF GPSinfo decoder -# 2003-09-13 fl Extract COM markers -# 2009-09-06 fl Added icc_profile support (from Florian Hoech) -# 2009-03-06 fl Changed CMYK handling; always use Adobe polarity (0.6) -# 2009-03-08 fl Added subsampling support (from Justin Huff). -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1995-1996 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -import array -import io -import math -import os -import struct -import subprocess -import sys -import tempfile -import warnings - -from . import Image, ImageFile -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._binary import o8 -from ._binary import o16be as o16 -from .JpegPresets import presets - -# -# Parser - - -def Skip(self, marker): - n = i16(self.fp.read(2)) - 2 - ImageFile._safe_read(self.fp, n) - - -def APP(self, marker): - # - # Application marker. Store these in the APP dictionary. - # Also look for well-known application markers. - - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - - app = "APP%d" % (marker & 15) - - self.app[app] = s # compatibility - self.applist.append((app, s)) - - if marker == 0xFFE0 and s[:4] == b"JFIF": - # extract JFIF information - self.info["jfif"] = version = i16(s, 5) # version - self.info["jfif_version"] = divmod(version, 256) - # extract JFIF properties - try: - jfif_unit = s[7] - jfif_density = i16(s, 8), i16(s, 10) - except Exception: - pass - else: - if jfif_unit == 1: - self.info["dpi"] = jfif_density - self.info["jfif_unit"] = jfif_unit - self.info["jfif_density"] = jfif_density - elif marker == 0xFFE1 and s[:5] == b"Exif\0": - if "exif" not in self.info: - # extract EXIF information (incomplete) - self.info["exif"] = s # FIXME: value will change - self._exif_offset = self.fp.tell() - n + 6 - elif marker == 0xFFE2 and s[:5] == b"FPXR\0": - # extract FlashPix information (incomplete) - self.info["flashpix"] = s # FIXME: value will change - elif marker == 0xFFE2 and s[:12] == b"ICC_PROFILE\0": - # Since an ICC profile can be larger than the maximum size of - # a JPEG marker (64K), we need provisions to split it into - # multiple markers. The format defined by the ICC specifies - # one or more APP2 markers containing the following data: - # Identifying string ASCII "ICC_PROFILE\0" (12 bytes) - # Marker sequence number 1, 2, etc (1 byte) - # Number of markers Total of APP2's used (1 byte) - # Profile data (remainder of APP2 data) - # Decoders should use the marker sequence numbers to - # reassemble the profile, rather than assuming that the APP2 - # markers appear in the correct sequence. - self.icclist.append(s) - elif marker == 0xFFED and s[:14] == b"Photoshop 3.0\x00": - # parse the image resource block - offset = 14 - photoshop = self.info.setdefault("photoshop", {}) - while s[offset : offset + 4] == b"8BIM": - try: - offset += 4 - # resource code - code = i16(s, offset) - offset += 2 - # resource name (usually empty) - name_len = s[offset] - # name = s[offset+1:offset+1+name_len] - offset += 1 + name_len - offset += offset & 1 # align - # resource data block - size = i32(s, offset) - offset += 4 - data = s[offset : offset + size] - if code == 0x03ED: # ResolutionInfo - data = { - "XResolution": i32(data, 0) / 65536, - "DisplayedUnitsX": i16(data, 4), - "YResolution": i32(data, 8) / 65536, - "DisplayedUnitsY": i16(data, 12), - } - photoshop[code] = data - offset += size - offset += offset & 1 # align - except struct.error: - break # insufficient data - - elif marker == 0xFFEE and s[:5] == b"Adobe": - self.info["adobe"] = i16(s, 5) - # extract Adobe custom properties - try: - adobe_transform = s[11] - except IndexError: - pass - else: - self.info["adobe_transform"] = adobe_transform - elif marker == 0xFFE2 and s[:4] == b"MPF\0": - # extract MPO information - self.info["mp"] = s[4:] - # offset is current location minus buffer size - # plus constant header size - self.info["mpoffset"] = self.fp.tell() - n + 4 - - # If DPI isn't in JPEG header, fetch from EXIF - if "dpi" not in self.info and "exif" in self.info: - try: - exif = self.getexif() - resolution_unit = exif[0x0128] - x_resolution = exif[0x011A] - try: - dpi = float(x_resolution[0]) / x_resolution[1] - except TypeError: - dpi = x_resolution - if math.isnan(dpi): - raise ValueError - if resolution_unit == 3: # cm - # 1 dpcm = 2.54 dpi - dpi *= 2.54 - self.info["dpi"] = dpi, dpi - except (TypeError, KeyError, SyntaxError, ValueError, ZeroDivisionError): - # SyntaxError for invalid/unreadable EXIF - # KeyError for dpi not included - # ZeroDivisionError for invalid dpi rational value - # ValueError or TypeError for dpi being an invalid float - self.info["dpi"] = 72, 72 - - -def COM(self, marker): - # - # Comment marker. Store these in the APP dictionary. - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - - self.info["comment"] = s - self.app["COM"] = s # compatibility - self.applist.append(("COM", s)) - - -def SOF(self, marker): - # - # Start of frame marker. Defines the size and mode of the - # image. JPEG is colour blind, so we use some simple - # heuristics to map the number of layers to an appropriate - # mode. Note that this could be made a bit brighter, by - # looking for JFIF and Adobe APP markers. - - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - self._size = i16(s, 3), i16(s, 1) - - self.bits = s[0] - if self.bits != 8: - msg = f"cannot handle {self.bits}-bit layers" - raise SyntaxError(msg) - - self.layers = s[5] - if self.layers == 1: - self.mode = "L" - elif self.layers == 3: - self.mode = "RGB" - elif self.layers == 4: - self.mode = "CMYK" - else: - msg = f"cannot handle {self.layers}-layer images" - raise SyntaxError(msg) - - if marker in [0xFFC2, 0xFFC6, 0xFFCA, 0xFFCE]: - self.info["progressive"] = self.info["progression"] = 1 - - if self.icclist: - # fixup icc profile - self.icclist.sort() # sort by sequence number - if self.icclist[0][13] == len(self.icclist): - profile = [] - for p in self.icclist: - profile.append(p[14:]) - icc_profile = b"".join(profile) - else: - icc_profile = None # wrong number of fragments - self.info["icc_profile"] = icc_profile - self.icclist = [] - - for i in range(6, len(s), 3): - t = s[i : i + 3] - # 4-tuples: id, vsamp, hsamp, qtable - self.layer.append((t[0], t[1] // 16, t[1] & 15, t[2])) - - -def DQT(self, marker): - # - # Define quantization table. Note that there might be more - # than one table in each marker. - - # FIXME: The quantization tables can be used to estimate the - # compression quality. - - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - while len(s): - v = s[0] - precision = 1 if (v // 16 == 0) else 2 # in bytes - qt_length = 1 + precision * 64 - if len(s) < qt_length: - msg = "bad quantization table marker" - raise SyntaxError(msg) - data = array.array("B" if precision == 1 else "H", s[1:qt_length]) - if sys.byteorder == "little" and precision > 1: - data.byteswap() # the values are always big-endian - self.quantization[v & 15] = [data[i] for i in zigzag_index] - s = s[qt_length:] - - -# -# JPEG marker table - -MARKER = { - 0xFFC0: ("SOF0", "Baseline DCT", SOF), - 0xFFC1: ("SOF1", "Extended Sequential DCT", SOF), - 0xFFC2: ("SOF2", "Progressive DCT", SOF), - 0xFFC3: ("SOF3", "Spatial lossless", SOF), - 0xFFC4: ("DHT", "Define Huffman table", Skip), - 0xFFC5: ("SOF5", "Differential sequential DCT", SOF), - 0xFFC6: ("SOF6", "Differential progressive DCT", SOF), - 0xFFC7: ("SOF7", "Differential spatial", SOF), - 0xFFC8: ("JPG", "Extension", None), - 0xFFC9: ("SOF9", "Extended sequential DCT (AC)", SOF), - 0xFFCA: ("SOF10", "Progressive DCT (AC)", SOF), - 0xFFCB: ("SOF11", "Spatial lossless DCT (AC)", SOF), - 0xFFCC: ("DAC", "Define arithmetic coding conditioning", Skip), - 0xFFCD: ("SOF13", "Differential sequential DCT (AC)", SOF), - 0xFFCE: ("SOF14", "Differential progressive DCT (AC)", SOF), - 0xFFCF: ("SOF15", "Differential spatial (AC)", SOF), - 0xFFD0: ("RST0", "Restart 0", None), - 0xFFD1: ("RST1", "Restart 1", None), - 0xFFD2: ("RST2", "Restart 2", None), - 0xFFD3: ("RST3", "Restart 3", None), - 0xFFD4: ("RST4", "Restart 4", None), - 0xFFD5: ("RST5", "Restart 5", None), - 0xFFD6: ("RST6", "Restart 6", None), - 0xFFD7: ("RST7", "Restart 7", None), - 0xFFD8: ("SOI", "Start of image", None), - 0xFFD9: ("EOI", "End of image", None), - 0xFFDA: ("SOS", "Start of scan", Skip), - 0xFFDB: ("DQT", "Define quantization table", DQT), - 0xFFDC: ("DNL", "Define number of lines", Skip), - 0xFFDD: ("DRI", "Define restart interval", Skip), - 0xFFDE: ("DHP", "Define hierarchical progression", SOF), - 0xFFDF: ("EXP", "Expand reference component", Skip), - 0xFFE0: ("APP0", "Application segment 0", APP), - 0xFFE1: ("APP1", "Application segment 1", APP), - 0xFFE2: ("APP2", "Application segment 2", APP), - 0xFFE3: ("APP3", "Application segment 3", APP), - 0xFFE4: ("APP4", "Application segment 4", APP), - 0xFFE5: ("APP5", "Application segment 5", APP), - 0xFFE6: ("APP6", "Application segment 6", APP), - 0xFFE7: ("APP7", "Application segment 7", APP), - 0xFFE8: ("APP8", "Application segment 8", APP), - 0xFFE9: ("APP9", "Application segment 9", APP), - 0xFFEA: ("APP10", "Application segment 10", APP), - 0xFFEB: ("APP11", "Application segment 11", APP), - 0xFFEC: ("APP12", "Application segment 12", APP), - 0xFFED: ("APP13", "Application segment 13", APP), - 0xFFEE: ("APP14", "Application segment 14", APP), - 0xFFEF: ("APP15", "Application segment 15", APP), - 0xFFF0: ("JPG0", "Extension 0", None), - 0xFFF1: ("JPG1", "Extension 1", None), - 0xFFF2: ("JPG2", "Extension 2", None), - 0xFFF3: ("JPG3", "Extension 3", None), - 0xFFF4: ("JPG4", "Extension 4", None), - 0xFFF5: ("JPG5", "Extension 5", None), - 0xFFF6: ("JPG6", "Extension 6", None), - 0xFFF7: ("JPG7", "Extension 7", None), - 0xFFF8: ("JPG8", "Extension 8", None), - 0xFFF9: ("JPG9", "Extension 9", None), - 0xFFFA: ("JPG10", "Extension 10", None), - 0xFFFB: ("JPG11", "Extension 11", None), - 0xFFFC: ("JPG12", "Extension 12", None), - 0xFFFD: ("JPG13", "Extension 13", None), - 0xFFFE: ("COM", "Comment", COM), -} - - -def _accept(prefix): - # Magic number was taken from https://en.wikipedia.org/wiki/JPEG - return prefix[:3] == b"\xFF\xD8\xFF" - - -## -# Image plugin for JPEG and JFIF images. - - -class JpegImageFile(ImageFile.ImageFile): - format = "JPEG" - format_description = "JPEG (ISO 10918)" - - def _open(self): - s = self.fp.read(3) - - if not _accept(s): - msg = "not a JPEG file" - raise SyntaxError(msg) - s = b"\xFF" - - # Create attributes - self.bits = self.layers = 0 - - # JPEG specifics (internal) - self.layer = [] - self.huffman_dc = {} - self.huffman_ac = {} - self.quantization = {} - self.app = {} # compatibility - self.applist = [] - self.icclist = [] - - while True: - i = s[0] - if i == 0xFF: - s = s + self.fp.read(1) - i = i16(s) - else: - # Skip non-0xFF junk - s = self.fp.read(1) - continue - - if i in MARKER: - name, description, handler = MARKER[i] - if handler is not None: - handler(self, i) - if i == 0xFFDA: # start of scan - rawmode = self.mode - if self.mode == "CMYK": - rawmode = "CMYK;I" # assume adobe conventions - self.tile = [("jpeg", (0, 0) + self.size, 0, (rawmode, ""))] - # self.__offset = self.fp.tell() - break - s = self.fp.read(1) - elif i == 0 or i == 0xFFFF: - # padded marker or junk; move on - s = b"\xff" - elif i == 0xFF00: # Skip extraneous data (escaped 0xFF) - s = self.fp.read(1) - else: - msg = "no marker found" - raise SyntaxError(msg) - - def load_read(self, read_bytes): - """ - internal: read more image data - For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker - so libjpeg can finish decoding - """ - s = self.fp.read(read_bytes) - - if not s and ImageFile.LOAD_TRUNCATED_IMAGES and not hasattr(self, "_ended"): - # Premature EOF. - # Pretend file is finished adding EOI marker - self._ended = True - return b"\xFF\xD9" - - return s - - def draft(self, mode, size): - if len(self.tile) != 1: - return - - # Protect from second call - if self.decoderconfig: - return - - d, e, o, a = self.tile[0] - scale = 1 - original_size = self.size - - if a[0] == "RGB" and mode in ["L", "YCbCr"]: - self.mode = mode - a = mode, "" - - if size: - scale = min(self.size[0] // size[0], self.size[1] // size[1]) - for s in [8, 4, 2, 1]: - if scale >= s: - break - e = ( - e[0], - e[1], - (e[2] - e[0] + s - 1) // s + e[0], - (e[3] - e[1] + s - 1) // s + e[1], - ) - self._size = ((self.size[0] + s - 1) // s, (self.size[1] + s - 1) // s) - scale = s - - self.tile = [(d, e, o, a)] - self.decoderconfig = (scale, 0) - - box = (0, 0, original_size[0] / scale, original_size[1] / scale) - return self.mode, box - - def load_djpeg(self): - # ALTERNATIVE: handle JPEGs via the IJG command line utilities - - f, path = tempfile.mkstemp() - os.close(f) - if os.path.exists(self.filename): - subprocess.check_call(["djpeg", "-outfile", path, self.filename]) - else: - try: - os.unlink(path) - except OSError: - pass - - msg = "Invalid Filename" - raise ValueError(msg) - - try: - with Image.open(path) as _im: - _im.load() - self.im = _im.im - finally: - try: - os.unlink(path) - except OSError: - pass - - self.mode = self.im.mode - self._size = self.im.size - - self.tile = [] - - def _getexif(self): - return _getexif(self) - - def _getmp(self): - return _getmp(self) - - def getxmp(self): - """ - Returns a dictionary containing the XMP tags. - Requires defusedxml to be installed. - - :returns: XMP tags in a dictionary. - """ - - for segment, content in self.applist: - if segment == "APP1": - marker, xmp_tags = content.rsplit(b"\x00", 1) - if marker == b"http://ns.adobe.com/xap/1.0/": - return self._getxmp(xmp_tags) - return {} - - -def _getexif(self): - if "exif" not in self.info: - return None - return self.getexif()._get_merged_dict() - - -def _getmp(self): - # Extract MP information. This method was inspired by the "highly - # experimental" _getexif version that's been in use for years now, - # itself based on the ImageFileDirectory class in the TIFF plugin. - - # The MP record essentially consists of a TIFF file embedded in a JPEG - # application marker. - try: - data = self.info["mp"] - except KeyError: - return None - file_contents = io.BytesIO(data) - head = file_contents.read(8) - endianness = ">" if head[:4] == b"\x4d\x4d\x00\x2a" else "<" - # process dictionary - from . import TiffImagePlugin - - try: - info = TiffImagePlugin.ImageFileDirectory_v2(head) - file_contents.seek(info.next) - info.load(file_contents) - mp = dict(info) - except Exception as e: - msg = "malformed MP Index (unreadable directory)" - raise SyntaxError(msg) from e - # it's an error not to have a number of images - try: - quant = mp[0xB001] - except KeyError as e: - msg = "malformed MP Index (no number of images)" - raise SyntaxError(msg) from e - # get MP entries - mpentries = [] - try: - rawmpentries = mp[0xB002] - for entrynum in range(0, quant): - unpackedentry = struct.unpack_from( - f"{endianness}LLLHH", rawmpentries, entrynum * 16 - ) - labels = ("Attribute", "Size", "DataOffset", "EntryNo1", "EntryNo2") - mpentry = dict(zip(labels, unpackedentry)) - mpentryattr = { - "DependentParentImageFlag": bool(mpentry["Attribute"] & (1 << 31)), - "DependentChildImageFlag": bool(mpentry["Attribute"] & (1 << 30)), - "RepresentativeImageFlag": bool(mpentry["Attribute"] & (1 << 29)), - "Reserved": (mpentry["Attribute"] & (3 << 27)) >> 27, - "ImageDataFormat": (mpentry["Attribute"] & (7 << 24)) >> 24, - "MPType": mpentry["Attribute"] & 0x00FFFFFF, - } - if mpentryattr["ImageDataFormat"] == 0: - mpentryattr["ImageDataFormat"] = "JPEG" - else: - msg = "unsupported picture format in MPO" - raise SyntaxError(msg) - mptypemap = { - 0x000000: "Undefined", - 0x010001: "Large Thumbnail (VGA Equivalent)", - 0x010002: "Large Thumbnail (Full HD Equivalent)", - 0x020001: "Multi-Frame Image (Panorama)", - 0x020002: "Multi-Frame Image: (Disparity)", - 0x020003: "Multi-Frame Image: (Multi-Angle)", - 0x030000: "Baseline MP Primary Image", - } - mpentryattr["MPType"] = mptypemap.get(mpentryattr["MPType"], "Unknown") - mpentry["Attribute"] = mpentryattr - mpentries.append(mpentry) - mp[0xB002] = mpentries - except KeyError as e: - msg = "malformed MP Index (bad MP Entry)" - raise SyntaxError(msg) from e - # Next we should try and parse the individual image unique ID list; - # we don't because I've never seen this actually used in a real MPO - # file and so can't test it. - return mp - - -# -------------------------------------------------------------------- -# stuff to save JPEG files - -RAWMODE = { - "1": "L", - "L": "L", - "RGB": "RGB", - "RGBX": "RGB", - "CMYK": "CMYK;I", # assume adobe conventions - "YCbCr": "YCbCr", -} - -# fmt: off -zigzag_index = ( - 0, 1, 5, 6, 14, 15, 27, 28, - 2, 4, 7, 13, 16, 26, 29, 42, - 3, 8, 12, 17, 25, 30, 41, 43, - 9, 11, 18, 24, 31, 40, 44, 53, - 10, 19, 23, 32, 39, 45, 52, 54, - 20, 22, 33, 38, 46, 51, 55, 60, - 21, 34, 37, 47, 50, 56, 59, 61, - 35, 36, 48, 49, 57, 58, 62, 63, -) - -samplings = { - (1, 1, 1, 1, 1, 1): 0, - (2, 1, 1, 1, 1, 1): 1, - (2, 2, 1, 1, 1, 1): 2, -} -# fmt: on - - -def get_sampling(im): - # There's no subsampling when images have only 1 layer - # (grayscale images) or when they are CMYK (4 layers), - # so set subsampling to the default value. - # - # NOTE: currently Pillow can't encode JPEG to YCCK format. - # If YCCK support is added in the future, subsampling code will have - # to be updated (here and in JpegEncode.c) to deal with 4 layers. - if not hasattr(im, "layers") or im.layers in (1, 4): - return -1 - sampling = im.layer[0][1:3] + im.layer[1][1:3] + im.layer[2][1:3] - return samplings.get(sampling, -1) - - -def _save(im, fp, filename): - if im.width == 0 or im.height == 0: - msg = "cannot write empty image as JPEG" - raise ValueError(msg) - - try: - rawmode = RAWMODE[im.mode] - except KeyError as e: - msg = f"cannot write mode {im.mode} as JPEG" - raise OSError(msg) from e - - info = im.encoderinfo - - dpi = [round(x) for x in info.get("dpi", (0, 0))] - - quality = info.get("quality", -1) - subsampling = info.get("subsampling", -1) - qtables = info.get("qtables") - - if quality == "keep": - quality = -1 - subsampling = "keep" - qtables = "keep" - elif quality in presets: - preset = presets[quality] - quality = -1 - subsampling = preset.get("subsampling", -1) - qtables = preset.get("quantization") - elif not isinstance(quality, int): - msg = "Invalid quality setting" - raise ValueError(msg) - else: - if subsampling in presets: - subsampling = presets[subsampling].get("subsampling", -1) - if isinstance(qtables, str) and qtables in presets: - qtables = presets[qtables].get("quantization") - - if subsampling == "4:4:4": - subsampling = 0 - elif subsampling == "4:2:2": - subsampling = 1 - elif subsampling == "4:2:0": - subsampling = 2 - elif subsampling == "4:1:1": - # For compatibility. Before Pillow 4.3, 4:1:1 actually meant 4:2:0. - # Set 4:2:0 if someone is still using that value. - subsampling = 2 - elif subsampling == "keep": - if im.format != "JPEG": - msg = "Cannot use 'keep' when original image is not a JPEG" - raise ValueError(msg) - subsampling = get_sampling(im) - - def validate_qtables(qtables): - if qtables is None: - return qtables - if isinstance(qtables, str): - try: - lines = [ - int(num) - for line in qtables.splitlines() - for num in line.split("#", 1)[0].split() - ] - except ValueError as e: - msg = "Invalid quantization table" - raise ValueError(msg) from e - else: - qtables = [lines[s : s + 64] for s in range(0, len(lines), 64)] - if isinstance(qtables, (tuple, list, dict)): - if isinstance(qtables, dict): - qtables = [ - qtables[key] for key in range(len(qtables)) if key in qtables - ] - elif isinstance(qtables, tuple): - qtables = list(qtables) - if not (0 < len(qtables) < 5): - msg = "None or too many quantization tables" - raise ValueError(msg) - for idx, table in enumerate(qtables): - try: - if len(table) != 64: - raise TypeError - table = array.array("H", table) - except TypeError as e: - msg = "Invalid quantization table" - raise ValueError(msg) from e - else: - qtables[idx] = list(table) - return qtables - - if qtables == "keep": - if im.format != "JPEG": - msg = "Cannot use 'keep' when original image is not a JPEG" - raise ValueError(msg) - qtables = getattr(im, "quantization", None) - qtables = validate_qtables(qtables) - - extra = info.get("extra", b"") - - MAX_BYTES_IN_MARKER = 65533 - icc_profile = info.get("icc_profile") - if icc_profile: - ICC_OVERHEAD_LEN = 14 - MAX_DATA_BYTES_IN_MARKER = MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN - markers = [] - while icc_profile: - markers.append(icc_profile[:MAX_DATA_BYTES_IN_MARKER]) - icc_profile = icc_profile[MAX_DATA_BYTES_IN_MARKER:] - i = 1 - for marker in markers: - size = o16(2 + ICC_OVERHEAD_LEN + len(marker)) - extra += ( - b"\xFF\xE2" - + size - + b"ICC_PROFILE\0" - + o8(i) - + o8(len(markers)) - + marker - ) - i += 1 - - comment = info.get("comment", im.info.get("comment")) - - # "progressive" is the official name, but older documentation - # says "progression" - # FIXME: issue a warning if the wrong form is used (post-1.1.7) - progressive = info.get("progressive", False) or info.get("progression", False) - - optimize = info.get("optimize", False) - - exif = info.get("exif", b"") - if isinstance(exif, Image.Exif): - exif = exif.tobytes() - if len(exif) > MAX_BYTES_IN_MARKER: - msg = "EXIF data is too long" - raise ValueError(msg) - - # get keyword arguments - im.encoderconfig = ( - quality, - progressive, - info.get("smooth", 0), - optimize, - info.get("streamtype", 0), - dpi[0], - dpi[1], - subsampling, - qtables, - comment, - extra, - exif, - ) - - # if we optimize, libjpeg needs a buffer big enough to hold the whole image - # in a shot. Guessing on the size, at im.size bytes. (raw pixel size is - # channels*size, this is a value that's been used in a django patch. - # https://github.com/matthewwithanm/django-imagekit/issues/50 - bufsize = 0 - if optimize or progressive: - # CMYK can be bigger - if im.mode == "CMYK": - bufsize = 4 * im.size[0] * im.size[1] - # keep sets quality to -1, but the actual value may be high. - elif quality >= 95 or quality == -1: - bufsize = 2 * im.size[0] * im.size[1] - else: - bufsize = im.size[0] * im.size[1] - - # The EXIF info needs to be written as one block, + APP1, + one spare byte. - # Ensure that our buffer is big enough. Same with the icc_profile block. - bufsize = max(ImageFile.MAXBLOCK, bufsize, len(exif) + 5, len(extra) + 1) - - ImageFile._save(im, fp, [("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize) - - -def _save_cjpeg(im, fp, filename): - # ALTERNATIVE: handle JPEGs via the IJG command line utilities. - tempfile = im._dump() - subprocess.check_call(["cjpeg", "-outfile", filename, tempfile]) - try: - os.unlink(tempfile) - except OSError: - pass - - -## -# Factory for making JPEG and MPO instances -def jpeg_factory(fp=None, filename=None): - im = JpegImageFile(fp, filename) - try: - mpheader = im._getmp() - if mpheader[45057] > 1: - # It's actually an MPO - from .MpoImagePlugin import MpoImageFile - - # Don't reload everything, just convert it. - im = MpoImageFile.adopt(im, mpheader) - except (TypeError, IndexError): - # It is really a JPEG - pass - except SyntaxError: - warnings.warn( - "Image appears to be a malformed MPO file, it will be " - "interpreted as a base JPEG file" - ) - return im - - -# --------------------------------------------------------------------- -# Registry stuff - -Image.register_open(JpegImageFile.format, jpeg_factory, _accept) -Image.register_save(JpegImageFile.format, _save) - -Image.register_extensions(JpegImageFile.format, [".jfif", ".jpe", ".jpg", ".jpeg"]) - -Image.register_mime(JpegImageFile.format, "image/jpeg") diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/catalogue/__init__.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/catalogue/__init__.py deleted file mode 100644 index f13587f940af23f8e2cf24488a3f6d0bb44c520e..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/catalogue/__init__.py +++ /dev/null @@ -1,244 +0,0 @@ -from typing import Sequence, Any, Dict, Tuple, Callable, Optional, TypeVar, Union -from typing import List -import inspect - -try: # Python 3.8 - import importlib.metadata as importlib_metadata -except ImportError: - from . import _importlib_metadata as importlib_metadata # type: ignore - -# Only ever call this once for performance reasons -AVAILABLE_ENTRY_POINTS = importlib_metadata.entry_points() # type: ignore - -# This is where functions will be registered -REGISTRY: Dict[Tuple[str, ...], Any] = {} - - -InFunc = TypeVar("InFunc") - - -def create(*namespace: str, entry_points: bool = False) -> "Registry": - """Create a new registry. - - *namespace (str): The namespace, e.g. "spacy" or "spacy", "architectures". - entry_points (bool): Accept registered functions from entry points. - RETURNS (Registry): The Registry object. - """ - if check_exists(*namespace): - raise RegistryError(f"Namespace already exists: {namespace}") - return Registry(namespace, entry_points=entry_points) - - -class Registry(object): - def __init__(self, namespace: Sequence[str], entry_points: bool = False) -> None: - """Initialize a new registry. - - namespace (Sequence[str]): The namespace. - entry_points (bool): Whether to also check for entry points. - """ - self.namespace = namespace - self.entry_point_namespace = "_".join(namespace) - self.entry_points = entry_points - - def __contains__(self, name: str) -> bool: - """Check whether a name is in the registry. - - name (str): The name to check. - RETURNS (bool): Whether the name is in the registry. - """ - namespace = tuple(list(self.namespace) + [name]) - has_entry_point = self.entry_points and self.get_entry_point(name) - return has_entry_point or namespace in REGISTRY - - def __call__( - self, name: str, func: Optional[Any] = None - ) -> Callable[[InFunc], InFunc]: - """Register a function for a given namespace. Same as Registry.register. - - name (str): The name to register under the namespace. - func (Any): Optional function to register (if not used as decorator). - RETURNS (Callable): The decorator. - """ - return self.register(name, func=func) - - def register( - self, name: str, *, func: Optional[Any] = None - ) -> Callable[[InFunc], InFunc]: - """Register a function for a given namespace. - - name (str): The name to register under the namespace. - func (Any): Optional function to register (if not used as decorator). - RETURNS (Callable): The decorator. - """ - - def do_registration(func): - _set(list(self.namespace) + [name], func) - return func - - if func is not None: - return do_registration(func) - return do_registration - - def get(self, name: str) -> Any: - """Get the registered function for a given name. - - name (str): The name. - RETURNS (Any): The registered function. - """ - if self.entry_points: - from_entry_point = self.get_entry_point(name) - if from_entry_point: - return from_entry_point - namespace = list(self.namespace) + [name] - if not check_exists(*namespace): - current_namespace = " -> ".join(self.namespace) - available = ", ".join(sorted(self.get_all().keys())) or "none" - raise RegistryError( - f"Cant't find '{name}' in registry {current_namespace}. Available names: {available}" - ) - return _get(namespace) - - def get_all(self) -> Dict[str, Any]: - """Get a all functions for a given namespace. - - namespace (Tuple[str]): The namespace to get. - RETURNS (Dict[str, Any]): The functions, keyed by name. - """ - global REGISTRY - result = {} - if self.entry_points: - result.update(self.get_entry_points()) - for keys, value in REGISTRY.copy().items(): - if len(self.namespace) == len(keys) - 1 and all( - self.namespace[i] == keys[i] for i in range(len(self.namespace)) - ): - result[keys[-1]] = value - return result - - def get_entry_points(self) -> Dict[str, Any]: - """Get registered entry points from other packages for this namespace. - - RETURNS (Dict[str, Any]): Entry points, keyed by name. - """ - result = {} - for entry_point in self._get_entry_points(): - result[entry_point.name] = entry_point.load() - return result - - def get_entry_point(self, name: str, default: Optional[Any] = None) -> Any: - """Check if registered entry point is available for a given name in the - namespace and load it. Otherwise, return the default value. - - name (str): Name of entry point to load. - default (Any): The default value to return. - RETURNS (Any): The loaded entry point or the default value. - """ - for entry_point in self._get_entry_points(): - if entry_point.name == name: - return entry_point.load() - return default - - def _get_entry_points(self) -> List[importlib_metadata.EntryPoint]: - if hasattr(AVAILABLE_ENTRY_POINTS, "select"): - return AVAILABLE_ENTRY_POINTS.select(group=self.entry_point_namespace) - else: # dict - return AVAILABLE_ENTRY_POINTS.get(self.entry_point_namespace, []) - - def find(self, name: str) -> Dict[str, Optional[Union[str, int]]]: - """Find the information about a registered function, including the - module and path to the file it's defined in, the line number and the - docstring, if available. - - name (str): Name of the registered function. - RETURNS (Dict[str, Optional[Union[str, int]]]): The function info. - """ - func = self.get(name) - module = inspect.getmodule(func) - # These calls will fail for Cython modules so we need to work around them - line_no: Optional[int] = None - file_name: Optional[str] = None - try: - _, line_no = inspect.getsourcelines(func) - file_name = inspect.getfile(func) - except (TypeError, ValueError): - pass - docstring = inspect.getdoc(func) - return { - "module": module.__name__ if module else None, - "file": file_name, - "line_no": line_no, - "docstring": inspect.cleandoc(docstring) if docstring else None, - } - - -def check_exists(*namespace: str) -> bool: - """Check if a namespace exists. - - *namespace (str): The namespace. - RETURNS (bool): Whether the namespace exists. - """ - return namespace in REGISTRY - - -def _get(namespace: Sequence[str]) -> Any: - """Get the value for a given namespace. - - namespace (Sequence[str]): The namespace. - RETURNS (Any): The value for the namespace. - """ - global REGISTRY - if not all(isinstance(name, str) for name in namespace): - raise ValueError( - f"Invalid namespace. Expected tuple of strings, but got: {namespace}" - ) - namespace = tuple(namespace) - if namespace not in REGISTRY: - raise RegistryError(f"Can't get namespace {namespace} (not in registry)") - return REGISTRY[namespace] - - -def _get_all(namespace: Sequence[str]) -> Dict[Tuple[str, ...], Any]: - """Get all matches for a given namespace, e.g. ("a", "b", "c") and - ("a", "b") for namespace ("a", "b"). - - namespace (Sequence[str]): The namespace. - RETURNS (Dict[Tuple[str], Any]): All entries for the namespace, keyed - by their full namespaces. - """ - global REGISTRY - result = {} - for keys, value in REGISTRY.copy().items(): - if len(namespace) <= len(keys) and all( - namespace[i] == keys[i] for i in range(len(namespace)) - ): - result[keys] = value - return result - - -def _set(namespace: Sequence[str], func: Any) -> None: - """Set a value for a given namespace. - - namespace (Sequence[str]): The namespace. - func (Callable): The value to set. - """ - global REGISTRY - REGISTRY[tuple(namespace)] = func - - -def _remove(namespace: Sequence[str]) -> Any: - """Remove a value for a given namespace. - - namespace (Sequence[str]): The namespace. - RETURNS (Any): The removed value. - """ - global REGISTRY - namespace = tuple(namespace) - if namespace not in REGISTRY: - raise RegistryError(f"Can't get namespace {namespace} (not in registry)") - removed = REGISTRY[namespace] - del REGISTRY[namespace] - return removed - - -class RegistryError(ValueError): - pass diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/click/core.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/click/core.py deleted file mode 100644 index cc65e896bf2d754d74b54a84ac501b80127f83ca..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/click/core.py +++ /dev/null @@ -1,3042 +0,0 @@ -import enum -import errno -import inspect -import os -import sys -import typing as t -from collections import abc -from contextlib import contextmanager -from contextlib import ExitStack -from functools import update_wrapper -from gettext import gettext as _ -from gettext import ngettext -from itertools import repeat -from types import TracebackType - -from . import types -from .exceptions import Abort -from .exceptions import BadParameter -from .exceptions import ClickException -from .exceptions import Exit -from .exceptions import MissingParameter -from .exceptions import UsageError -from .formatting import HelpFormatter -from .formatting import join_options -from .globals import pop_context -from .globals import push_context -from .parser import _flag_needs_value -from .parser import OptionParser -from .parser import split_opt -from .termui import confirm -from .termui import prompt -from .termui import style -from .utils import _detect_program_name -from .utils import _expand_args -from .utils import echo -from .utils import make_default_short_help -from .utils import make_str -from .utils import PacifyFlushWrapper - -if t.TYPE_CHECKING: - import typing_extensions as te - from .shell_completion import CompletionItem - -F = t.TypeVar("F", bound=t.Callable[..., t.Any]) -V = t.TypeVar("V") - - -def _complete_visible_commands( - ctx: "Context", incomplete: str -) -> t.Iterator[t.Tuple[str, "Command"]]: - """List all the subcommands of a group that start with the - incomplete value and aren't hidden. - - :param ctx: Invocation context for the group. - :param incomplete: Value being completed. May be empty. - """ - multi = t.cast(MultiCommand, ctx.command) - - for name in multi.list_commands(ctx): - if name.startswith(incomplete): - command = multi.get_command(ctx, name) - - if command is not None and not command.hidden: - yield name, command - - -def _check_multicommand( - base_command: "MultiCommand", cmd_name: str, cmd: "Command", register: bool = False -) -> None: - if not base_command.chain or not isinstance(cmd, MultiCommand): - return - if register: - hint = ( - "It is not possible to add multi commands as children to" - " another multi command that is in chain mode." - ) - else: - hint = ( - "Found a multi command as subcommand to a multi command" - " that is in chain mode. This is not supported." - ) - raise RuntimeError( - f"{hint}. Command {base_command.name!r} is set to chain and" - f" {cmd_name!r} was added as a subcommand but it in itself is a" - f" multi command. ({cmd_name!r} is a {type(cmd).__name__}" - f" within a chained {type(base_command).__name__} named" - f" {base_command.name!r})." - ) - - -def batch(iterable: t.Iterable[V], batch_size: int) -> t.List[t.Tuple[V, ...]]: - return list(zip(*repeat(iter(iterable), batch_size))) - - -@contextmanager -def augment_usage_errors( - ctx: "Context", param: t.Optional["Parameter"] = None -) -> t.Iterator[None]: - """Context manager that attaches extra information to exceptions.""" - try: - yield - except BadParameter as e: - if e.ctx is None: - e.ctx = ctx - if param is not None and e.param is None: - e.param = param - raise - except UsageError as e: - if e.ctx is None: - e.ctx = ctx - raise - - -def iter_params_for_processing( - invocation_order: t.Sequence["Parameter"], - declaration_order: t.Sequence["Parameter"], -) -> t.List["Parameter"]: - """Given a sequence of parameters in the order as should be considered - for processing and an iterable of parameters that exist, this returns - a list in the correct order as they should be processed. - """ - - def sort_key(item: "Parameter") -> t.Tuple[bool, float]: - try: - idx: float = invocation_order.index(item) - except ValueError: - idx = float("inf") - - return not item.is_eager, idx - - return sorted(declaration_order, key=sort_key) - - -class ParameterSource(enum.Enum): - """This is an :class:`~enum.Enum` that indicates the source of a - parameter's value. - - Use :meth:`click.Context.get_parameter_source` to get the - source for a parameter by name. - - .. versionchanged:: 8.0 - Use :class:`~enum.Enum` and drop the ``validate`` method. - - .. versionchanged:: 8.0 - Added the ``PROMPT`` value. - """ - - COMMANDLINE = enum.auto() - """The value was provided by the command line args.""" - ENVIRONMENT = enum.auto() - """The value was provided with an environment variable.""" - DEFAULT = enum.auto() - """Used the default specified by the parameter.""" - DEFAULT_MAP = enum.auto() - """Used a default provided by :attr:`Context.default_map`.""" - PROMPT = enum.auto() - """Used a prompt to confirm a default or provide a value.""" - - -class Context: - """The context is a special internal object that holds state relevant - for the script execution at every single level. It's normally invisible - to commands unless they opt-in to getting access to it. - - The context is useful as it can pass internal objects around and can - control special execution features such as reading data from - environment variables. - - A context can be used as context manager in which case it will call - :meth:`close` on teardown. - - :param command: the command class for this context. - :param parent: the parent context. - :param info_name: the info name for this invocation. Generally this - is the most descriptive name for the script or - command. For the toplevel script it is usually - the name of the script, for commands below it it's - the name of the script. - :param obj: an arbitrary object of user data. - :param auto_envvar_prefix: the prefix to use for automatic environment - variables. If this is `None` then reading - from environment variables is disabled. This - does not affect manually set environment - variables which are always read. - :param default_map: a dictionary (like object) with default values - for parameters. - :param terminal_width: the width of the terminal. The default is - inherit from parent context. If no context - defines the terminal width then auto - detection will be applied. - :param max_content_width: the maximum width for content rendered by - Click (this currently only affects help - pages). This defaults to 80 characters if - not overridden. In other words: even if the - terminal is larger than that, Click will not - format things wider than 80 characters by - default. In addition to that, formatters might - add some safety mapping on the right. - :param resilient_parsing: if this flag is enabled then Click will - parse without any interactivity or callback - invocation. Default values will also be - ignored. This is useful for implementing - things such as completion support. - :param allow_extra_args: if this is set to `True` then extra arguments - at the end will not raise an error and will be - kept on the context. The default is to inherit - from the command. - :param allow_interspersed_args: if this is set to `False` then options - and arguments cannot be mixed. The - default is to inherit from the command. - :param ignore_unknown_options: instructs click to ignore options it does - not know and keeps them for later - processing. - :param help_option_names: optionally a list of strings that define how - the default help parameter is named. The - default is ``['--help']``. - :param token_normalize_func: an optional function that is used to - normalize tokens (options, choices, - etc.). This for instance can be used to - implement case insensitive behavior. - :param color: controls if the terminal supports ANSI colors or not. The - default is autodetection. This is only needed if ANSI - codes are used in texts that Click prints which is by - default not the case. This for instance would affect - help output. - :param show_default: Show the default value for commands. If this - value is not set, it defaults to the value from the parent - context. ``Command.show_default`` overrides this default for the - specific command. - - .. versionchanged:: 8.1 - The ``show_default`` parameter is overridden by - ``Command.show_default``, instead of the other way around. - - .. versionchanged:: 8.0 - The ``show_default`` parameter defaults to the value from the - parent context. - - .. versionchanged:: 7.1 - Added the ``show_default`` parameter. - - .. versionchanged:: 4.0 - Added the ``color``, ``ignore_unknown_options``, and - ``max_content_width`` parameters. - - .. versionchanged:: 3.0 - Added the ``allow_extra_args`` and ``allow_interspersed_args`` - parameters. - - .. versionchanged:: 2.0 - Added the ``resilient_parsing``, ``help_option_names``, and - ``token_normalize_func`` parameters. - """ - - #: The formatter class to create with :meth:`make_formatter`. - #: - #: .. versionadded:: 8.0 - formatter_class: t.Type["HelpFormatter"] = HelpFormatter - - def __init__( - self, - command: "Command", - parent: t.Optional["Context"] = None, - info_name: t.Optional[str] = None, - obj: t.Optional[t.Any] = None, - auto_envvar_prefix: t.Optional[str] = None, - default_map: t.Optional[t.MutableMapping[str, t.Any]] = None, - terminal_width: t.Optional[int] = None, - max_content_width: t.Optional[int] = None, - resilient_parsing: bool = False, - allow_extra_args: t.Optional[bool] = None, - allow_interspersed_args: t.Optional[bool] = None, - ignore_unknown_options: t.Optional[bool] = None, - help_option_names: t.Optional[t.List[str]] = None, - token_normalize_func: t.Optional[t.Callable[[str], str]] = None, - color: t.Optional[bool] = None, - show_default: t.Optional[bool] = None, - ) -> None: - #: the parent context or `None` if none exists. - self.parent = parent - #: the :class:`Command` for this context. - self.command = command - #: the descriptive information name - self.info_name = info_name - #: Map of parameter names to their parsed values. Parameters - #: with ``expose_value=False`` are not stored. - self.params: t.Dict[str, t.Any] = {} - #: the leftover arguments. - self.args: t.List[str] = [] - #: protected arguments. These are arguments that are prepended - #: to `args` when certain parsing scenarios are encountered but - #: must be never propagated to another arguments. This is used - #: to implement nested parsing. - self.protected_args: t.List[str] = [] - #: the collected prefixes of the command's options. - self._opt_prefixes: t.Set[str] = set(parent._opt_prefixes) if parent else set() - - if obj is None and parent is not None: - obj = parent.obj - - #: the user object stored. - self.obj: t.Any = obj - self._meta: t.Dict[str, t.Any] = getattr(parent, "meta", {}) - - #: A dictionary (-like object) with defaults for parameters. - if ( - default_map is None - and info_name is not None - and parent is not None - and parent.default_map is not None - ): - default_map = parent.default_map.get(info_name) - - self.default_map: t.Optional[t.MutableMapping[str, t.Any]] = default_map - - #: This flag indicates if a subcommand is going to be executed. A - #: group callback can use this information to figure out if it's - #: being executed directly or because the execution flow passes - #: onwards to a subcommand. By default it's None, but it can be - #: the name of the subcommand to execute. - #: - #: If chaining is enabled this will be set to ``'*'`` in case - #: any commands are executed. It is however not possible to - #: figure out which ones. If you require this knowledge you - #: should use a :func:`result_callback`. - self.invoked_subcommand: t.Optional[str] = None - - if terminal_width is None and parent is not None: - terminal_width = parent.terminal_width - - #: The width of the terminal (None is autodetection). - self.terminal_width: t.Optional[int] = terminal_width - - if max_content_width is None and parent is not None: - max_content_width = parent.max_content_width - - #: The maximum width of formatted content (None implies a sensible - #: default which is 80 for most things). - self.max_content_width: t.Optional[int] = max_content_width - - if allow_extra_args is None: - allow_extra_args = command.allow_extra_args - - #: Indicates if the context allows extra args or if it should - #: fail on parsing. - #: - #: .. versionadded:: 3.0 - self.allow_extra_args = allow_extra_args - - if allow_interspersed_args is None: - allow_interspersed_args = command.allow_interspersed_args - - #: Indicates if the context allows mixing of arguments and - #: options or not. - #: - #: .. versionadded:: 3.0 - self.allow_interspersed_args: bool = allow_interspersed_args - - if ignore_unknown_options is None: - ignore_unknown_options = command.ignore_unknown_options - - #: Instructs click to ignore options that a command does not - #: understand and will store it on the context for later - #: processing. This is primarily useful for situations where you - #: want to call into external programs. Generally this pattern is - #: strongly discouraged because it's not possibly to losslessly - #: forward all arguments. - #: - #: .. versionadded:: 4.0 - self.ignore_unknown_options: bool = ignore_unknown_options - - if help_option_names is None: - if parent is not None: - help_option_names = parent.help_option_names - else: - help_option_names = ["--help"] - - #: The names for the help options. - self.help_option_names: t.List[str] = help_option_names - - if token_normalize_func is None and parent is not None: - token_normalize_func = parent.token_normalize_func - - #: An optional normalization function for tokens. This is - #: options, choices, commands etc. - self.token_normalize_func: t.Optional[ - t.Callable[[str], str] - ] = token_normalize_func - - #: Indicates if resilient parsing is enabled. In that case Click - #: will do its best to not cause any failures and default values - #: will be ignored. Useful for completion. - self.resilient_parsing: bool = resilient_parsing - - # If there is no envvar prefix yet, but the parent has one and - # the command on this level has a name, we can expand the envvar - # prefix automatically. - if auto_envvar_prefix is None: - if ( - parent is not None - and parent.auto_envvar_prefix is not None - and self.info_name is not None - ): - auto_envvar_prefix = ( - f"{parent.auto_envvar_prefix}_{self.info_name.upper()}" - ) - else: - auto_envvar_prefix = auto_envvar_prefix.upper() - - if auto_envvar_prefix is not None: - auto_envvar_prefix = auto_envvar_prefix.replace("-", "_") - - self.auto_envvar_prefix: t.Optional[str] = auto_envvar_prefix - - if color is None and parent is not None: - color = parent.color - - #: Controls if styling output is wanted or not. - self.color: t.Optional[bool] = color - - if show_default is None and parent is not None: - show_default = parent.show_default - - #: Show option default values when formatting help text. - self.show_default: t.Optional[bool] = show_default - - self._close_callbacks: t.List[t.Callable[[], t.Any]] = [] - self._depth = 0 - self._parameter_source: t.Dict[str, ParameterSource] = {} - self._exit_stack = ExitStack() - - def to_info_dict(self) -> t.Dict[str, t.Any]: - """Gather information that could be useful for a tool generating - user-facing documentation. This traverses the entire CLI - structure. - - .. code-block:: python - - with Context(cli) as ctx: - info = ctx.to_info_dict() - - .. versionadded:: 8.0 - """ - return { - "command": self.command.to_info_dict(self), - "info_name": self.info_name, - "allow_extra_args": self.allow_extra_args, - "allow_interspersed_args": self.allow_interspersed_args, - "ignore_unknown_options": self.ignore_unknown_options, - "auto_envvar_prefix": self.auto_envvar_prefix, - } - - def __enter__(self) -> "Context": - self._depth += 1 - push_context(self) - return self - - def __exit__( - self, - exc_type: t.Optional[t.Type[BaseException]], - exc_value: t.Optional[BaseException], - tb: t.Optional[TracebackType], - ) -> None: - self._depth -= 1 - if self._depth == 0: - self.close() - pop_context() - - @contextmanager - def scope(self, cleanup: bool = True) -> t.Iterator["Context"]: - """This helper method can be used with the context object to promote - it to the current thread local (see :func:`get_current_context`). - The default behavior of this is to invoke the cleanup functions which - can be disabled by setting `cleanup` to `False`. The cleanup - functions are typically used for things such as closing file handles. - - If the cleanup is intended the context object can also be directly - used as a context manager. - - Example usage:: - - with ctx.scope(): - assert get_current_context() is ctx - - This is equivalent:: - - with ctx: - assert get_current_context() is ctx - - .. versionadded:: 5.0 - - :param cleanup: controls if the cleanup functions should be run or - not. The default is to run these functions. In - some situations the context only wants to be - temporarily pushed in which case this can be disabled. - Nested pushes automatically defer the cleanup. - """ - if not cleanup: - self._depth += 1 - try: - with self as rv: - yield rv - finally: - if not cleanup: - self._depth -= 1 - - @property - def meta(self) -> t.Dict[str, t.Any]: - """This is a dictionary which is shared with all the contexts - that are nested. It exists so that click utilities can store some - state here if they need to. It is however the responsibility of - that code to manage this dictionary well. - - The keys are supposed to be unique dotted strings. For instance - module paths are a good choice for it. What is stored in there is - irrelevant for the operation of click. However what is important is - that code that places data here adheres to the general semantics of - the system. - - Example usage:: - - LANG_KEY = f'{__name__}.lang' - - def set_language(value): - ctx = get_current_context() - ctx.meta[LANG_KEY] = value - - def get_language(): - return get_current_context().meta.get(LANG_KEY, 'en_US') - - .. versionadded:: 5.0 - """ - return self._meta - - def make_formatter(self) -> HelpFormatter: - """Creates the :class:`~click.HelpFormatter` for the help and - usage output. - - To quickly customize the formatter class used without overriding - this method, set the :attr:`formatter_class` attribute. - - .. versionchanged:: 8.0 - Added the :attr:`formatter_class` attribute. - """ - return self.formatter_class( - width=self.terminal_width, max_width=self.max_content_width - ) - - def with_resource(self, context_manager: t.ContextManager[V]) -> V: - """Register a resource as if it were used in a ``with`` - statement. The resource will be cleaned up when the context is - popped. - - Uses :meth:`contextlib.ExitStack.enter_context`. It calls the - resource's ``__enter__()`` method and returns the result. When - the context is popped, it closes the stack, which calls the - resource's ``__exit__()`` method. - - To register a cleanup function for something that isn't a - context manager, use :meth:`call_on_close`. Or use something - from :mod:`contextlib` to turn it into a context manager first. - - .. code-block:: python - - @click.group() - @click.option("--name") - @click.pass_context - def cli(ctx): - ctx.obj = ctx.with_resource(connect_db(name)) - - :param context_manager: The context manager to enter. - :return: Whatever ``context_manager.__enter__()`` returns. - - .. versionadded:: 8.0 - """ - return self._exit_stack.enter_context(context_manager) - - def call_on_close(self, f: t.Callable[..., t.Any]) -> t.Callable[..., t.Any]: - """Register a function to be called when the context tears down. - - This can be used to close resources opened during the script - execution. Resources that support Python's context manager - protocol which would be used in a ``with`` statement should be - registered with :meth:`with_resource` instead. - - :param f: The function to execute on teardown. - """ - return self._exit_stack.callback(f) - - def close(self) -> None: - """Invoke all close callbacks registered with - :meth:`call_on_close`, and exit all context managers entered - with :meth:`with_resource`. - """ - self._exit_stack.close() - # In case the context is reused, create a new exit stack. - self._exit_stack = ExitStack() - - @property - def command_path(self) -> str: - """The computed command path. This is used for the ``usage`` - information on the help page. It's automatically created by - combining the info names of the chain of contexts to the root. - """ - rv = "" - if self.info_name is not None: - rv = self.info_name - if self.parent is not None: - parent_command_path = [self.parent.command_path] - - if isinstance(self.parent.command, Command): - for param in self.parent.command.get_params(self): - parent_command_path.extend(param.get_usage_pieces(self)) - - rv = f"{' '.join(parent_command_path)} {rv}" - return rv.lstrip() - - def find_root(self) -> "Context": - """Finds the outermost context.""" - node = self - while node.parent is not None: - node = node.parent - return node - - def find_object(self, object_type: t.Type[V]) -> t.Optional[V]: - """Finds the closest object of a given type.""" - node: t.Optional["Context"] = self - - while node is not None: - if isinstance(node.obj, object_type): - return node.obj - - node = node.parent - - return None - - def ensure_object(self, object_type: t.Type[V]) -> V: - """Like :meth:`find_object` but sets the innermost object to a - new instance of `object_type` if it does not exist. - """ - rv = self.find_object(object_type) - if rv is None: - self.obj = rv = object_type() - return rv - - @t.overload - def lookup_default( - self, name: str, call: "te.Literal[True]" = True - ) -> t.Optional[t.Any]: - ... - - @t.overload - def lookup_default( - self, name: str, call: "te.Literal[False]" = ... - ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: - ... - - def lookup_default(self, name: str, call: bool = True) -> t.Optional[t.Any]: - """Get the default for a parameter from :attr:`default_map`. - - :param name: Name of the parameter. - :param call: If the default is a callable, call it. Disable to - return the callable instead. - - .. versionchanged:: 8.0 - Added the ``call`` parameter. - """ - if self.default_map is not None: - value = self.default_map.get(name) - - if call and callable(value): - return value() - - return value - - return None - - def fail(self, message: str) -> "te.NoReturn": - """Aborts the execution of the program with a specific error - message. - - :param message: the error message to fail with. - """ - raise UsageError(message, self) - - def abort(self) -> "te.NoReturn": - """Aborts the script.""" - raise Abort() - - def exit(self, code: int = 0) -> "te.NoReturn": - """Exits the application with a given exit code.""" - raise Exit(code) - - def get_usage(self) -> str: - """Helper method to get formatted usage string for the current - context and command. - """ - return self.command.get_usage(self) - - def get_help(self) -> str: - """Helper method to get formatted help page for the current - context and command. - """ - return self.command.get_help(self) - - def _make_sub_context(self, command: "Command") -> "Context": - """Create a new context of the same type as this context, but - for a new command. - - :meta private: - """ - return type(self)(command, info_name=command.name, parent=self) - - @t.overload - def invoke( - __self, # noqa: B902 - __callback: "t.Callable[..., V]", - *args: t.Any, - **kwargs: t.Any, - ) -> V: - ... - - @t.overload - def invoke( - __self, # noqa: B902 - __callback: "Command", - *args: t.Any, - **kwargs: t.Any, - ) -> t.Any: - ... - - def invoke( - __self, # noqa: B902 - __callback: t.Union["Command", "t.Callable[..., V]"], - *args: t.Any, - **kwargs: t.Any, - ) -> t.Union[t.Any, V]: - """Invokes a command callback in exactly the way it expects. There - are two ways to invoke this method: - - 1. the first argument can be a callback and all other arguments and - keyword arguments are forwarded directly to the function. - 2. the first argument is a click command object. In that case all - arguments are forwarded as well but proper click parameters - (options and click arguments) must be keyword arguments and Click - will fill in defaults. - - Note that before Click 3.2 keyword arguments were not properly filled - in against the intention of this code and no context was created. For - more information about this change and why it was done in a bugfix - release see :ref:`upgrade-to-3.2`. - - .. versionchanged:: 8.0 - All ``kwargs`` are tracked in :attr:`params` so they will be - passed if :meth:`forward` is called at multiple levels. - """ - if isinstance(__callback, Command): - other_cmd = __callback - - if other_cmd.callback is None: - raise TypeError( - "The given command does not have a callback that can be invoked." - ) - else: - __callback = t.cast("t.Callable[..., V]", other_cmd.callback) - - ctx = __self._make_sub_context(other_cmd) - - for param in other_cmd.params: - if param.name not in kwargs and param.expose_value: - kwargs[param.name] = param.type_cast_value( # type: ignore - ctx, param.get_default(ctx) - ) - - # Track all kwargs as params, so that forward() will pass - # them on in subsequent calls. - ctx.params.update(kwargs) - else: - ctx = __self - - with augment_usage_errors(__self): - with ctx: - return __callback(*args, **kwargs) - - def forward( - __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any # noqa: B902 - ) -> t.Any: - """Similar to :meth:`invoke` but fills in default keyword - arguments from the current context if the other command expects - it. This cannot invoke callbacks directly, only other commands. - - .. versionchanged:: 8.0 - All ``kwargs`` are tracked in :attr:`params` so they will be - passed if ``forward`` is called at multiple levels. - """ - # Can only forward to other commands, not direct callbacks. - if not isinstance(__cmd, Command): - raise TypeError("Callback is not a command.") - - for param in __self.params: - if param not in kwargs: - kwargs[param] = __self.params[param] - - return __self.invoke(__cmd, *args, **kwargs) - - def set_parameter_source(self, name: str, source: ParameterSource) -> None: - """Set the source of a parameter. This indicates the location - from which the value of the parameter was obtained. - - :param name: The name of the parameter. - :param source: A member of :class:`~click.core.ParameterSource`. - """ - self._parameter_source[name] = source - - def get_parameter_source(self, name: str) -> t.Optional[ParameterSource]: - """Get the source of a parameter. This indicates the location - from which the value of the parameter was obtained. - - This can be useful for determining when a user specified a value - on the command line that is the same as the default value. It - will be :attr:`~click.core.ParameterSource.DEFAULT` only if the - value was actually taken from the default. - - :param name: The name of the parameter. - :rtype: ParameterSource - - .. versionchanged:: 8.0 - Returns ``None`` if the parameter was not provided from any - source. - """ - return self._parameter_source.get(name) - - -class BaseCommand: - """The base command implements the minimal API contract of commands. - Most code will never use this as it does not implement a lot of useful - functionality but it can act as the direct subclass of alternative - parsing methods that do not depend on the Click parser. - - For instance, this can be used to bridge Click and other systems like - argparse or docopt. - - Because base commands do not implement a lot of the API that other - parts of Click take for granted, they are not supported for all - operations. For instance, they cannot be used with the decorators - usually and they have no built-in callback system. - - .. versionchanged:: 2.0 - Added the `context_settings` parameter. - - :param name: the name of the command to use unless a group overrides it. - :param context_settings: an optional dictionary with defaults that are - passed to the context object. - """ - - #: The context class to create with :meth:`make_context`. - #: - #: .. versionadded:: 8.0 - context_class: t.Type[Context] = Context - #: the default for the :attr:`Context.allow_extra_args` flag. - allow_extra_args = False - #: the default for the :attr:`Context.allow_interspersed_args` flag. - allow_interspersed_args = True - #: the default for the :attr:`Context.ignore_unknown_options` flag. - ignore_unknown_options = False - - def __init__( - self, - name: t.Optional[str], - context_settings: t.Optional[t.MutableMapping[str, t.Any]] = None, - ) -> None: - #: the name the command thinks it has. Upon registering a command - #: on a :class:`Group` the group will default the command name - #: with this information. You should instead use the - #: :class:`Context`\'s :attr:`~Context.info_name` attribute. - self.name = name - - if context_settings is None: - context_settings = {} - - #: an optional dictionary with defaults passed to the context. - self.context_settings: t.MutableMapping[str, t.Any] = context_settings - - def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: - """Gather information that could be useful for a tool generating - user-facing documentation. This traverses the entire structure - below this command. - - Use :meth:`click.Context.to_info_dict` to traverse the entire - CLI structure. - - :param ctx: A :class:`Context` representing this command. - - .. versionadded:: 8.0 - """ - return {"name": self.name} - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.name}>" - - def get_usage(self, ctx: Context) -> str: - raise NotImplementedError("Base commands cannot get usage") - - def get_help(self, ctx: Context) -> str: - raise NotImplementedError("Base commands cannot get help") - - def make_context( - self, - info_name: t.Optional[str], - args: t.List[str], - parent: t.Optional[Context] = None, - **extra: t.Any, - ) -> Context: - """This function when given an info name and arguments will kick - off the parsing and create a new :class:`Context`. It does not - invoke the actual command callback though. - - To quickly customize the context class used without overriding - this method, set the :attr:`context_class` attribute. - - :param info_name: the info name for this invocation. Generally this - is the most descriptive name for the script or - command. For the toplevel script it's usually - the name of the script, for commands below it's - the name of the command. - :param args: the arguments to parse as list of strings. - :param parent: the parent context if available. - :param extra: extra keyword arguments forwarded to the context - constructor. - - .. versionchanged:: 8.0 - Added the :attr:`context_class` attribute. - """ - for key, value in self.context_settings.items(): - if key not in extra: - extra[key] = value - - ctx = self.context_class( - self, info_name=info_name, parent=parent, **extra # type: ignore - ) - - with ctx.scope(cleanup=False): - self.parse_args(ctx, args) - return ctx - - def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: - """Given a context and a list of arguments this creates the parser - and parses the arguments, then modifies the context as necessary. - This is automatically invoked by :meth:`make_context`. - """ - raise NotImplementedError("Base commands do not know how to parse arguments.") - - def invoke(self, ctx: Context) -> t.Any: - """Given a context, this invokes the command. The default - implementation is raising a not implemented error. - """ - raise NotImplementedError("Base commands are not invocable by default") - - def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: - """Return a list of completions for the incomplete value. Looks - at the names of chained multi-commands. - - Any command could be part of a chained multi-command, so sibling - commands are valid at any point during command completion. Other - command classes will return more completions. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - results: t.List["CompletionItem"] = [] - - while ctx.parent is not None: - ctx = ctx.parent - - if isinstance(ctx.command, MultiCommand) and ctx.command.chain: - results.extend( - CompletionItem(name, help=command.get_short_help_str()) - for name, command in _complete_visible_commands(ctx, incomplete) - if name not in ctx.protected_args - ) - - return results - - @t.overload - def main( - self, - args: t.Optional[t.Sequence[str]] = None, - prog_name: t.Optional[str] = None, - complete_var: t.Optional[str] = None, - standalone_mode: "te.Literal[True]" = True, - **extra: t.Any, - ) -> "te.NoReturn": - ... - - @t.overload - def main( - self, - args: t.Optional[t.Sequence[str]] = None, - prog_name: t.Optional[str] = None, - complete_var: t.Optional[str] = None, - standalone_mode: bool = ..., - **extra: t.Any, - ) -> t.Any: - ... - - def main( - self, - args: t.Optional[t.Sequence[str]] = None, - prog_name: t.Optional[str] = None, - complete_var: t.Optional[str] = None, - standalone_mode: bool = True, - windows_expand_args: bool = True, - **extra: t.Any, - ) -> t.Any: - """This is the way to invoke a script with all the bells and - whistles as a command line application. This will always terminate - the application after a call. If this is not wanted, ``SystemExit`` - needs to be caught. - - This method is also available by directly calling the instance of - a :class:`Command`. - - :param args: the arguments that should be used for parsing. If not - provided, ``sys.argv[1:]`` is used. - :param prog_name: the program name that should be used. By default - the program name is constructed by taking the file - name from ``sys.argv[0]``. - :param complete_var: the environment variable that controls the - bash completion support. The default is - ``"__COMPLETE"`` with prog_name in - uppercase. - :param standalone_mode: the default behavior is to invoke the script - in standalone mode. Click will then - handle exceptions and convert them into - error messages and the function will never - return but shut down the interpreter. If - this is set to `False` they will be - propagated to the caller and the return - value of this function is the return value - of :meth:`invoke`. - :param windows_expand_args: Expand glob patterns, user dir, and - env vars in command line args on Windows. - :param extra: extra keyword arguments are forwarded to the context - constructor. See :class:`Context` for more information. - - .. versionchanged:: 8.0.1 - Added the ``windows_expand_args`` parameter to allow - disabling command line arg expansion on Windows. - - .. versionchanged:: 8.0 - When taking arguments from ``sys.argv`` on Windows, glob - patterns, user dir, and env vars are expanded. - - .. versionchanged:: 3.0 - Added the ``standalone_mode`` parameter. - """ - if args is None: - args = sys.argv[1:] - - if os.name == "nt" and windows_expand_args: - args = _expand_args(args) - else: - args = list(args) - - if prog_name is None: - prog_name = _detect_program_name() - - # Process shell completion requests and exit early. - self._main_shell_completion(extra, prog_name, complete_var) - - try: - try: - with self.make_context(prog_name, args, **extra) as ctx: - rv = self.invoke(ctx) - if not standalone_mode: - return rv - # it's not safe to `ctx.exit(rv)` here! - # note that `rv` may actually contain data like "1" which - # has obvious effects - # more subtle case: `rv=[None, None]` can come out of - # chained commands which all returned `None` -- so it's not - # even always obvious that `rv` indicates success/failure - # by its truthiness/falsiness - ctx.exit() - except (EOFError, KeyboardInterrupt) as e: - echo(file=sys.stderr) - raise Abort() from e - except ClickException as e: - if not standalone_mode: - raise - e.show() - sys.exit(e.exit_code) - except OSError as e: - if e.errno == errno.EPIPE: - sys.stdout = t.cast(t.TextIO, PacifyFlushWrapper(sys.stdout)) - sys.stderr = t.cast(t.TextIO, PacifyFlushWrapper(sys.stderr)) - sys.exit(1) - else: - raise - except Exit as e: - if standalone_mode: - sys.exit(e.exit_code) - else: - # in non-standalone mode, return the exit code - # note that this is only reached if `self.invoke` above raises - # an Exit explicitly -- thus bypassing the check there which - # would return its result - # the results of non-standalone execution may therefore be - # somewhat ambiguous: if there are codepaths which lead to - # `ctx.exit(1)` and to `return 1`, the caller won't be able to - # tell the difference between the two - return e.exit_code - except Abort: - if not standalone_mode: - raise - echo(_("Aborted!"), file=sys.stderr) - sys.exit(1) - - def _main_shell_completion( - self, - ctx_args: t.MutableMapping[str, t.Any], - prog_name: str, - complete_var: t.Optional[str] = None, - ) -> None: - """Check if the shell is asking for tab completion, process - that, then exit early. Called from :meth:`main` before the - program is invoked. - - :param prog_name: Name of the executable in the shell. - :param complete_var: Name of the environment variable that holds - the completion instruction. Defaults to - ``_{PROG_NAME}_COMPLETE``. - - .. versionchanged:: 8.2.0 - Dots (``.``) in ``prog_name`` are replaced with underscores (``_``). - """ - if complete_var is None: - complete_name = prog_name.replace("-", "_").replace(".", "_") - complete_var = f"_{complete_name}_COMPLETE".upper() - - instruction = os.environ.get(complete_var) - - if not instruction: - return - - from .shell_completion import shell_complete - - rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction) - sys.exit(rv) - - def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any: - """Alias for :meth:`main`.""" - return self.main(*args, **kwargs) - - -class Command(BaseCommand): - """Commands are the basic building block of command line interfaces in - Click. A basic command handles command line parsing and might dispatch - more parsing to commands nested below it. - - :param name: the name of the command to use unless a group overrides it. - :param context_settings: an optional dictionary with defaults that are - passed to the context object. - :param callback: the callback to invoke. This is optional. - :param params: the parameters to register with this command. This can - be either :class:`Option` or :class:`Argument` objects. - :param help: the help string to use for this command. - :param epilog: like the help string but it's printed at the end of the - help page after everything else. - :param short_help: the short help to use for this command. This is - shown on the command listing of the parent command. - :param add_help_option: by default each command registers a ``--help`` - option. This can be disabled by this parameter. - :param no_args_is_help: this controls what happens if no arguments are - provided. This option is disabled by default. - If enabled this will add ``--help`` as argument - if no arguments are passed - :param hidden: hide this command from help outputs. - - :param deprecated: issues a message indicating that - the command is deprecated. - - .. versionchanged:: 8.1 - ``help``, ``epilog``, and ``short_help`` are stored unprocessed, - all formatting is done when outputting help text, not at init, - and is done even if not using the ``@command`` decorator. - - .. versionchanged:: 8.0 - Added a ``repr`` showing the command name. - - .. versionchanged:: 7.1 - Added the ``no_args_is_help`` parameter. - - .. versionchanged:: 2.0 - Added the ``context_settings`` parameter. - """ - - def __init__( - self, - name: t.Optional[str], - context_settings: t.Optional[t.MutableMapping[str, t.Any]] = None, - callback: t.Optional[t.Callable[..., t.Any]] = None, - params: t.Optional[t.List["Parameter"]] = None, - help: t.Optional[str] = None, - epilog: t.Optional[str] = None, - short_help: t.Optional[str] = None, - options_metavar: t.Optional[str] = "[OPTIONS]", - add_help_option: bool = True, - no_args_is_help: bool = False, - hidden: bool = False, - deprecated: bool = False, - ) -> None: - super().__init__(name, context_settings) - #: the callback to execute when the command fires. This might be - #: `None` in which case nothing happens. - self.callback = callback - #: the list of parameters for this command in the order they - #: should show up in the help page and execute. Eager parameters - #: will automatically be handled before non eager ones. - self.params: t.List["Parameter"] = params or [] - self.help = help - self.epilog = epilog - self.options_metavar = options_metavar - self.short_help = short_help - self.add_help_option = add_help_option - self.no_args_is_help = no_args_is_help - self.hidden = hidden - self.deprecated = deprecated - - def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: - info_dict = super().to_info_dict(ctx) - info_dict.update( - params=[param.to_info_dict() for param in self.get_params(ctx)], - help=self.help, - epilog=self.epilog, - short_help=self.short_help, - hidden=self.hidden, - deprecated=self.deprecated, - ) - return info_dict - - def get_usage(self, ctx: Context) -> str: - """Formats the usage line into a string and returns it. - - Calls :meth:`format_usage` internally. - """ - formatter = ctx.make_formatter() - self.format_usage(ctx, formatter) - return formatter.getvalue().rstrip("\n") - - def get_params(self, ctx: Context) -> t.List["Parameter"]: - rv = self.params - help_option = self.get_help_option(ctx) - - if help_option is not None: - rv = [*rv, help_option] - - return rv - - def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the usage line into the formatter. - - This is a low-level method called by :meth:`get_usage`. - """ - pieces = self.collect_usage_pieces(ctx) - formatter.write_usage(ctx.command_path, " ".join(pieces)) - - def collect_usage_pieces(self, ctx: Context) -> t.List[str]: - """Returns all the pieces that go into the usage line and returns - it as a list of strings. - """ - rv = [self.options_metavar] if self.options_metavar else [] - - for param in self.get_params(ctx): - rv.extend(param.get_usage_pieces(ctx)) - - return rv - - def get_help_option_names(self, ctx: Context) -> t.List[str]: - """Returns the names for the help option.""" - all_names = set(ctx.help_option_names) - for param in self.params: - all_names.difference_update(param.opts) - all_names.difference_update(param.secondary_opts) - return list(all_names) - - def get_help_option(self, ctx: Context) -> t.Optional["Option"]: - """Returns the help option object.""" - help_options = self.get_help_option_names(ctx) - - if not help_options or not self.add_help_option: - return None - - def show_help(ctx: Context, param: "Parameter", value: str) -> None: - if value and not ctx.resilient_parsing: - echo(ctx.get_help(), color=ctx.color) - ctx.exit() - - return Option( - help_options, - is_flag=True, - is_eager=True, - expose_value=False, - callback=show_help, - help=_("Show this message and exit."), - ) - - def make_parser(self, ctx: Context) -> OptionParser: - """Creates the underlying option parser for this command.""" - parser = OptionParser(ctx) - for param in self.get_params(ctx): - param.add_to_parser(parser, ctx) - return parser - - def get_help(self, ctx: Context) -> str: - """Formats the help into a string and returns it. - - Calls :meth:`format_help` internally. - """ - formatter = ctx.make_formatter() - self.format_help(ctx, formatter) - return formatter.getvalue().rstrip("\n") - - def get_short_help_str(self, limit: int = 45) -> str: - """Gets short help for the command or makes it by shortening the - long help string. - """ - if self.short_help: - text = inspect.cleandoc(self.short_help) - elif self.help: - text = make_default_short_help(self.help, limit) - else: - text = "" - - if self.deprecated: - text = _("(Deprecated) {text}").format(text=text) - - return text.strip() - - def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the help into the formatter if it exists. - - This is a low-level method called by :meth:`get_help`. - - This calls the following methods: - - - :meth:`format_usage` - - :meth:`format_help_text` - - :meth:`format_options` - - :meth:`format_epilog` - """ - self.format_usage(ctx, formatter) - self.format_help_text(ctx, formatter) - self.format_options(ctx, formatter) - self.format_epilog(ctx, formatter) - - def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the help text to the formatter if it exists.""" - if self.help is not None: - # truncate the help text to the first form feed - text = inspect.cleandoc(self.help).partition("\f")[0] - else: - text = "" - - if self.deprecated: - text = _("(Deprecated) {text}").format(text=text) - - if text: - formatter.write_paragraph() - - with formatter.indentation(): - formatter.write_text(text) - - def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes all the options into the formatter if they exist.""" - opts = [] - for param in self.get_params(ctx): - rv = param.get_help_record(ctx) - if rv is not None: - opts.append(rv) - - if opts: - with formatter.section(_("Options")): - formatter.write_dl(opts) - - def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the epilog into the formatter if it exists.""" - if self.epilog: - epilog = inspect.cleandoc(self.epilog) - formatter.write_paragraph() - - with formatter.indentation(): - formatter.write_text(epilog) - - def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: - if not args and self.no_args_is_help and not ctx.resilient_parsing: - echo(ctx.get_help(), color=ctx.color) - ctx.exit() - - parser = self.make_parser(ctx) - opts, args, param_order = parser.parse_args(args=args) - - for param in iter_params_for_processing(param_order, self.get_params(ctx)): - value, args = param.handle_parse_result(ctx, opts, args) - - if args and not ctx.allow_extra_args and not ctx.resilient_parsing: - ctx.fail( - ngettext( - "Got unexpected extra argument ({args})", - "Got unexpected extra arguments ({args})", - len(args), - ).format(args=" ".join(map(str, args))) - ) - - ctx.args = args - ctx._opt_prefixes.update(parser._opt_prefixes) - return args - - def invoke(self, ctx: Context) -> t.Any: - """Given a context, this invokes the attached callback (if it exists) - in the right way. - """ - if self.deprecated: - message = _( - "DeprecationWarning: The command {name!r} is deprecated." - ).format(name=self.name) - echo(style(message, fg="red"), err=True) - - if self.callback is not None: - return ctx.invoke(self.callback, **ctx.params) - - def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: - """Return a list of completions for the incomplete value. Looks - at the names of options and chained multi-commands. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - results: t.List["CompletionItem"] = [] - - if incomplete and not incomplete[0].isalnum(): - for param in self.get_params(ctx): - if ( - not isinstance(param, Option) - or param.hidden - or ( - not param.multiple - and ctx.get_parameter_source(param.name) # type: ignore - is ParameterSource.COMMANDLINE - ) - ): - continue - - results.extend( - CompletionItem(name, help=param.help) - for name in [*param.opts, *param.secondary_opts] - if name.startswith(incomplete) - ) - - results.extend(super().shell_complete(ctx, incomplete)) - return results - - -class MultiCommand(Command): - """A multi command is the basic implementation of a command that - dispatches to subcommands. The most common version is the - :class:`Group`. - - :param invoke_without_command: this controls how the multi command itself - is invoked. By default it's only invoked - if a subcommand is provided. - :param no_args_is_help: this controls what happens if no arguments are - provided. This option is enabled by default if - `invoke_without_command` is disabled or disabled - if it's enabled. If enabled this will add - ``--help`` as argument if no arguments are - passed. - :param subcommand_metavar: the string that is used in the documentation - to indicate the subcommand place. - :param chain: if this is set to `True` chaining of multiple subcommands - is enabled. This restricts the form of commands in that - they cannot have optional arguments but it allows - multiple commands to be chained together. - :param result_callback: The result callback to attach to this multi - command. This can be set or changed later with the - :meth:`result_callback` decorator. - :param attrs: Other command arguments described in :class:`Command`. - """ - - allow_extra_args = True - allow_interspersed_args = False - - def __init__( - self, - name: t.Optional[str] = None, - invoke_without_command: bool = False, - no_args_is_help: t.Optional[bool] = None, - subcommand_metavar: t.Optional[str] = None, - chain: bool = False, - result_callback: t.Optional[t.Callable[..., t.Any]] = None, - **attrs: t.Any, - ) -> None: - super().__init__(name, **attrs) - - if no_args_is_help is None: - no_args_is_help = not invoke_without_command - - self.no_args_is_help = no_args_is_help - self.invoke_without_command = invoke_without_command - - if subcommand_metavar is None: - if chain: - subcommand_metavar = "COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]..." - else: - subcommand_metavar = "COMMAND [ARGS]..." - - self.subcommand_metavar = subcommand_metavar - self.chain = chain - # The result callback that is stored. This can be set or - # overridden with the :func:`result_callback` decorator. - self._result_callback = result_callback - - if self.chain: - for param in self.params: - if isinstance(param, Argument) and not param.required: - raise RuntimeError( - "Multi commands in chain mode cannot have" - " optional arguments." - ) - - def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: - info_dict = super().to_info_dict(ctx) - commands = {} - - for name in self.list_commands(ctx): - command = self.get_command(ctx, name) - - if command is None: - continue - - sub_ctx = ctx._make_sub_context(command) - - with sub_ctx.scope(cleanup=False): - commands[name] = command.to_info_dict(sub_ctx) - - info_dict.update(commands=commands, chain=self.chain) - return info_dict - - def collect_usage_pieces(self, ctx: Context) -> t.List[str]: - rv = super().collect_usage_pieces(ctx) - rv.append(self.subcommand_metavar) - return rv - - def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: - super().format_options(ctx, formatter) - self.format_commands(ctx, formatter) - - def result_callback(self, replace: bool = False) -> t.Callable[[F], F]: - """Adds a result callback to the command. By default if a - result callback is already registered this will chain them but - this can be disabled with the `replace` parameter. The result - callback is invoked with the return value of the subcommand - (or the list of return values from all subcommands if chaining - is enabled) as well as the parameters as they would be passed - to the main callback. - - Example:: - - @click.group() - @click.option('-i', '--input', default=23) - def cli(input): - return 42 - - @cli.result_callback() - def process_result(result, input): - return result + input - - :param replace: if set to `True` an already existing result - callback will be removed. - - .. versionchanged:: 8.0 - Renamed from ``resultcallback``. - - .. versionadded:: 3.0 - """ - - def decorator(f: F) -> F: - old_callback = self._result_callback - - if old_callback is None or replace: - self._result_callback = f - return f - - def function(__value, *args, **kwargs): # type: ignore - inner = old_callback(__value, *args, **kwargs) - return f(inner, *args, **kwargs) - - self._result_callback = rv = update_wrapper(t.cast(F, function), f) - return rv - - return decorator - - def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: - """Extra format methods for multi methods that adds all the commands - after the options. - """ - commands = [] - for subcommand in self.list_commands(ctx): - cmd = self.get_command(ctx, subcommand) - # What is this, the tool lied about a command. Ignore it - if cmd is None: - continue - if cmd.hidden: - continue - - commands.append((subcommand, cmd)) - - # allow for 3 times the default spacing - if len(commands): - limit = formatter.width - 6 - max(len(cmd[0]) for cmd in commands) - - rows = [] - for subcommand, cmd in commands: - help = cmd.get_short_help_str(limit) - rows.append((subcommand, help)) - - if rows: - with formatter.section(_("Commands")): - formatter.write_dl(rows) - - def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: - if not args and self.no_args_is_help and not ctx.resilient_parsing: - echo(ctx.get_help(), color=ctx.color) - ctx.exit() - - rest = super().parse_args(ctx, args) - - if self.chain: - ctx.protected_args = rest - ctx.args = [] - elif rest: - ctx.protected_args, ctx.args = rest[:1], rest[1:] - - return ctx.args - - def invoke(self, ctx: Context) -> t.Any: - def _process_result(value: t.Any) -> t.Any: - if self._result_callback is not None: - value = ctx.invoke(self._result_callback, value, **ctx.params) - return value - - if not ctx.protected_args: - if self.invoke_without_command: - # No subcommand was invoked, so the result callback is - # invoked with the group return value for regular - # groups, or an empty list for chained groups. - with ctx: - rv = super().invoke(ctx) - return _process_result([] if self.chain else rv) - ctx.fail(_("Missing command.")) - - # Fetch args back out - args = [*ctx.protected_args, *ctx.args] - ctx.args = [] - ctx.protected_args = [] - - # If we're not in chain mode, we only allow the invocation of a - # single command but we also inform the current context about the - # name of the command to invoke. - if not self.chain: - # Make sure the context is entered so we do not clean up - # resources until the result processor has worked. - with ctx: - cmd_name, cmd, args = self.resolve_command(ctx, args) - assert cmd is not None - ctx.invoked_subcommand = cmd_name - super().invoke(ctx) - sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) - with sub_ctx: - return _process_result(sub_ctx.command.invoke(sub_ctx)) - - # In chain mode we create the contexts step by step, but after the - # base command has been invoked. Because at that point we do not - # know the subcommands yet, the invoked subcommand attribute is - # set to ``*`` to inform the command that subcommands are executed - # but nothing else. - with ctx: - ctx.invoked_subcommand = "*" if args else None - super().invoke(ctx) - - # Otherwise we make every single context and invoke them in a - # chain. In that case the return value to the result processor - # is the list of all invoked subcommand's results. - contexts = [] - while args: - cmd_name, cmd, args = self.resolve_command(ctx, args) - assert cmd is not None - sub_ctx = cmd.make_context( - cmd_name, - args, - parent=ctx, - allow_extra_args=True, - allow_interspersed_args=False, - ) - contexts.append(sub_ctx) - args, sub_ctx.args = sub_ctx.args, [] - - rv = [] - for sub_ctx in contexts: - with sub_ctx: - rv.append(sub_ctx.command.invoke(sub_ctx)) - return _process_result(rv) - - def resolve_command( - self, ctx: Context, args: t.List[str] - ) -> t.Tuple[t.Optional[str], t.Optional[Command], t.List[str]]: - cmd_name = make_str(args[0]) - original_cmd_name = cmd_name - - # Get the command - cmd = self.get_command(ctx, cmd_name) - - # If we can't find the command but there is a normalization - # function available, we try with that one. - if cmd is None and ctx.token_normalize_func is not None: - cmd_name = ctx.token_normalize_func(cmd_name) - cmd = self.get_command(ctx, cmd_name) - - # If we don't find the command we want to show an error message - # to the user that it was not provided. However, there is - # something else we should do: if the first argument looks like - # an option we want to kick off parsing again for arguments to - # resolve things like --help which now should go to the main - # place. - if cmd is None and not ctx.resilient_parsing: - if split_opt(cmd_name)[0]: - self.parse_args(ctx, ctx.args) - ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) - return cmd_name if cmd else None, cmd, args[1:] - - def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: - """Given a context and a command name, this returns a - :class:`Command` object if it exists or returns `None`. - """ - raise NotImplementedError - - def list_commands(self, ctx: Context) -> t.List[str]: - """Returns a list of subcommand names in the order they should - appear. - """ - return [] - - def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: - """Return a list of completions for the incomplete value. Looks - at the names of options, subcommands, and chained - multi-commands. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - results = [ - CompletionItem(name, help=command.get_short_help_str()) - for name, command in _complete_visible_commands(ctx, incomplete) - ] - results.extend(super().shell_complete(ctx, incomplete)) - return results - - -class Group(MultiCommand): - """A group allows a command to have subcommands attached. This is - the most common way to implement nesting in Click. - - :param name: The name of the group command. - :param commands: A dict mapping names to :class:`Command` objects. - Can also be a list of :class:`Command`, which will use - :attr:`Command.name` to create the dict. - :param attrs: Other command arguments described in - :class:`MultiCommand`, :class:`Command`, and - :class:`BaseCommand`. - - .. versionchanged:: 8.0 - The ``commands`` argument can be a list of command objects. - """ - - #: If set, this is used by the group's :meth:`command` decorator - #: as the default :class:`Command` class. This is useful to make all - #: subcommands use a custom command class. - #: - #: .. versionadded:: 8.0 - command_class: t.Optional[t.Type[Command]] = None - - #: If set, this is used by the group's :meth:`group` decorator - #: as the default :class:`Group` class. This is useful to make all - #: subgroups use a custom group class. - #: - #: If set to the special value :class:`type` (literally - #: ``group_class = type``), this group's class will be used as the - #: default class. This makes a custom group class continue to make - #: custom groups. - #: - #: .. versionadded:: 8.0 - group_class: t.Optional[t.Union[t.Type["Group"], t.Type[type]]] = None - # Literal[type] isn't valid, so use Type[type] - - def __init__( - self, - name: t.Optional[str] = None, - commands: t.Optional[ - t.Union[t.MutableMapping[str, Command], t.Sequence[Command]] - ] = None, - **attrs: t.Any, - ) -> None: - super().__init__(name, **attrs) - - if commands is None: - commands = {} - elif isinstance(commands, abc.Sequence): - commands = {c.name: c for c in commands if c.name is not None} - - #: The registered subcommands by their exported names. - self.commands: t.MutableMapping[str, Command] = commands - - def add_command(self, cmd: Command, name: t.Optional[str] = None) -> None: - """Registers another :class:`Command` with this group. If the name - is not provided, the name of the command is used. - """ - name = name or cmd.name - if name is None: - raise TypeError("Command has no name.") - _check_multicommand(self, name, cmd, register=True) - self.commands[name] = cmd - - @t.overload - def command(self, __func: t.Callable[..., t.Any]) -> Command: - ... - - @t.overload - def command( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Callable[[t.Callable[..., t.Any]], Command]: - ... - - def command( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Union[t.Callable[[t.Callable[..., t.Any]], Command], Command]: - """A shortcut decorator for declaring and attaching a command to - the group. This takes the same arguments as :func:`command` and - immediately registers the created command with this group by - calling :meth:`add_command`. - - To customize the command class used, set the - :attr:`command_class` attribute. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - - .. versionchanged:: 8.0 - Added the :attr:`command_class` attribute. - """ - from .decorators import command - - func: t.Optional[t.Callable[..., t.Any]] = None - - if args and callable(args[0]): - assert ( - len(args) == 1 and not kwargs - ), "Use 'command(**kwargs)(callable)' to provide arguments." - (func,) = args - args = () - - if self.command_class and kwargs.get("cls") is None: - kwargs["cls"] = self.command_class - - def decorator(f: t.Callable[..., t.Any]) -> Command: - cmd: Command = command(*args, **kwargs)(f) - self.add_command(cmd) - return cmd - - if func is not None: - return decorator(func) - - return decorator - - @t.overload - def group(self, __func: t.Callable[..., t.Any]) -> "Group": - ... - - @t.overload - def group( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Callable[[t.Callable[..., t.Any]], "Group"]: - ... - - def group( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Union[t.Callable[[t.Callable[..., t.Any]], "Group"], "Group"]: - """A shortcut decorator for declaring and attaching a group to - the group. This takes the same arguments as :func:`group` and - immediately registers the created group with this group by - calling :meth:`add_command`. - - To customize the group class used, set the :attr:`group_class` - attribute. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - - .. versionchanged:: 8.0 - Added the :attr:`group_class` attribute. - """ - from .decorators import group - - func: t.Optional[t.Callable[..., t.Any]] = None - - if args and callable(args[0]): - assert ( - len(args) == 1 and not kwargs - ), "Use 'group(**kwargs)(callable)' to provide arguments." - (func,) = args - args = () - - if self.group_class is not None and kwargs.get("cls") is None: - if self.group_class is type: - kwargs["cls"] = type(self) - else: - kwargs["cls"] = self.group_class - - def decorator(f: t.Callable[..., t.Any]) -> "Group": - cmd: Group = group(*args, **kwargs)(f) - self.add_command(cmd) - return cmd - - if func is not None: - return decorator(func) - - return decorator - - def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: - return self.commands.get(cmd_name) - - def list_commands(self, ctx: Context) -> t.List[str]: - return sorted(self.commands) - - -class CommandCollection(MultiCommand): - """A command collection is a multi command that merges multiple multi - commands together into one. This is a straightforward implementation - that accepts a list of different multi commands as sources and - provides all the commands for each of them. - - See :class:`MultiCommand` and :class:`Command` for the description of - ``name`` and ``attrs``. - """ - - def __init__( - self, - name: t.Optional[str] = None, - sources: t.Optional[t.List[MultiCommand]] = None, - **attrs: t.Any, - ) -> None: - super().__init__(name, **attrs) - #: The list of registered multi commands. - self.sources: t.List[MultiCommand] = sources or [] - - def add_source(self, multi_cmd: MultiCommand) -> None: - """Adds a new multi command to the chain dispatcher.""" - self.sources.append(multi_cmd) - - def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: - for source in self.sources: - rv = source.get_command(ctx, cmd_name) - - if rv is not None: - if self.chain: - _check_multicommand(self, cmd_name, rv) - - return rv - - return None - - def list_commands(self, ctx: Context) -> t.List[str]: - rv: t.Set[str] = set() - - for source in self.sources: - rv.update(source.list_commands(ctx)) - - return sorted(rv) - - -def _check_iter(value: t.Any) -> t.Iterator[t.Any]: - """Check if the value is iterable but not a string. Raises a type - error, or return an iterator over the value. - """ - if isinstance(value, str): - raise TypeError - - return iter(value) - - -class Parameter: - r"""A parameter to a command comes in two versions: they are either - :class:`Option`\s or :class:`Argument`\s. Other subclasses are currently - not supported by design as some of the internals for parsing are - intentionally not finalized. - - Some settings are supported by both options and arguments. - - :param param_decls: the parameter declarations for this option or - argument. This is a list of flags or argument - names. - :param type: the type that should be used. Either a :class:`ParamType` - or a Python type. The latter is converted into the former - automatically if supported. - :param required: controls if this is optional or not. - :param default: the default value if omitted. This can also be a callable, - in which case it's invoked when the default is needed - without any arguments. - :param callback: A function to further process or validate the value - after type conversion. It is called as ``f(ctx, param, value)`` - and must return the value. It is called for all sources, - including prompts. - :param nargs: the number of arguments to match. If not ``1`` the return - value is a tuple instead of single value. The default for - nargs is ``1`` (except if the type is a tuple, then it's - the arity of the tuple). If ``nargs=-1``, all remaining - parameters are collected. - :param metavar: how the value is represented in the help page. - :param expose_value: if this is `True` then the value is passed onwards - to the command callback and stored on the context, - otherwise it's skipped. - :param is_eager: eager values are processed before non eager ones. This - should not be set for arguments or it will inverse the - order of processing. - :param envvar: a string or list of strings that are environment variables - that should be checked. - :param shell_complete: A function that returns custom shell - completions. Used instead of the param's type completion if - given. Takes ``ctx, param, incomplete`` and must return a list - of :class:`~click.shell_completion.CompletionItem` or a list of - strings. - - .. versionchanged:: 8.0 - ``process_value`` validates required parameters and bounded - ``nargs``, and invokes the parameter callback before returning - the value. This allows the callback to validate prompts. - ``full_process_value`` is removed. - - .. versionchanged:: 8.0 - ``autocompletion`` is renamed to ``shell_complete`` and has new - semantics described above. The old name is deprecated and will - be removed in 8.1, until then it will be wrapped to match the - new requirements. - - .. versionchanged:: 8.0 - For ``multiple=True, nargs>1``, the default must be a list of - tuples. - - .. versionchanged:: 8.0 - Setting a default is no longer required for ``nargs>1``, it will - default to ``None``. ``multiple=True`` or ``nargs=-1`` will - default to ``()``. - - .. versionchanged:: 7.1 - Empty environment variables are ignored rather than taking the - empty string value. This makes it possible for scripts to clear - variables if they can't unset them. - - .. versionchanged:: 2.0 - Changed signature for parameter callback to also be passed the - parameter. The old callback format will still work, but it will - raise a warning to give you a chance to migrate the code easier. - """ - - param_type_name = "parameter" - - def __init__( - self, - param_decls: t.Optional[t.Sequence[str]] = None, - type: t.Optional[t.Union[types.ParamType, t.Any]] = None, - required: bool = False, - default: t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]] = None, - callback: t.Optional[t.Callable[[Context, "Parameter", t.Any], t.Any]] = None, - nargs: t.Optional[int] = None, - multiple: bool = False, - metavar: t.Optional[str] = None, - expose_value: bool = True, - is_eager: bool = False, - envvar: t.Optional[t.Union[str, t.Sequence[str]]] = None, - shell_complete: t.Optional[ - t.Callable[ - [Context, "Parameter", str], - t.Union[t.List["CompletionItem"], t.List[str]], - ] - ] = None, - ) -> None: - self.name: t.Optional[str] - self.opts: t.List[str] - self.secondary_opts: t.List[str] - self.name, self.opts, self.secondary_opts = self._parse_decls( - param_decls or (), expose_value - ) - self.type: types.ParamType = types.convert_type(type, default) - - # Default nargs to what the type tells us if we have that - # information available. - if nargs is None: - if self.type.is_composite: - nargs = self.type.arity - else: - nargs = 1 - - self.required = required - self.callback = callback - self.nargs = nargs - self.multiple = multiple - self.expose_value = expose_value - self.default = default - self.is_eager = is_eager - self.metavar = metavar - self.envvar = envvar - self._custom_shell_complete = shell_complete - - if __debug__: - if self.type.is_composite and nargs != self.type.arity: - raise ValueError( - f"'nargs' must be {self.type.arity} (or None) for" - f" type {self.type!r}, but it was {nargs}." - ) - - # Skip no default or callable default. - check_default = default if not callable(default) else None - - if check_default is not None: - if multiple: - try: - # Only check the first value against nargs. - check_default = next(_check_iter(check_default), None) - except TypeError: - raise ValueError( - "'default' must be a list when 'multiple' is true." - ) from None - - # Can be None for multiple with empty default. - if nargs != 1 and check_default is not None: - try: - _check_iter(check_default) - except TypeError: - if multiple: - message = ( - "'default' must be a list of lists when 'multiple' is" - " true and 'nargs' != 1." - ) - else: - message = "'default' must be a list when 'nargs' != 1." - - raise ValueError(message) from None - - if nargs > 1 and len(check_default) != nargs: - subject = "item length" if multiple else "length" - raise ValueError( - f"'default' {subject} must match nargs={nargs}." - ) - - def to_info_dict(self) -> t.Dict[str, t.Any]: - """Gather information that could be useful for a tool generating - user-facing documentation. - - Use :meth:`click.Context.to_info_dict` to traverse the entire - CLI structure. - - .. versionadded:: 8.0 - """ - return { - "name": self.name, - "param_type_name": self.param_type_name, - "opts": self.opts, - "secondary_opts": self.secondary_opts, - "type": self.type.to_info_dict(), - "required": self.required, - "nargs": self.nargs, - "multiple": self.multiple, - "default": self.default, - "envvar": self.envvar, - } - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.name}>" - - def _parse_decls( - self, decls: t.Sequence[str], expose_value: bool - ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: - raise NotImplementedError() - - @property - def human_readable_name(self) -> str: - """Returns the human readable name of this parameter. This is the - same as the name for options, but the metavar for arguments. - """ - return self.name # type: ignore - - def make_metavar(self) -> str: - if self.metavar is not None: - return self.metavar - - metavar = self.type.get_metavar(self) - - if metavar is None: - metavar = self.type.name.upper() - - if self.nargs != 1: - metavar += "..." - - return metavar - - @t.overload - def get_default( - self, ctx: Context, call: "te.Literal[True]" = True - ) -> t.Optional[t.Any]: - ... - - @t.overload - def get_default( - self, ctx: Context, call: bool = ... - ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: - ... - - def get_default( - self, ctx: Context, call: bool = True - ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: - """Get the default for the parameter. Tries - :meth:`Context.lookup_default` first, then the local default. - - :param ctx: Current context. - :param call: If the default is a callable, call it. Disable to - return the callable instead. - - .. versionchanged:: 8.0.2 - Type casting is no longer performed when getting a default. - - .. versionchanged:: 8.0.1 - Type casting can fail in resilient parsing mode. Invalid - defaults will not prevent showing help text. - - .. versionchanged:: 8.0 - Looks at ``ctx.default_map`` first. - - .. versionchanged:: 8.0 - Added the ``call`` parameter. - """ - value = ctx.lookup_default(self.name, call=False) # type: ignore - - if value is None: - value = self.default - - if call and callable(value): - value = value() - - return value - - def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: - raise NotImplementedError() - - def consume_value( - self, ctx: Context, opts: t.Mapping[str, t.Any] - ) -> t.Tuple[t.Any, ParameterSource]: - value = opts.get(self.name) # type: ignore - source = ParameterSource.COMMANDLINE - - if value is None: - value = self.value_from_envvar(ctx) - source = ParameterSource.ENVIRONMENT - - if value is None: - value = ctx.lookup_default(self.name) # type: ignore - source = ParameterSource.DEFAULT_MAP - - if value is None: - value = self.get_default(ctx) - source = ParameterSource.DEFAULT - - return value, source - - def type_cast_value(self, ctx: Context, value: t.Any) -> t.Any: - """Convert and validate a value against the option's - :attr:`type`, :attr:`multiple`, and :attr:`nargs`. - """ - if value is None: - return () if self.multiple or self.nargs == -1 else None - - def check_iter(value: t.Any) -> t.Iterator[t.Any]: - try: - return _check_iter(value) - except TypeError: - # This should only happen when passing in args manually, - # the parser should construct an iterable when parsing - # the command line. - raise BadParameter( - _("Value must be an iterable."), ctx=ctx, param=self - ) from None - - if self.nargs == 1 or self.type.is_composite: - - def convert(value: t.Any) -> t.Any: - return self.type(value, param=self, ctx=ctx) - - elif self.nargs == -1: - - def convert(value: t.Any) -> t.Any: # t.Tuple[t.Any, ...] - return tuple(self.type(x, self, ctx) for x in check_iter(value)) - - else: # nargs > 1 - - def convert(value: t.Any) -> t.Any: # t.Tuple[t.Any, ...] - value = tuple(check_iter(value)) - - if len(value) != self.nargs: - raise BadParameter( - ngettext( - "Takes {nargs} values but 1 was given.", - "Takes {nargs} values but {len} were given.", - len(value), - ).format(nargs=self.nargs, len=len(value)), - ctx=ctx, - param=self, - ) - - return tuple(self.type(x, self, ctx) for x in value) - - if self.multiple: - return tuple(convert(x) for x in check_iter(value)) - - return convert(value) - - def value_is_missing(self, value: t.Any) -> bool: - if value is None: - return True - - if (self.nargs != 1 or self.multiple) and value == (): - return True - - return False - - def process_value(self, ctx: Context, value: t.Any) -> t.Any: - value = self.type_cast_value(ctx, value) - - if self.required and self.value_is_missing(value): - raise MissingParameter(ctx=ctx, param=self) - - if self.callback is not None: - value = self.callback(ctx, self, value) - - return value - - def resolve_envvar_value(self, ctx: Context) -> t.Optional[str]: - if self.envvar is None: - return None - - if isinstance(self.envvar, str): - rv = os.environ.get(self.envvar) - - if rv: - return rv - else: - for envvar in self.envvar: - rv = os.environ.get(envvar) - - if rv: - return rv - - return None - - def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: - rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) - - if rv is not None and self.nargs != 1: - rv = self.type.split_envvar_value(rv) - - return rv - - def handle_parse_result( - self, ctx: Context, opts: t.Mapping[str, t.Any], args: t.List[str] - ) -> t.Tuple[t.Any, t.List[str]]: - with augment_usage_errors(ctx, param=self): - value, source = self.consume_value(ctx, opts) - ctx.set_parameter_source(self.name, source) # type: ignore - - try: - value = self.process_value(ctx, value) - except Exception: - if not ctx.resilient_parsing: - raise - - value = None - - if self.expose_value: - ctx.params[self.name] = value # type: ignore - - return value, args - - def get_help_record(self, ctx: Context) -> t.Optional[t.Tuple[str, str]]: - pass - - def get_usage_pieces(self, ctx: Context) -> t.List[str]: - return [] - - def get_error_hint(self, ctx: Context) -> str: - """Get a stringified version of the param for use in error messages to - indicate which param caused the error. - """ - hint_list = self.opts or [self.human_readable_name] - return " / ".join(f"'{x}'" for x in hint_list) - - def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: - """Return a list of completions for the incomplete value. If a - ``shell_complete`` function was given during init, it is used. - Otherwise, the :attr:`type` - :meth:`~click.types.ParamType.shell_complete` function is used. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - if self._custom_shell_complete is not None: - results = self._custom_shell_complete(ctx, self, incomplete) - - if results and isinstance(results[0], str): - from click.shell_completion import CompletionItem - - results = [CompletionItem(c) for c in results] - - return t.cast(t.List["CompletionItem"], results) - - return self.type.shell_complete(ctx, self, incomplete) - - -class Option(Parameter): - """Options are usually optional values on the command line and - have some extra features that arguments don't have. - - All other parameters are passed onwards to the parameter constructor. - - :param show_default: Show the default value for this option in its - help text. Values are not shown by default, unless - :attr:`Context.show_default` is ``True``. If this value is a - string, it shows that string in parentheses instead of the - actual value. This is particularly useful for dynamic options. - For single option boolean flags, the default remains hidden if - its value is ``False``. - :param show_envvar: Controls if an environment variable should be - shown on the help page. Normally, environment variables are not - shown. - :param prompt: If set to ``True`` or a non empty string then the - user will be prompted for input. If set to ``True`` the prompt - will be the option name capitalized. - :param confirmation_prompt: Prompt a second time to confirm the - value if it was prompted for. Can be set to a string instead of - ``True`` to customize the message. - :param prompt_required: If set to ``False``, the user will be - prompted for input only when the option was specified as a flag - without a value. - :param hide_input: If this is ``True`` then the input on the prompt - will be hidden from the user. This is useful for password input. - :param is_flag: forces this option to act as a flag. The default is - auto detection. - :param flag_value: which value should be used for this flag if it's - enabled. This is set to a boolean automatically if - the option string contains a slash to mark two options. - :param multiple: if this is set to `True` then the argument is accepted - multiple times and recorded. This is similar to ``nargs`` - in how it works but supports arbitrary number of - arguments. - :param count: this flag makes an option increment an integer. - :param allow_from_autoenv: if this is enabled then the value of this - parameter will be pulled from an environment - variable in case a prefix is defined on the - context. - :param help: the help string. - :param hidden: hide this option from help outputs. - :param attrs: Other command arguments described in :class:`Parameter`. - - .. versionchanged:: 8.1.0 - Help text indentation is cleaned here instead of only in the - ``@option`` decorator. - - .. versionchanged:: 8.1.0 - The ``show_default`` parameter overrides - ``Context.show_default``. - - .. versionchanged:: 8.1.0 - The default of a single option boolean flag is not shown if the - default value is ``False``. - - .. versionchanged:: 8.0.1 - ``type`` is detected from ``flag_value`` if given. - """ - - param_type_name = "option" - - def __init__( - self, - param_decls: t.Optional[t.Sequence[str]] = None, - show_default: t.Union[bool, str, None] = None, - prompt: t.Union[bool, str] = False, - confirmation_prompt: t.Union[bool, str] = False, - prompt_required: bool = True, - hide_input: bool = False, - is_flag: t.Optional[bool] = None, - flag_value: t.Optional[t.Any] = None, - multiple: bool = False, - count: bool = False, - allow_from_autoenv: bool = True, - type: t.Optional[t.Union[types.ParamType, t.Any]] = None, - help: t.Optional[str] = None, - hidden: bool = False, - show_choices: bool = True, - show_envvar: bool = False, - **attrs: t.Any, - ) -> None: - if help: - help = inspect.cleandoc(help) - - default_is_missing = "default" not in attrs - super().__init__(param_decls, type=type, multiple=multiple, **attrs) - - if prompt is True: - if self.name is None: - raise TypeError("'name' is required with 'prompt=True'.") - - prompt_text: t.Optional[str] = self.name.replace("_", " ").capitalize() - elif prompt is False: - prompt_text = None - else: - prompt_text = prompt - - self.prompt = prompt_text - self.confirmation_prompt = confirmation_prompt - self.prompt_required = prompt_required - self.hide_input = hide_input - self.hidden = hidden - - # If prompt is enabled but not required, then the option can be - # used as a flag to indicate using prompt or flag_value. - self._flag_needs_value = self.prompt is not None and not self.prompt_required - - if is_flag is None: - if flag_value is not None: - # Implicitly a flag because flag_value was set. - is_flag = True - elif self._flag_needs_value: - # Not a flag, but when used as a flag it shows a prompt. - is_flag = False - else: - # Implicitly a flag because flag options were given. - is_flag = bool(self.secondary_opts) - elif is_flag is False and not self._flag_needs_value: - # Not a flag, and prompt is not enabled, can be used as a - # flag if flag_value is set. - self._flag_needs_value = flag_value is not None - - self.default: t.Union[t.Any, t.Callable[[], t.Any]] - - if is_flag and default_is_missing and not self.required: - if multiple: - self.default = () - else: - self.default = False - - if flag_value is None: - flag_value = not self.default - - self.type: types.ParamType - if is_flag and type is None: - # Re-guess the type from the flag value instead of the - # default. - self.type = types.convert_type(None, flag_value) - - self.is_flag: bool = is_flag - self.is_bool_flag: bool = is_flag and isinstance(self.type, types.BoolParamType) - self.flag_value: t.Any = flag_value - - # Counting - self.count = count - if count: - if type is None: - self.type = types.IntRange(min=0) - if default_is_missing: - self.default = 0 - - self.allow_from_autoenv = allow_from_autoenv - self.help = help - self.show_default = show_default - self.show_choices = show_choices - self.show_envvar = show_envvar - - if __debug__: - if self.nargs == -1: - raise TypeError("nargs=-1 is not supported for options.") - - if self.prompt and self.is_flag and not self.is_bool_flag: - raise TypeError("'prompt' is not valid for non-boolean flag.") - - if not self.is_bool_flag and self.secondary_opts: - raise TypeError("Secondary flag is not valid for non-boolean flag.") - - if self.is_bool_flag and self.hide_input and self.prompt is not None: - raise TypeError( - "'prompt' with 'hide_input' is not valid for boolean flag." - ) - - if self.count: - if self.multiple: - raise TypeError("'count' is not valid with 'multiple'.") - - if self.is_flag: - raise TypeError("'count' is not valid with 'is_flag'.") - - def to_info_dict(self) -> t.Dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict.update( - help=self.help, - prompt=self.prompt, - is_flag=self.is_flag, - flag_value=self.flag_value, - count=self.count, - hidden=self.hidden, - ) - return info_dict - - def _parse_decls( - self, decls: t.Sequence[str], expose_value: bool - ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: - opts = [] - secondary_opts = [] - name = None - possible_names = [] - - for decl in decls: - if decl.isidentifier(): - if name is not None: - raise TypeError(f"Name '{name}' defined twice") - name = decl - else: - split_char = ";" if decl[:1] == "/" else "/" - if split_char in decl: - first, second = decl.split(split_char, 1) - first = first.rstrip() - if first: - possible_names.append(split_opt(first)) - opts.append(first) - second = second.lstrip() - if second: - secondary_opts.append(second.lstrip()) - if first == second: - raise ValueError( - f"Boolean option {decl!r} cannot use the" - " same flag for true/false." - ) - else: - possible_names.append(split_opt(decl)) - opts.append(decl) - - if name is None and possible_names: - possible_names.sort(key=lambda x: -len(x[0])) # group long options first - name = possible_names[0][1].replace("-", "_").lower() - if not name.isidentifier(): - name = None - - if name is None: - if not expose_value: - return None, opts, secondary_opts - raise TypeError("Could not determine name for option") - - if not opts and not secondary_opts: - raise TypeError( - f"No options defined but a name was passed ({name})." - " Did you mean to declare an argument instead? Did" - f" you mean to pass '--{name}'?" - ) - - return name, opts, secondary_opts - - def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: - if self.multiple: - action = "append" - elif self.count: - action = "count" - else: - action = "store" - - if self.is_flag: - action = f"{action}_const" - - if self.is_bool_flag and self.secondary_opts: - parser.add_option( - obj=self, opts=self.opts, dest=self.name, action=action, const=True - ) - parser.add_option( - obj=self, - opts=self.secondary_opts, - dest=self.name, - action=action, - const=False, - ) - else: - parser.add_option( - obj=self, - opts=self.opts, - dest=self.name, - action=action, - const=self.flag_value, - ) - else: - parser.add_option( - obj=self, - opts=self.opts, - dest=self.name, - action=action, - nargs=self.nargs, - ) - - def get_help_record(self, ctx: Context) -> t.Optional[t.Tuple[str, str]]: - if self.hidden: - return None - - any_prefix_is_slash = False - - def _write_opts(opts: t.Sequence[str]) -> str: - nonlocal any_prefix_is_slash - - rv, any_slashes = join_options(opts) - - if any_slashes: - any_prefix_is_slash = True - - if not self.is_flag and not self.count: - rv += f" {self.make_metavar()}" - - return rv - - rv = [_write_opts(self.opts)] - - if self.secondary_opts: - rv.append(_write_opts(self.secondary_opts)) - - help = self.help or "" - extra = [] - - if self.show_envvar: - envvar = self.envvar - - if envvar is None: - if ( - self.allow_from_autoenv - and ctx.auto_envvar_prefix is not None - and self.name is not None - ): - envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" - - if envvar is not None: - var_str = ( - envvar - if isinstance(envvar, str) - else ", ".join(str(d) for d in envvar) - ) - extra.append(_("env var: {var}").format(var=var_str)) - - # Temporarily enable resilient parsing to avoid type casting - # failing for the default. Might be possible to extend this to - # help formatting in general. - resilient = ctx.resilient_parsing - ctx.resilient_parsing = True - - try: - default_value = self.get_default(ctx, call=False) - finally: - ctx.resilient_parsing = resilient - - show_default = False - show_default_is_str = False - - if self.show_default is not None: - if isinstance(self.show_default, str): - show_default_is_str = show_default = True - else: - show_default = self.show_default - elif ctx.show_default is not None: - show_default = ctx.show_default - - if show_default_is_str or (show_default and (default_value is not None)): - if show_default_is_str: - default_string = f"({self.show_default})" - elif isinstance(default_value, (list, tuple)): - default_string = ", ".join(str(d) for d in default_value) - elif inspect.isfunction(default_value): - default_string = _("(dynamic)") - elif self.is_bool_flag and self.secondary_opts: - # For boolean flags that have distinct True/False opts, - # use the opt without prefix instead of the value. - default_string = split_opt( - (self.opts if self.default else self.secondary_opts)[0] - )[1] - elif self.is_bool_flag and not self.secondary_opts and not default_value: - default_string = "" - else: - default_string = str(default_value) - - if default_string: - extra.append(_("default: {default}").format(default=default_string)) - - if ( - isinstance(self.type, types._NumberRangeBase) - # skip count with default range type - and not (self.count and self.type.min == 0 and self.type.max is None) - ): - range_str = self.type._describe_range() - - if range_str: - extra.append(range_str) - - if self.required: - extra.append(_("required")) - - if extra: - extra_str = "; ".join(extra) - help = f"{help} [{extra_str}]" if help else f"[{extra_str}]" - - return ("; " if any_prefix_is_slash else " / ").join(rv), help - - @t.overload - def get_default( - self, ctx: Context, call: "te.Literal[True]" = True - ) -> t.Optional[t.Any]: - ... - - @t.overload - def get_default( - self, ctx: Context, call: bool = ... - ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: - ... - - def get_default( - self, ctx: Context, call: bool = True - ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: - # If we're a non boolean flag our default is more complex because - # we need to look at all flags in the same group to figure out - # if we're the default one in which case we return the flag - # value as default. - if self.is_flag and not self.is_bool_flag: - for param in ctx.command.params: - if param.name == self.name and param.default: - return t.cast(Option, param).flag_value - - return None - - return super().get_default(ctx, call=call) - - def prompt_for_value(self, ctx: Context) -> t.Any: - """This is an alternative flow that can be activated in the full - value processing if a value does not exist. It will prompt the - user until a valid value exists and then returns the processed - value as result. - """ - assert self.prompt is not None - - # Calculate the default before prompting anything to be stable. - default = self.get_default(ctx) - - # If this is a prompt for a flag we need to handle this - # differently. - if self.is_bool_flag: - return confirm(self.prompt, default) - - return prompt( - self.prompt, - default=default, - type=self.type, - hide_input=self.hide_input, - show_choices=self.show_choices, - confirmation_prompt=self.confirmation_prompt, - value_proc=lambda x: self.process_value(ctx, x), - ) - - def resolve_envvar_value(self, ctx: Context) -> t.Optional[str]: - rv = super().resolve_envvar_value(ctx) - - if rv is not None: - return rv - - if ( - self.allow_from_autoenv - and ctx.auto_envvar_prefix is not None - and self.name is not None - ): - envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" - rv = os.environ.get(envvar) - - if rv: - return rv - - return None - - def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: - rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) - - if rv is None: - return None - - value_depth = (self.nargs != 1) + bool(self.multiple) - - if value_depth > 0: - rv = self.type.split_envvar_value(rv) - - if self.multiple and self.nargs != 1: - rv = batch(rv, self.nargs) - - return rv - - def consume_value( - self, ctx: Context, opts: t.Mapping[str, "Parameter"] - ) -> t.Tuple[t.Any, ParameterSource]: - value, source = super().consume_value(ctx, opts) - - # The parser will emit a sentinel value if the option can be - # given as a flag without a value. This is different from None - # to distinguish from the flag not being given at all. - if value is _flag_needs_value: - if self.prompt is not None and not ctx.resilient_parsing: - value = self.prompt_for_value(ctx) - source = ParameterSource.PROMPT - else: - value = self.flag_value - source = ParameterSource.COMMANDLINE - - elif ( - self.multiple - and value is not None - and any(v is _flag_needs_value for v in value) - ): - value = [self.flag_value if v is _flag_needs_value else v for v in value] - source = ParameterSource.COMMANDLINE - - # The value wasn't set, or used the param's default, prompt if - # prompting is enabled. - elif ( - source in {None, ParameterSource.DEFAULT} - and self.prompt is not None - and (self.required or self.prompt_required) - and not ctx.resilient_parsing - ): - value = self.prompt_for_value(ctx) - source = ParameterSource.PROMPT - - return value, source - - -class Argument(Parameter): - """Arguments are positional parameters to a command. They generally - provide fewer features than options but can have infinite ``nargs`` - and are required by default. - - All parameters are passed onwards to the constructor of :class:`Parameter`. - """ - - param_type_name = "argument" - - def __init__( - self, - param_decls: t.Sequence[str], - required: t.Optional[bool] = None, - **attrs: t.Any, - ) -> None: - if required is None: - if attrs.get("default") is not None: - required = False - else: - required = attrs.get("nargs", 1) > 0 - - if "multiple" in attrs: - raise TypeError("__init__() got an unexpected keyword argument 'multiple'.") - - super().__init__(param_decls, required=required, **attrs) - - if __debug__: - if self.default is not None and self.nargs == -1: - raise TypeError("'default' is not supported for nargs=-1.") - - @property - def human_readable_name(self) -> str: - if self.metavar is not None: - return self.metavar - return self.name.upper() # type: ignore - - def make_metavar(self) -> str: - if self.metavar is not None: - return self.metavar - var = self.type.get_metavar(self) - if not var: - var = self.name.upper() # type: ignore - if not self.required: - var = f"[{var}]" - if self.nargs != 1: - var += "..." - return var - - def _parse_decls( - self, decls: t.Sequence[str], expose_value: bool - ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: - if not decls: - if not expose_value: - return None, [], [] - raise TypeError("Could not determine name for argument") - if len(decls) == 1: - name = arg = decls[0] - name = name.replace("-", "_").lower() - else: - raise TypeError( - "Arguments take exactly one parameter declaration, got" - f" {len(decls)}." - ) - return name, [arg], [] - - def get_usage_pieces(self, ctx: Context) -> t.List[str]: - return [self.make_metavar()] - - def get_error_hint(self, ctx: Context) -> str: - return f"'{self.make_metavar()}'" - - def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: - parser.add_argument(dest=self.name, nargs=self.nargs, obj=self) diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/gradio/components/button.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/gradio/components/button.py deleted file mode 100644 index 4d932c75becc1a324630fe6b1ad2442e229500b0..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/gradio/components/button.py +++ /dev/null @@ -1,121 +0,0 @@ -"""gr.Button() component.""" - -from __future__ import annotations - -from typing import Callable, Literal - -from gradio_client.documentation import document, set_documentation_group -from gradio_client.serializing import StringSerializable - -from gradio.components.base import Component, IOComponent, _Keywords -from gradio.deprecation import warn_deprecation, warn_style_method_deprecation -from gradio.events import Clickable - -set_documentation_group("component") - - -@document() -class Button(Clickable, IOComponent, StringSerializable): - """ - Used to create a button, that can be assigned arbitrary click() events. The label (value) of the button can be used as an input or set via the output of a function. - - Preprocessing: passes the button value as a {str} into the function - Postprocessing: expects a {str} to be returned from a function, which is set as the label of the button - Demos: blocks_inputs, blocks_kinematics - """ - - def __init__( - self, - value: str | Callable = "Run", - *, - variant: Literal["primary", "secondary", "stop"] = "secondary", - size: Literal["sm", "lg"] | None = None, - visible: bool = True, - interactive: bool = True, - elem_id: str | None = None, - elem_classes: list[str] | str | None = None, - scale: int | None = None, - min_width: int | None = None, - **kwargs, - ): - """ - Parameters: - value: Default text for the button to display. If callable, the function will be called whenever the app loads to set the initial value of the component. - variant: 'primary' for main call-to-action, 'secondary' for a more subdued style, 'stop' for a stop button. - size: Size of the button. Can be "sm" or "lg". - visible: If False, component will be hidden. - interactive: If False, the Button will be in a disabled state. - elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. - elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles. - scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer. - min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first. - """ - IOComponent.__init__( - self, - visible=visible, - elem_id=elem_id, - elem_classes=elem_classes, - value=value, - interactive=interactive, - scale=scale, - min_width=min_width, - **kwargs, - ) - if variant == "plain": - warn_deprecation("'plain' variant deprecated, using 'secondary' instead.") - variant = "secondary" - self.variant = variant - self.size = size - - def get_config(self): - return { - "value": self.value, - "variant": self.variant, - "size": self.size, - "interactive": self.interactive, - "scale": self.scale, - "min_width": self.min_width, - **Component.get_config(self), - } - - @staticmethod - def update( - value: str | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE, - variant: Literal["primary", "secondary", "stop"] | None = None, - size: Literal["sm", "lg"] | None = None, - visible: bool | None = None, - interactive: bool | None = None, - scale: int | None = None, - min_width: int | None = None, - ): - return { - "variant": variant, - "size": size, - "visible": visible, - "value": value, - "interactive": interactive, - "scale": scale, - "min_width": min_width, - "__type__": "update", - } - - def style( - self, - *, - full_width: bool | None = None, - size: Literal["sm", "lg"] | None = None, - **kwargs, - ): - """ - This method is deprecated. Please set these arguments in the constructor instead. - """ - warn_style_method_deprecation() - if full_width is not None: - warn_deprecation( - "Use `scale` in place of full_width in the constructor. " - "scale=1 will make the button expand, whereas 0 will not." - ) - self.scale = 1 if full_width else None - if size is not None: - self.size = size - return self diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-3ca142e0.css b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-3ca142e0.css deleted file mode 100644 index 77ebe6c1fea2e3557f76088bb9f5c30e2cfdb72a..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-3ca142e0.css +++ /dev/null @@ -1 +0,0 @@ -.spacer.svelte-1kspdo{display:inline-block;width:0;height:0}.json-node.svelte-1kspdo{display:inline;color:var(--body-text-color);line-height:var(--line-sm);font-family:var(--font-mono)}.expand-array.svelte-1kspdo{border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);background:var(--background-fill-secondary);padding:0 var(--size-1);color:var(--body-text-color)}.expand-array.svelte-1kspdo:hover{background:var(--background-fill-primary)}.children.svelte-1kspdo{padding-left:var(--size-4)}.json-item.svelte-1kspdo{display:inline}.null.svelte-1kspdo{color:var(--body-text-color-subdued)}.string.svelte-1kspdo{color:var(--color-green-500)}.number.svelte-1kspdo{color:var(--color-blue-500)}.bool.svelte-1kspdo{color:var(--color-red-500)}.json-holder.svelte-1trjy9a{padding:var(--size-2)}button.svelte-1trjy9a{display:flex;position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);align-items:center;box-shadow:var(--shadow-drop);border:1px solid var(--border-color-primary);border-top:none;border-right:none;border-radius:var(--block-label-right-radius);background:var(--block-label-background-fill);padding:5px;width:22px;height:22px;overflow:hidden;color:var(--block-label-text-color);font:var(--font);font-size:var(--button-small-text-size)} diff --git a/spaces/cihyFjudo/fairness-paper-search/ArchiCad 21 3010 (Rus) A Review of the Benefits and Drawbacks.md b/spaces/cihyFjudo/fairness-paper-search/ArchiCad 21 3010 (Rus) A Review of the Benefits and Drawbacks.md deleted file mode 100644 index f82b0c50f6d3667e9dc4e95a2ffc487a92e0bbb5..0000000000000000000000000000000000000000 --- a/spaces/cihyFjudo/fairness-paper-search/ArchiCad 21 3010 (Rus) A Review of the Benefits and Drawbacks.md +++ /dev/null @@ -1,6 +0,0 @@ -

    ArchiCad 21 3010 (Rus)


    Download File ———>>> https://tinurli.com/2uwhJe



    -
    - aaccfb2cb3
    -
    -
    -

    diff --git a/spaces/cihyFjudo/fairness-paper-search/Battlefield 1942 (Pc game Highly Compressed) at Just 216Mb How to Install and Run.md b/spaces/cihyFjudo/fairness-paper-search/Battlefield 1942 (Pc game Highly Compressed) at Just 216Mb How to Install and Run.md deleted file mode 100644 index 961e59a4b9b7138d6f7d80e2f2ae930d82be8446..0000000000000000000000000000000000000000 --- a/spaces/cihyFjudo/fairness-paper-search/Battlefield 1942 (Pc game Highly Compressed) at Just 216Mb How to Install and Run.md +++ /dev/null @@ -1,9 +0,0 @@ - -

    Capturing control points allow the team to reinforce themselves by enabling players and vehicles to spawn in the vicinity of the control point. Consequently, capturing and controlling these points also will reduce enemy reinforcements. Battlefield 1942 was one of the first mainstream games to represent a dramatic shift in FPS gameplay mentality by not only favoring individualism, but simultaneously encouraging teamwork and coordination.

    -

    Battlefield 1942 (Pc game Highly Compressed) | 216Mb only


    Download »»» https://tinurli.com/2uwj1X



    -

    Battlefield 1942 Game is a shooter game that was developed by DICE and published by Electronic Arts. This game was released on 10 September 2002. We have played many Highly compressed pc games but never ever played Battlefield 1942 game with full features. This game is full of entertainment, High-Quality graphics, a user-friendly interface, and an awesome sound system.

    -

    There are a lot of websites which offers tons of game free but not gives complete information and direct download link. So, no need to worry about it because here you will get all these only in one click. Battlefield 1942 game download is released for Microsoft Windows, Xbox, Classic Mac OS. You can also Flat Kingdom Game Download For PC Full Version

    -

    And Johan Persson is the programmer of battlefield 1942.In addition to the development team the artist of this game Stefan Vukanovic.Joel Eriksson id the composer of this game. And for Mac OS X it released on 28 June 2004. Moreover, this game gets favorable and mixed reviews from critics.

    -

    aaccfb2cb3
    -
    -
    \ No newline at end of file diff --git a/spaces/cihyFjudo/fairness-paper-search/Modern Warriors Full Movie Kickass Torrent The Best Way to Enjoy the Thrilling Story.md b/spaces/cihyFjudo/fairness-paper-search/Modern Warriors Full Movie Kickass Torrent The Best Way to Enjoy the Thrilling Story.md deleted file mode 100644 index 4fb06f3cdf098d46273d879927e8cee31807d1b7..0000000000000000000000000000000000000000 --- a/spaces/cihyFjudo/fairness-paper-search/Modern Warriors Full Movie Kickass Torrent The Best Way to Enjoy the Thrilling Story.md +++ /dev/null @@ -1,12 +0,0 @@ -
    -

    But torrent is always a highly controversial item and under heavy internet censorship, not for the use of peer-to-peer/P2P technology, but for the endless pirated content being uploaded here without control, which has a very negative impact on related industries, especially the movie industry. Many film distribution companies claim that their box-office revenues are hurt greatly by the increasing pirated copies online. Consequently, the companies, ISPs, and governments usually put pressure on pirated content delivering sites and finally force the webmasters to shut the sites down.

    -

    Modern Warriors full movie kickass torrent


    Download Zip »»» https://tinurli.com/2uwjaW



    -

    TorrentDownloads offers various popular torrent resources on TV Shows, movies, music, games, software, anime, book and so forth. You can easily find quite a lot of new titles like House of the Dragon S01, Animal Kingdom, and Top Gun Mavericks (2022) at a high health level. But getting new episodes could be risky since you may be detected and warned by the ISP.

    -

    Torlock accumulates torrents for movies, TVs, music, games, software, anime, eBooks, as well as niche images, adult etc. Many hot searched or trending titles are displayed right below the navigation bar for one-click access to the download page without searching manually.

    -

    the book of lies j.w hofstetter pdf download
    Nero 7 Full (All Versions) Serial Key keygen
    silsila 1981 720p dvdrip x264 ac3 dolby digital 5 1 drc
    fairy tail lisanna xxx parodie paradise
    bengali movie goynar baksho full download
    serial key all-in-one keylogger key code
    Antares Autotune Evo VST RTAS v8.0.10 PROPER 2018 .rar
    netzwerk a1 arbeitsbuch pdf 13
    ra one hd movie full download
    Sulek Sonata Trombone Vox Gabrieli Pdf

    -

    Arguably the best Marvel origin story and one of the best action movies of all time, full stop. T'Challa (Chadwick Boseman, RIP) may be the Black Panther, but it's the women of Wakanda who stand out in this megahit. There's Shuri (Letitia Wright) with all of her brilliant gadgets and technology, Okoye (Danai Gurai), the head of the all-female special forces, Nakia (Lupita Nyong'o), the superspy, and, of course, the magnificent queen mother Ramonda (Angela Bassett).

    -

    Because of the pandemic, some great movies didn't get their full due at the box office. One exception: Shang-Chi and the Legends of the Ten Rings, a Marvel origin story that broke several records and was one of the highest-grossing films of the year. Stream it on Disney+ and find out why this was one of the best movies of 2021.

    -

    -

    In 2019 we saw yet another reboot of this famous 1970s television show, but the modern-day cinematic OGs will always be Drew Barrymore, Cameron Diaz, and Lucy Liu. They even have a Destiny's Child song to prove it. We love the campy good fun mixed with hard-core action sequences of these movies so much.

    aaccfb2cb3
    -
    -
    \ No newline at end of file diff --git a/spaces/cihyFjudo/fairness-paper-search/Shadow Of The Tomb Raider Crack [Cpy 3dm Codex] Download Now! - Free and Fast.md b/spaces/cihyFjudo/fairness-paper-search/Shadow Of The Tomb Raider Crack [Cpy 3dm Codex] Download Now! - Free and Fast.md deleted file mode 100644 index 528a4721515e1a507834fce4e592adad279fe7e0..0000000000000000000000000000000000000000 --- a/spaces/cihyFjudo/fairness-paper-search/Shadow Of The Tomb Raider Crack [Cpy 3dm Codex] Download Now! - Free and Fast.md +++ /dev/null @@ -1,6 +0,0 @@ -

    Shadow Of The Tomb Raider Crack [Cpy, 3dm Codex] Download Here!


    Downloadhttps://tinurli.com/2uwjWd



    -
    - aaccfb2cb3
    -
    -
    -

    diff --git a/spaces/cihyFjudo/fairness-paper-search/Volleyball Rules In Marathi Tips And Tricks To Improve Your Skills And Performance.md b/spaces/cihyFjudo/fairness-paper-search/Volleyball Rules In Marathi Tips And Tricks To Improve Your Skills And Performance.md deleted file mode 100644 index bd64f05e2bc3e00ec3701101975278c2e6b0a91c..0000000000000000000000000000000000000000 --- a/spaces/cihyFjudo/fairness-paper-search/Volleyball Rules In Marathi Tips And Tricks To Improve Your Skills And Performance.md +++ /dev/null @@ -1,30 +0,0 @@ - -

    In volleyball, there are six players on the court for each team. Each player starts in a specific location, but these locations are not to be confused with player positions-(setter, middle blocker, outside hitter, opposite or libero). Each player, with the exception of the libero, will rotate to each location in a clockwise manner before each serve.

    -

    Volleyball Rules In Marathi


    Download Filehttps://tinurli.com/2uwjml



    -

    Youth Volleyball can bring great benefits to children in offering opportunities for exercise that is crucial for health and also for socialization and learning how to be part of a community. A team sport that involves team strength in children is an excellent quality for life to learn the significance of setting objectives and working towards accomplishing them. Children who start to play volleyball will get more benefits of hard work at an early age.

    -

    In addition to teaching your players the techniques and skills needed to play the game, being a great coach means acting as a mentor and role model for your team, instilling good sportsmanship within and motivating your players to continue their development in becoming a great volleyball player through hard work and dedication to the sport.

    -

    Boise Parks and Recreation Department offers organized weeknight adult league volleyball at all levels of play. Programs are available for ages 16 and older.Registration is accepted on a team basis only. Schedules and StandingsRulessummer sand volleyball rulesAbout the Leagues Coed Summer Sand Volleyball LeagueThis league is open to all levels of volleyball play ranging from our power division to our friendly recreational division. Games are played 4 on 4 with unlimited substitutions.

    -

    Get Involved. Volunteer to Coach!
    Knowledgeable volunteer coaches are the backbone and face of our youth athletic programs. They teach skills, provide leaderships, and lead practices and games throughout the season. League schedules vary, but most leagues have one practice each week and a game on Saturday.

    All of our coaches are trained and certified through the National Youth Sports Coaches Association (NYSCA). All volunteers are required to complete a background check before participating in any practices or games. The Town of Apex follows guidelines suggested by the National Recreation and Park Association (NRPA) for denying applications to serve as a volunteer coach. Find a list of criteria that will result in an application being denied approval to serve as a volunteer coach (PDF). If you are interested in and eligible to volunteer to coach any of our programs, please click the link below and fill out your information.
    Volunteer to coach volleyball!

    -

    The game of volleyball is attractive to all types of players and can be played with minimal equipment. A match is won by the team that wins the best of three sets. A set is won by the team which first scores 25 points with a minimum lead of 2 points. A team can consist of up to 12 players.

    -

    -

    Proper training decreases ACL injury rates in basketball, volleyball and soccer. The techniques that improve ACL safety can also enhance performance, and increase vertical jump height, acceleration and the ability to change direction.

    -

    Volleyball is undoubtedly one of the most intriguing sports in the world, and the development of international volleyball leagues and competitions, including those run by the Fédération Internationale de Volleyball (FIVB), has allowed India to become acquainted with some of the most famous volleyball players of India.

    -

    He is one of the most well-known volleyball players from Kerala. He has competed for India in several national and international competitions, including the 1986 Asian Games in Seoul, when he captained the Indian team to a bronze medal. In the 1980s volleyball team, his partnership with Jimmy George made them a force to be reckoned with, as they both played for the country. In 1986, he received the Arjuna Award for his services to Indian volleyball.

    -

    Ashok Park,Row House No. 20,
    Near Suncity,Sinhgad Road,
    Pune 411 041.
    Phone :+ 91-9881342708 / 9730016017
    tennisvolleyball2018@gmail.com Copyright © 2022 Tennis Volleyball. All Rights Reserved | Design by Qbyte Solutions

    -

    Rocky Top Sports World is the perfect place to host your next volleyball tournament! With 12 indoor courts (and five more onsite), bleacher seating, three team rooms, and our very own restaurant, our sports facilities have everything you need for an amazing volleyball event.

    -

    In addition to being a ton of fun, playing volleyball is also one of the best ways to stay in shape. Here are the top five health benefits of playing volleyball at our Smoky Mountain sports complex:

    -

    One of the best benefits of playing volleyball is that it helps to burn off calories. As a result, your body can effectively maintain a positive ratio between muscle and fat. It has been estimated that just a half hour game of competitive volleyball can burn anywhere from 120 to 178 calories, while a less competitive game may result in 90 to 133 calories burned off. Volleyball is a great way to maintain a healthy weight, which reduces the risks of heart disease, diabetes, and hypertension.

    -

    The physical motions used while playing volleyball help to build the muscles in your upper and lower body. You squat and use your legs for power when passing the ball, and use your hands, arms, and legs to set the ball. Since playing volleyball requires constant use of the arms and legs, you are effectively gaining the benefits of a full body workout! In addition to building strength and improving your respiratory and cardiovascular systems, you will receive the added benefit of toning your muscles.

    -

    New volleyball players quickly improve their coordination, balance, and speed. The sport involves all of these important abilities, since the game play consists of serving, passing, setting, blocking, and much more. These essential skills are used constantly to be effective in volleyball games, so you will notice yourself developing these skills more with each match!

    -

    While it may seem surprising, studies have shown that someone playing even a slow paced 20 minute game of volleyball can use the identical amount of energy as a person jogging for a mile. By playing a more intense game of volleyball, you use the same amount of energy in just 12 minutes as someone jogging a mile! Longer and more competitive games have even more tremendous health benefits. In addition to enhancing your energy level, your increased aerobic activity will improve your performance in a variety of other sports.

    -

    Volleyball at the YMCA provides youth with low-pressure opportunities to learn the rules and fundamentals of the game in a fun and supportive environment. Micro, Recreational, and Spirit (competitive) leagues are available along with camps, clinics, and tournaments throughout the year.

    -

    Kindergarten and 1st Grade | Micro Volleyball is a great introduction to the sport! The six-week, 4 vs. 4 season will include a 25-minute practice followed by a 25-minute game each week. Players enjoy modified rules for different ages to provide maximum success.

    -

    Kindergarten - 8th Grade | YMCA Youth Sports offers some great ways to refine your child's volleyball skills with programs that focus on fundamentals, positive coaching and personal attention.

    -

    Like basketball, volleyball was invented at a YMCA to give members and participants an active game to play indoors. And did it ever catch on. Now volleyball is one of the most popular games at outdoor barbecues, in high school and collegiate athletics, and even at the Olympics.

    -

    4. The server must get the ball over the net from behind the back line using a legal serve technique to start play. Teammates cannot help the ball over the net on the serve. If the ball hits the net on a serve but still goes over that is a legal serve. If the ball hits anything else other than the net on the serve including the ceiling it is considered out of bounds and is a point for the other team. There are no 'faults' in volleyball such as in tennis.

    -

    Raleigh Parks offers open play times for participants to play sports in our indoor facilities. Sports vary by location and may include basketball, volleyball, futsal, table tennis, or cricket. Participants may reach out to the individual centers to learn more about the opportunities at that location.

    -

    The above are general rules for suspension. These rules are not all-inclusive. Violation of these rules can lead to suspension from one day to an indefinite time period from all locations. Please see the community center staff for a more detailed explanation.

    -

    We are especially excited that these are SAFE and FUN esports competitions designed for players of all ages. GGLeagues will have tournament admins and referees who will be present to enforce the rules, ensure the safety of all players, and most importantly make sure everyone is having a great time.

    -

    Montgomery County Recreation offers a variety of youth volleyball leagues for ages 10-17 for both girls and boys. Our leagues on average run 7-8 weeks and include and evaluation day (not a try out), 5-6 weeks of practices/matches, and a playoff day to end the season. Please see our upcoming seasons, dates, and locations below.

    aaccfb2cb3
    -
    -
    \ No newline at end of file diff --git a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/PIL/ImageEnhance.py b/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/PIL/ImageEnhance.py deleted file mode 100644 index 3b79d5c46a16ce89dfff1694f0121a743d8fa0c7..0000000000000000000000000000000000000000 --- a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/PIL/ImageEnhance.py +++ /dev/null @@ -1,103 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# image enhancement classes -# -# For a background, see "Image Processing By Interpolation and -# Extrapolation", Paul Haeberli and Douglas Voorhies. Available -# at http://www.graficaobscura.com/interp/index.html -# -# History: -# 1996-03-23 fl Created -# 2009-06-16 fl Fixed mean calculation -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# - -from . import Image, ImageFilter, ImageStat - - -class _Enhance: - def enhance(self, factor): - """ - Returns an enhanced image. - - :param factor: A floating point value controlling the enhancement. - Factor 1.0 always returns a copy of the original image, - lower factors mean less color (brightness, contrast, - etc), and higher values more. There are no restrictions - on this value. - :rtype: :py:class:`~PIL.Image.Image` - """ - return Image.blend(self.degenerate, self.image, factor) - - -class Color(_Enhance): - """Adjust image color balance. - - This class can be used to adjust the colour balance of an image, in - a manner similar to the controls on a colour TV set. An enhancement - factor of 0.0 gives a black and white image. A factor of 1.0 gives - the original image. - """ - - def __init__(self, image): - self.image = image - self.intermediate_mode = "L" - if "A" in image.getbands(): - self.intermediate_mode = "LA" - - self.degenerate = image.convert(self.intermediate_mode).convert(image.mode) - - -class Contrast(_Enhance): - """Adjust image contrast. - - This class can be used to control the contrast of an image, similar - to the contrast control on a TV set. An enhancement factor of 0.0 - gives a solid grey image. A factor of 1.0 gives the original image. - """ - - def __init__(self, image): - self.image = image - mean = int(ImageStat.Stat(image.convert("L")).mean[0] + 0.5) - self.degenerate = Image.new("L", image.size, mean).convert(image.mode) - - if "A" in image.getbands(): - self.degenerate.putalpha(image.getchannel("A")) - - -class Brightness(_Enhance): - """Adjust image brightness. - - This class can be used to control the brightness of an image. An - enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the - original image. - """ - - def __init__(self, image): - self.image = image - self.degenerate = Image.new(image.mode, image.size, 0) - - if "A" in image.getbands(): - self.degenerate.putalpha(image.getchannel("A")) - - -class Sharpness(_Enhance): - """Adjust image sharpness. - - This class can be used to adjust the sharpness of an image. An - enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the - original image, and a factor of 2.0 gives a sharpened image. - """ - - def __init__(self, image): - self.image = image - self.degenerate = image.filter(ImageFilter.SMOOTH) - - if "A" in image.getbands(): - self.degenerate.putalpha(image.getchannel("A")) diff --git a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/altair/utils/server.py b/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/altair/utils/server.py deleted file mode 100644 index f2dfc29ec4b5d1cbf37a87fe7ce70fff27b022a5..0000000000000000000000000000000000000000 --- a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/altair/utils/server.py +++ /dev/null @@ -1,148 +0,0 @@ -""" -A Simple server used to show altair graphics from a prompt or script. - -This is adapted from the mpld3 package; see -https://github.com/mpld3/mpld3/blob/master/mpld3/_server.py -""" -import sys -import threading -import webbrowser -import socket -from http import server -from io import BytesIO as IO -import itertools -import random - -JUPYTER_WARNING = """ -Note: if you're in the Jupyter notebook, Chart.serve() is not the best - way to view plots. Consider using Chart.display(). -You must interrupt the kernel to cancel this command. -""" - - -# Mock server used for testing - - -class MockRequest: - def makefile(self, *args, **kwargs): - return IO(b"GET /") - - def sendall(self, response): - pass - - -class MockServer: - def __init__(self, ip_port, Handler): - Handler(MockRequest(), ip_port[0], self) - - def serve_forever(self): - pass - - def server_close(self): - pass - - -def generate_handler(html, files=None): - if files is None: - files = {} - - class MyHandler(server.BaseHTTPRequestHandler): - def do_GET(self): - """Respond to a GET request.""" - if self.path == "/": - self.send_response(200) - self.send_header("Content-type", "text/html") - self.end_headers() - self.wfile.write(html.encode()) - elif self.path in files: - content_type, content = files[self.path] - self.send_response(200) - self.send_header("Content-type", content_type) - self.end_headers() - self.wfile.write(content.encode()) - else: - self.send_error(404) - - return MyHandler - - -def find_open_port(ip, port, n=50): - """Find an open port near the specified port""" - ports = itertools.chain( - (port + i for i in range(n)), (port + random.randint(-2 * n, 2 * n)) - ) - - for port in ports: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - result = s.connect_ex((ip, port)) - s.close() - if result != 0: - return port - raise ValueError("no open ports found") - - -def serve( - html, - ip="127.0.0.1", - port=8888, - n_retries=50, - files=None, - jupyter_warning=True, - open_browser=True, - http_server=None, -): - """Start a server serving the given HTML, and (optionally) open a browser - - Parameters - ---------- - html : string - HTML to serve - ip : string (default = '127.0.0.1') - ip address at which the HTML will be served. - port : int (default = 8888) - the port at which to serve the HTML - n_retries : int (default = 50) - the number of nearby ports to search if the specified port is in use. - files : dictionary (optional) - dictionary of extra content to serve - jupyter_warning : bool (optional) - if True (default), then print a warning if this is used within Jupyter - open_browser : bool (optional) - if True (default), then open a web browser to the given HTML - http_server : class (optional) - optionally specify an HTTPServer class to use for showing the - figure. The default is Python's basic HTTPServer. - """ - port = find_open_port(ip, port, n_retries) - Handler = generate_handler(html, files) - - if http_server is None: - srvr = server.HTTPServer((ip, port), Handler) - else: - srvr = http_server((ip, port), Handler) - - if jupyter_warning: - try: - __IPYTHON__ # noqa - except NameError: - pass - else: - print(JUPYTER_WARNING) - - # Start the server - print("Serving to http://{}:{}/ [Ctrl-C to exit]".format(ip, port)) - sys.stdout.flush() - - if open_browser: - # Use a thread to open a web browser pointing to the server - def b(): - return webbrowser.open("http://{}:{}".format(ip, port)) - - threading.Thread(target=b).start() - - try: - srvr.serve_forever() - except (KeyboardInterrupt, SystemExit): - print("\nstopping Server...") - - srvr.server_close() diff --git a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/fastapi/utils.py b/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/fastapi/utils.py deleted file mode 100644 index 267d64ce8aee9eaf5462d9cbd47deca44cfdef28..0000000000000000000000000000000000000000 --- a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/fastapi/utils.py +++ /dev/null @@ -1,228 +0,0 @@ -import re -import warnings -from dataclasses import is_dataclass -from typing import ( - TYPE_CHECKING, - Any, - Dict, - MutableMapping, - Optional, - Set, - Type, - Union, - cast, -) -from weakref import WeakKeyDictionary - -import fastapi -from fastapi._compat import ( - PYDANTIC_V2, - BaseConfig, - ModelField, - PydanticSchemaGenerationError, - Undefined, - UndefinedType, - Validator, - lenient_issubclass, -) -from fastapi.datastructures import DefaultPlaceholder, DefaultType -from pydantic import BaseModel, create_model -from pydantic.fields import FieldInfo -from typing_extensions import Literal - -if TYPE_CHECKING: # pragma: nocover - from .routing import APIRoute - -# Cache for `create_cloned_field` -_CLONED_TYPES_CACHE: MutableMapping[ - Type[BaseModel], Type[BaseModel] -] = WeakKeyDictionary() - - -def is_body_allowed_for_status_code(status_code: Union[int, str, None]) -> bool: - if status_code is None: - return True - # Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#patterned-fields-1 - if status_code in { - "default", - "1XX", - "2XX", - "3XX", - "4XX", - "5XX", - }: - return True - current_status_code = int(status_code) - return not (current_status_code < 200 or current_status_code in {204, 304}) - - -def get_path_param_names(path: str) -> Set[str]: - return set(re.findall("{(.*?)}", path)) - - -def create_response_field( - name: str, - type_: Type[Any], - class_validators: Optional[Dict[str, Validator]] = None, - default: Optional[Any] = Undefined, - required: Union[bool, UndefinedType] = Undefined, - model_config: Type[BaseConfig] = BaseConfig, - field_info: Optional[FieldInfo] = None, - alias: Optional[str] = None, - mode: Literal["validation", "serialization"] = "validation", -) -> ModelField: - """ - Create a new response field. Raises if type_ is invalid. - """ - class_validators = class_validators or {} - if PYDANTIC_V2: - field_info = field_info or FieldInfo( - annotation=type_, default=default, alias=alias - ) - else: - field_info = field_info or FieldInfo() - kwargs = {"name": name, "field_info": field_info} - if PYDANTIC_V2: - kwargs.update({"mode": mode}) - else: - kwargs.update( - { - "type_": type_, - "class_validators": class_validators, - "default": default, - "required": required, - "model_config": model_config, - "alias": alias, - } - ) - try: - return ModelField(**kwargs) # type: ignore[arg-type] - except (RuntimeError, PydanticSchemaGenerationError): - raise fastapi.exceptions.FastAPIError( - "Invalid args for response field! Hint: " - f"check that {type_} is a valid Pydantic field type. " - "If you are using a return type annotation that is not a valid Pydantic " - "field (e.g. Union[Response, dict, None]) you can disable generating the " - "response model from the type annotation with the path operation decorator " - "parameter response_model=None. Read more: " - "https://fastapi.tiangolo.com/tutorial/response-model/" - ) from None - - -def create_cloned_field( - field: ModelField, - *, - cloned_types: Optional[MutableMapping[Type[BaseModel], Type[BaseModel]]] = None, -) -> ModelField: - if PYDANTIC_V2: - return field - # cloned_types caches already cloned types to support recursive models and improve - # performance by avoiding unecessary cloning - if cloned_types is None: - cloned_types = _CLONED_TYPES_CACHE - - original_type = field.type_ - if is_dataclass(original_type) and hasattr(original_type, "__pydantic_model__"): - original_type = original_type.__pydantic_model__ - use_type = original_type - if lenient_issubclass(original_type, BaseModel): - original_type = cast(Type[BaseModel], original_type) - use_type = cloned_types.get(original_type) - if use_type is None: - use_type = create_model(original_type.__name__, __base__=original_type) - cloned_types[original_type] = use_type - for f in original_type.__fields__.values(): - use_type.__fields__[f.name] = create_cloned_field( - f, cloned_types=cloned_types - ) - new_field = create_response_field(name=field.name, type_=use_type) - new_field.has_alias = field.has_alias # type: ignore[attr-defined] - new_field.alias = field.alias # type: ignore[misc] - new_field.class_validators = field.class_validators # type: ignore[attr-defined] - new_field.default = field.default # type: ignore[misc] - new_field.required = field.required # type: ignore[misc] - new_field.model_config = field.model_config # type: ignore[attr-defined] - new_field.field_info = field.field_info - new_field.allow_none = field.allow_none # type: ignore[attr-defined] - new_field.validate_always = field.validate_always # type: ignore[attr-defined] - if field.sub_fields: # type: ignore[attr-defined] - new_field.sub_fields = [ # type: ignore[attr-defined] - create_cloned_field(sub_field, cloned_types=cloned_types) - for sub_field in field.sub_fields # type: ignore[attr-defined] - ] - if field.key_field: # type: ignore[attr-defined] - new_field.key_field = create_cloned_field( # type: ignore[attr-defined] - field.key_field, cloned_types=cloned_types # type: ignore[attr-defined] - ) - new_field.validators = field.validators # type: ignore[attr-defined] - new_field.pre_validators = field.pre_validators # type: ignore[attr-defined] - new_field.post_validators = field.post_validators # type: ignore[attr-defined] - new_field.parse_json = field.parse_json # type: ignore[attr-defined] - new_field.shape = field.shape # type: ignore[attr-defined] - new_field.populate_validators() # type: ignore[attr-defined] - return new_field - - -def generate_operation_id_for_path( - *, name: str, path: str, method: str -) -> str: # pragma: nocover - warnings.warn( - "fastapi.utils.generate_operation_id_for_path() was deprecated, " - "it is not used internally, and will be removed soon", - DeprecationWarning, - stacklevel=2, - ) - operation_id = name + path - operation_id = re.sub(r"\W", "_", operation_id) - operation_id = operation_id + "_" + method.lower() - return operation_id - - -def generate_unique_id(route: "APIRoute") -> str: - operation_id = route.name + route.path_format - operation_id = re.sub(r"\W", "_", operation_id) - assert route.methods - operation_id = operation_id + "_" + list(route.methods)[0].lower() - return operation_id - - -def deep_dict_update(main_dict: Dict[Any, Any], update_dict: Dict[Any, Any]) -> None: - for key, value in update_dict.items(): - if ( - key in main_dict - and isinstance(main_dict[key], dict) - and isinstance(value, dict) - ): - deep_dict_update(main_dict[key], value) - elif ( - key in main_dict - and isinstance(main_dict[key], list) - and isinstance(update_dict[key], list) - ): - main_dict[key] = main_dict[key] + update_dict[key] - else: - main_dict[key] = value - - -def get_value_or_default( - first_item: Union[DefaultPlaceholder, DefaultType], - *extra_items: Union[DefaultPlaceholder, DefaultType], -) -> Union[DefaultPlaceholder, DefaultType]: - """ - Pass items or `DefaultPlaceholder`s by descending priority. - - The first one to _not_ be a `DefaultPlaceholder` will be returned. - - Otherwise, the first item (a `DefaultPlaceholder`) will be returned. - """ - items = (first_item,) + extra_items - for item in items: - if not isinstance(item, DefaultPlaceholder): - return item - return first_item - - -def match_pydantic_error_url(error_type: str) -> Any: - from dirty_equals import IsStr - - return IsStr(regex=rf"^https://errors\.pydantic\.dev/.*/v/{error_type}") diff --git a/spaces/colakin/video-generater/public/ffmpeg/doc/examples/qsv_decode.c b/spaces/colakin/video-generater/public/ffmpeg/doc/examples/qsv_decode.c deleted file mode 100644 index cc2662d5bdd4bcc1c9bc379c58a4f50d0a2caeb1..0000000000000000000000000000000000000000 --- a/spaces/colakin/video-generater/public/ffmpeg/doc/examples/qsv_decode.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2015 Anton Khirnov - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/** - * @file Intel QSV-accelerated H.264 decoding API usage example - * @example qsv_decode.c - * - * Perform QSV-accelerated H.264 decoding with output frames in the - * GPU video surfaces, write the decoded frames to an output file. - */ - -#include "config.h" - -#include - -#include "libavformat/avformat.h" -#include "libavformat/avio.h" - -#include "libavcodec/avcodec.h" - -#include "libavutil/buffer.h" -#include "libavutil/error.h" -#include "libavutil/hwcontext.h" -#include "libavutil/hwcontext_qsv.h" -#include "libavutil/mem.h" - -static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts) -{ - while (*pix_fmts != AV_PIX_FMT_NONE) { - if (*pix_fmts == AV_PIX_FMT_QSV) { - return AV_PIX_FMT_QSV; - } - - pix_fmts++; - } - - fprintf(stderr, "The QSV pixel format not offered in get_format()\n"); - - return AV_PIX_FMT_NONE; -} - -static int decode_packet(AVCodecContext *decoder_ctx, - AVFrame *frame, AVFrame *sw_frame, - AVPacket *pkt, AVIOContext *output_ctx) -{ - int ret = 0; - - ret = avcodec_send_packet(decoder_ctx, pkt); - if (ret < 0) { - fprintf(stderr, "Error during decoding\n"); - return ret; - } - - while (ret >= 0) { - int i, j; - - ret = avcodec_receive_frame(decoder_ctx, frame); - if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) - break; - else if (ret < 0) { - fprintf(stderr, "Error during decoding\n"); - return ret; - } - - /* A real program would do something useful with the decoded frame here. - * We just retrieve the raw data and write it to a file, which is rather - * useless but pedagogic. */ - ret = av_hwframe_transfer_data(sw_frame, frame, 0); - if (ret < 0) { - fprintf(stderr, "Error transferring the data to system memory\n"); - goto fail; - } - - for (i = 0; i < FF_ARRAY_ELEMS(sw_frame->data) && sw_frame->data[i]; i++) - for (j = 0; j < (sw_frame->height >> (i > 0)); j++) - avio_write(output_ctx, sw_frame->data[i] + j * sw_frame->linesize[i], sw_frame->width); - -fail: - av_frame_unref(sw_frame); - av_frame_unref(frame); - - if (ret < 0) - return ret; - } - - return 0; -} - -int main(int argc, char **argv) -{ - AVFormatContext *input_ctx = NULL; - AVStream *video_st = NULL; - AVCodecContext *decoder_ctx = NULL; - const AVCodec *decoder; - - AVPacket *pkt = NULL; - AVFrame *frame = NULL, *sw_frame = NULL; - - AVIOContext *output_ctx = NULL; - - int ret, i; - - AVBufferRef *device_ref = NULL; - - if (argc < 3) { - fprintf(stderr, "Usage: %s \n", argv[0]); - return 1; - } - - /* open the input file */ - ret = avformat_open_input(&input_ctx, argv[1], NULL, NULL); - if (ret < 0) { - fprintf(stderr, "Cannot open input file '%s': ", argv[1]); - goto finish; - } - - /* find the first H.264 video stream */ - for (i = 0; i < input_ctx->nb_streams; i++) { - AVStream *st = input_ctx->streams[i]; - - if (st->codecpar->codec_id == AV_CODEC_ID_H264 && !video_st) - video_st = st; - else - st->discard = AVDISCARD_ALL; - } - if (!video_st) { - fprintf(stderr, "No H.264 video stream in the input file\n"); - goto finish; - } - - /* open the hardware device */ - ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_QSV, - "auto", NULL, 0); - if (ret < 0) { - fprintf(stderr, "Cannot open the hardware device\n"); - goto finish; - } - - /* initialize the decoder */ - decoder = avcodec_find_decoder_by_name("h264_qsv"); - if (!decoder) { - fprintf(stderr, "The QSV decoder is not present in libavcodec\n"); - goto finish; - } - - decoder_ctx = avcodec_alloc_context3(decoder); - if (!decoder_ctx) { - ret = AVERROR(ENOMEM); - goto finish; - } - decoder_ctx->codec_id = AV_CODEC_ID_H264; - if (video_st->codecpar->extradata_size) { - decoder_ctx->extradata = av_mallocz(video_st->codecpar->extradata_size + - AV_INPUT_BUFFER_PADDING_SIZE); - if (!decoder_ctx->extradata) { - ret = AVERROR(ENOMEM); - goto finish; - } - memcpy(decoder_ctx->extradata, video_st->codecpar->extradata, - video_st->codecpar->extradata_size); - decoder_ctx->extradata_size = video_st->codecpar->extradata_size; - } - - - decoder_ctx->hw_device_ctx = av_buffer_ref(device_ref); - decoder_ctx->get_format = get_format; - - ret = avcodec_open2(decoder_ctx, NULL, NULL); - if (ret < 0) { - fprintf(stderr, "Error opening the decoder: "); - goto finish; - } - - /* open the output stream */ - ret = avio_open(&output_ctx, argv[2], AVIO_FLAG_WRITE); - if (ret < 0) { - fprintf(stderr, "Error opening the output context: "); - goto finish; - } - - frame = av_frame_alloc(); - sw_frame = av_frame_alloc(); - pkt = av_packet_alloc(); - if (!frame || !sw_frame || !pkt) { - ret = AVERROR(ENOMEM); - goto finish; - } - - /* actual decoding */ - while (ret >= 0) { - ret = av_read_frame(input_ctx, pkt); - if (ret < 0) - break; - - if (pkt->stream_index == video_st->index) - ret = decode_packet(decoder_ctx, frame, sw_frame, pkt, output_ctx); - - av_packet_unref(pkt); - } - - /* flush the decoder */ - ret = decode_packet(decoder_ctx, frame, sw_frame, NULL, output_ctx); - -finish: - if (ret < 0) { - char buf[1024]; - av_strerror(ret, buf, sizeof(buf)); - fprintf(stderr, "%s\n", buf); - } - - avformat_close_input(&input_ctx); - - av_frame_free(&frame); - av_frame_free(&sw_frame); - av_packet_free(&pkt); - - avcodec_free_context(&decoder_ctx); - - av_buffer_unref(&device_ref); - - avio_close(output_ctx); - - return ret; -} diff --git a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c b/spaces/colakin/video-generater/public/ffmpeg/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c deleted file mode 100644 index d2a4e90b3ad89823d4fd63400f88b1106ce28092..0000000000000000000000000000000000000000 --- a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/attributes.h" -#include "libavutil/internal.h" -#include "libavutil/mem_internal.h" -#include "libavutil/aarch64/cpu.h" -#include "vp9dsp_init.h" - -#define declare_fpel(type, sz, suffix) \ -void ff_vp9_##type##sz##suffix##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ - const uint8_t *src, ptrdiff_t src_stride, \ - int h, int mx, int my) - -#define decl_mc_func(op, filter, dir, sz, bpp) \ -void ff_vp9_##op##_##filter##sz##_##dir##_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ - const uint8_t *src, ptrdiff_t src_stride, \ - int h, int mx, int my) - -#define define_8tap_2d_fn(op, filter, sz, bpp) \ -static void op##_##filter##sz##_hv_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ - const uint8_t *src, \ - ptrdiff_t src_stride, \ - int h, int mx, int my) \ -{ \ - LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz * 2]); \ - /* We only need h + 7 lines, but the horizontal filter assumes an \ - * even number of rows, so filter h + 8 lines here. */ \ - ff_vp9_put_##filter##sz##_h_##bpp##_neon(temp, 2 * sz, \ - src - 3 * src_stride, src_stride, \ - h + 8, mx, 0); \ - ff_vp9_##op##_##filter##sz##_v_##bpp##_neon(dst, dst_stride, \ - temp + 3 * 2 * sz, 2 * sz, \ - h, 0, my); \ -} - -#define decl_filter_funcs(op, dir, sz, bpp) \ - decl_mc_func(op, regular, dir, sz, bpp); \ - decl_mc_func(op, sharp, dir, sz, bpp); \ - decl_mc_func(op, smooth, dir, sz, bpp) - -#define decl_mc_funcs(sz, bpp) \ - decl_filter_funcs(put, h, sz, bpp); \ - decl_filter_funcs(avg, h, sz, bpp); \ - decl_filter_funcs(put, v, sz, bpp); \ - decl_filter_funcs(avg, v, sz, bpp); \ - decl_filter_funcs(put, hv, sz, bpp); \ - decl_filter_funcs(avg, hv, sz, bpp) - -#define ff_vp9_copy32_neon ff_vp9_copy32_aarch64 -#define ff_vp9_copy64_neon ff_vp9_copy64_aarch64 -#define ff_vp9_copy128_neon ff_vp9_copy128_aarch64 - -declare_fpel(copy, 128, ); -declare_fpel(copy, 64, ); -declare_fpel(copy, 32, ); -declare_fpel(copy, 16, ); -declare_fpel(copy, 8, ); -declare_fpel(avg, 64, _16); -declare_fpel(avg, 32, _16); -declare_fpel(avg, 16, _16); -declare_fpel(avg, 8, _16); -declare_fpel(avg, 4, _16); - -decl_mc_funcs(64, BPP); -decl_mc_funcs(32, BPP); -decl_mc_funcs(16, BPP); -decl_mc_funcs(8, BPP); -decl_mc_funcs(4, BPP); - -#define define_8tap_2d_funcs(sz, bpp) \ - define_8tap_2d_fn(put, regular, sz, bpp) \ - define_8tap_2d_fn(put, sharp, sz, bpp) \ - define_8tap_2d_fn(put, smooth, sz, bpp) \ - define_8tap_2d_fn(avg, regular, sz, bpp) \ - define_8tap_2d_fn(avg, sharp, sz, bpp) \ - define_8tap_2d_fn(avg, smooth, sz, bpp) - -define_8tap_2d_funcs(64, BPP) -define_8tap_2d_funcs(32, BPP) -define_8tap_2d_funcs(16, BPP) -define_8tap_2d_funcs(8, BPP) -define_8tap_2d_funcs(4, BPP) - -static av_cold void vp9dsp_mc_init_aarch64(VP9DSPContext *dsp) -{ - int cpu_flags = av_get_cpu_flags(); - -#define init_fpel(idx1, idx2, sz, type, suffix) \ - dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ - dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ - dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ - dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##suffix - -#define init_copy(idx, sz, suffix) \ - init_fpel(idx, 0, sz, copy, suffix) - -#define init_avg(idx, sz, suffix) \ - init_fpel(idx, 1, sz, avg, suffix) - -#define init_copy_avg(idx, sz1, sz2) \ - init_copy(idx, sz2, _neon); \ - init_avg (idx, sz1, _16_neon) - - if (have_armv8(cpu_flags)) { - init_copy(0, 128, _aarch64); - init_copy(1, 64, _aarch64); - init_copy(2, 32, _aarch64); - } - - if (have_neon(cpu_flags)) { -#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx, bpp) \ - dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_##bpp##_neon - -#define init_mc_funcs(idx, dir, mx, my, sz, pfx, bpp) \ - init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ - init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ - init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp); \ - init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ - init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ - init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp) - -#define init_mc_funcs_dirs(idx, sz, bpp) \ - init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_, bpp); \ - init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_, bpp); \ - init_mc_funcs(idx, hv, 1, 1, sz, , bpp) - - - init_avg(0, 64, _16_neon); - init_avg(1, 32, _16_neon); - init_avg(2, 16, _16_neon); - init_copy_avg(3, 8, 16); - init_copy_avg(4, 4, 8); - - init_mc_funcs_dirs(0, 64, BPP); - init_mc_funcs_dirs(1, 32, BPP); - init_mc_funcs_dirs(2, 16, BPP); - init_mc_funcs_dirs(3, 8, BPP); - init_mc_funcs_dirs(4, 4, BPP); - } -} - -#define define_itxfm2(type_a, type_b, sz, bpp) \ -void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_##bpp##_neon(uint8_t *_dst, \ - ptrdiff_t stride, \ - int16_t *_block, int eob) -#define define_itxfm(type_a, type_b, sz, bpp) define_itxfm2(type_a, type_b, sz, bpp) - -#define define_itxfm_funcs(sz, bpp) \ - define_itxfm(idct, idct, sz, bpp); \ - define_itxfm(iadst, idct, sz, bpp); \ - define_itxfm(idct, iadst, sz, bpp); \ - define_itxfm(iadst, iadst, sz, bpp) - -define_itxfm_funcs(4, BPP); -define_itxfm_funcs(8, BPP); -define_itxfm_funcs(16, BPP); -define_itxfm(idct, idct, 32, BPP); -define_itxfm(iwht, iwht, 4, BPP); - - -static av_cold void vp9dsp_itxfm_init_aarch64(VP9DSPContext *dsp) -{ - int cpu_flags = av_get_cpu_flags(); - - if (have_neon(cpu_flags)) { -#define init_itxfm2(tx, sz, bpp) \ - dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_##bpp##_neon; \ - dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_##bpp##_neon; \ - dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_##bpp##_neon; \ - dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_##bpp##_neon -#define init_itxfm(tx, sz, bpp) init_itxfm2(tx, sz, bpp) - -#define init_idct2(tx, nm, bpp) \ - dsp->itxfm_add[tx][DCT_DCT] = \ - dsp->itxfm_add[tx][ADST_DCT] = \ - dsp->itxfm_add[tx][DCT_ADST] = \ - dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_##bpp##_neon -#define init_idct(tx, nm, bpp) init_idct2(tx, nm, bpp) - - init_itxfm(TX_4X4, 4x4, BPP); - init_itxfm(TX_8X8, 8x8, BPP); - init_itxfm(TX_16X16, 16x16, BPP); - init_idct(TX_32X32, idct_idct_32x32, BPP); - init_idct(4, iwht_iwht_4x4, BPP); - } -} - -#define define_loop_filter(dir, wd, size, bpp) \ -void ff_vp9_loop_filter_##dir##_##wd##_##size##_##bpp##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) - -#define define_loop_filters(wd, size, bpp) \ - define_loop_filter(h, wd, size, bpp); \ - define_loop_filter(v, wd, size, bpp) - -define_loop_filters(4, 8, BPP); -define_loop_filters(8, 8, BPP); -define_loop_filters(16, 8, BPP); - -define_loop_filters(16, 16, BPP); - -define_loop_filters(44, 16, BPP); -define_loop_filters(48, 16, BPP); -define_loop_filters(84, 16, BPP); -define_loop_filters(88, 16, BPP); - -static av_cold void vp9dsp_loopfilter_init_aarch64(VP9DSPContext *dsp) -{ - int cpu_flags = av_get_cpu_flags(); - - if (have_neon(cpu_flags)) { -#define init_lpf_func_8(idx1, idx2, dir, wd, bpp) \ - dsp->loop_filter_8[idx1][idx2] = ff_vp9_loop_filter_##dir##_##wd##_8_##bpp##_neon - -#define init_lpf_func_16(idx, dir, bpp) \ - dsp->loop_filter_16[idx] = ff_vp9_loop_filter_##dir##_16_16_##bpp##_neon - -#define init_lpf_func_mix2(idx1, idx2, idx3, dir, wd, bpp) \ - dsp->loop_filter_mix2[idx1][idx2][idx3] = ff_vp9_loop_filter_##dir##_##wd##_16_##bpp##_neon - -#define init_lpf_funcs_8_wd(idx, wd, bpp) \ - init_lpf_func_8(idx, 0, h, wd, bpp); \ - init_lpf_func_8(idx, 1, v, wd, bpp) - -#define init_lpf_funcs_16(bpp) \ - init_lpf_func_16(0, h, bpp); \ - init_lpf_func_16(1, v, bpp) - -#define init_lpf_funcs_mix2_wd(idx1, idx2, wd, bpp) \ - init_lpf_func_mix2(idx1, idx2, 0, h, wd, bpp); \ - init_lpf_func_mix2(idx1, idx2, 1, v, wd, bpp) - -#define init_lpf_funcs_8(bpp) \ - init_lpf_funcs_8_wd(0, 4, bpp); \ - init_lpf_funcs_8_wd(1, 8, bpp); \ - init_lpf_funcs_8_wd(2, 16, bpp) - -#define init_lpf_funcs_mix2(bpp) \ - init_lpf_funcs_mix2_wd(0, 0, 44, bpp); \ - init_lpf_funcs_mix2_wd(0, 1, 48, bpp); \ - init_lpf_funcs_mix2_wd(1, 0, 84, bpp); \ - init_lpf_funcs_mix2_wd(1, 1, 88, bpp) - - init_lpf_funcs_8(BPP); - init_lpf_funcs_16(BPP); - init_lpf_funcs_mix2(BPP); - } -} - -av_cold void INIT_FUNC(VP9DSPContext *dsp) -{ - vp9dsp_mc_init_aarch64(dsp); - vp9dsp_loopfilter_init_aarch64(dsp); - vp9dsp_itxfm_init_aarch64(dsp); -} diff --git a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/alpha/idctdsp_alpha.h b/spaces/colakin/video-generater/public/ffmpeg/libavcodec/alpha/idctdsp_alpha.h deleted file mode 100644 index 8cc969d7dee0f773402ef676dbb4b8072bde3311..0000000000000000000000000000000000000000 --- a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/alpha/idctdsp_alpha.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_ALPHA_IDCTDSP_ALPHA_H -#define AVCODEC_ALPHA_IDCTDSP_ALPHA_H - -#include -#include - -extern void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels, - ptrdiff_t line_size); -extern void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels, - ptrdiff_t line_size); - -void ff_simple_idct_axp(int16_t *block); -void ff_simple_idct_put_axp(uint8_t *dest, ptrdiff_t line_size, int16_t *block); -void ff_simple_idct_add_axp(uint8_t *dest, ptrdiff_t line_size, int16_t *block); - -#endif /* AVCODEC_ALPHA_IDCTDSP_ALPHA_H */ diff --git a/spaces/congsaPfin/Manga-OCR/logs/Enjoy the New Patch of Genshin Impact APK with These Tips and Tricks.md b/spaces/congsaPfin/Manga-OCR/logs/Enjoy the New Patch of Genshin Impact APK with These Tips and Tricks.md deleted file mode 100644 index 9508e488e57e39f48dfaf3a025039f85fab01e2f..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Enjoy the New Patch of Genshin Impact APK with These Tips and Tricks.md +++ /dev/null @@ -1,132 +0,0 @@ - -

    Genshin Impact New Patch APK: Everything You Need to Know

    -

    Genshin Impact is one of the most popular and immersive open-world action RPGs of recent times. It has captivated millions of players with its stunning graphics, engaging gameplay, and rich story. If you are a fan of this game, you might be wondering what the latest update has in store for you. In this article, we will tell you everything you need to know about the genshin impact new patch apk, including what is new, how to download and install it, and some tips and tricks for playing the game.

    -

    What is Genshin Impact?

    -

    Genshin Impact is a free-to-play game developed by miHoYo that was released in September 2020. In the game, you set forth on a journey across a fantasy world called Teyvat. In this vast world, you can explore seven nations, meet a diverse cast of characters with unique personalities and abilities, and fight powerful enemies together with them, all on the way during your quest to find your lost sibling.

    -

    genshin impact new patch apk


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



    -

    The game features a gacha system that allows you to obtain new characters and weapons by spending in-game currency or real money. You can also customize your own character with different outfits, accessories, and hairstyles. The game also supports cross-play between different platforms, such as PC, mobile devices, PlayStation 4, PlayStation 5, and Nintendo Switch.

    -

    What is new in the version 3.6 update?

    -

    The version 3.6 update for Genshin Impact was released on April 28th, 2023. It adds a lot of new content to the game, such as new areas, characters, domains, main story, and more . Here are some of the highlights:

    -

    New areas: Inazuma and Chasm

    -

    Inazuma is the third nation in Teyvat that you can visit after Mondstadt and Liyue. It is an archipelago of islands that are ruled by the Electro Archon, Baal. Inazuma is known for its strict isolationist policy and its reverence for eternity. You will encounter many new challenges and mysteries in this land of thunder.

    -

    Chasm is a massive cavern that lies between Liyue and Mondstadt. It is filled with ancient ruins, mysterious ores, and dangerous monsters. You will need to explore this underground world with caution and curiosity.

    -

    New characters: Ayaka, Yoimiya, and Sayu

    -

    Ayaka is a five-star Cryo sword user who is the daughter of the Kamisato Clan in Inazuma. She is elegant, graceful, and loyal to her family. She can use her elemental skill to dash through enemies and deal Cryo damage. She can also summon a blizzard with her elemental burst that continuously deals Cryo damage to enemies within its range.

    -

    Yoimiya is a five-star Pyro bow user who is the owner of Naganohara Fireworks in Inazuma. She is cheerful, energetic, and passionate about fireworks. She can use her elemental skill to imbue her arrows with Pyro damage and cause explosions on hit. She can also unleash a barrage of flaming arrows with her elemental burst that can mark enemies and cause them to explode after a delay.

    -

    Sayu is a four-star Anemo claymore user who is a ninja from the Shiyuumatsu-Ban in Inazuma. She is small, cute, and sleepy. She can use her elemental skill to roll around in a giant wind wheel and deal Anemo damage to enemies along the way. She can also summon a healing spirit with her elemental burst that can heal allies and deal Anemo damage to enemies.

    -

    genshin impact latest update apk download
    -genshin impact 3.7.0 apk free download
    -how to install genshin impact new patch on android
    -genshin impact apk mod unlimited primogems
    -genshin impact new characters and events apk
    -genshin impact apk obb data offline
    -genshin impact new patch release date and time
    -genshin impact apk for low end devices
    -genshin impact new patch notes and changes
    -genshin impact apk no verification required
    -genshin impact new patch size and requirements
    -genshin impact apk with controller support
    -genshin impact new patch bugs and fixes
    -genshin impact apk for pc windows 10
    -genshin impact new patch features and improvements
    -genshin impact apk without google play services
    -genshin impact new patch trailer and gameplay
    -genshin impact apk for ios iphone ipad
    -genshin impact new patch rewards and codes
    -genshin impact apk english version
    -genshin impact new patch spoilers and leaks
    -genshin impact apk compatible devices list
    -genshin impact new patch review and rating
    -genshin impact apk mirror link
    -genshin impact new patch download error and solution

    -

    New domains: Momiji-Dyed Court and Empty Boat of a Thousand Gates

    -

    Momiji-Dyed Court is a new domain that is located in Inazuma. It is a beautiful garden that is decorated with maple leaves and lanterns. You can challenge this domain to obtain new artifacts sets, such as the Emblem of Severed Fate and the Shimenawa's Reminiscence.

    -

    Empty Boat of a Thousand Gates is another new domain that is located in Inazuma. It is a mysterious ship that floats on the sea. You can challenge this domain to obtain new weapons, such as the Mistsplitter Reforged, the Thundering Pulse, and the Amenoma Kageuchi.

    -

    New main story: Chapter II - Act I: The Immovable God and the Eternal Euthymia

    -

    The new main story continues your adventure in Teyvat as you travel to Inazuma and meet the Electro Archon, Baal. You will learn more about her vision hunt decree, her pursuit of eternity, and her conflict with the resistance. You will also encounter new allies and enemies, such as Kazuha, Thoma, Sara, and Scaramouche.

    -

    New events: Thunder Sojourn, Phantom Flow, and more

    -

    The new update also brings a lot of new events that you can participate in to earn rewards, such as primogems, mora, talent books, and more. Some of the events are:

    -
      -
    • Thunder Sojourn: A series of challenges that test your speed and combat skills in Inazuma. You can use special devices called Thunder Spheres and Thunder Dwellings to enhance your abilities.
    • -
    • Phantom Flow: A martial arts tournament that pits you against different opponents with different rules and conditions. You can choose your difficulty level and earn different rewards accordingly.
    • -
    • Ley Line Overflow: A limited-time event that allows you to get double rewards from completing ley line outcrops. You can do this up to three times per day.
    • -
    • Lost Riches: A treasure hunting event that lets you find special coins called Iron Coins by following clues from a Seelie. You can exchange these coins for various items, such as primogems, mora, and a mini Seelie pet.
    • -
    -

    How to download and install the new patch APK?

    -

    If you want to play the new update of Genshin Impact on your Android or PC device, you will need to download and install the new patch APK. Here are the steps for doing so:

    -

    Steps for Android devices

    -
      -
    1. Go to the official website of Genshin Impact and tap on the "Download Now" button.
    2. -
    3. Select the "Android" option and tap on the "Download APK" button.
    4. -
    5. Wait for the APK file to download on your device. It should be around 1.5 GB in size.
    6. -
    7. Once the download is complete, locate the APK file on your device and tap on it to install it. You may need to enable the "Unknown Sources" option in your settings to allow the installation.
    8. -
    9. After the installation is done, launch the game and wait for it to download additional data. This may take some time depending on your internet speed.
    10. -
    11. Enjoy playing the new update of Genshin Impact!
    12. -
    -

    Steps for PC devices

    -
      -
    1. Go to the official website of Genshin Impact and click on the "Download Now" button.
    2. -
    3. Select the "Windows" option and click on the "Download Game" button.
    4. -
    5. Wait for the ZIP file to download on your PC. It should be around 1.5 GB in size.
    6. -
    7. Once the download is complete, extract the ZIP file to a folder of your choice.
    8. -
    9. Open the folder and double-click on the "GenshinImpact.exe" file to install it. You may need to allow it to run as an administrator.
    10. -
    11. After the installation is done, launch the game and wait for it to download additional data. This may take some time depending on your internet speed.
    12. -
    13. Enjoy playing the new update of Genshin Impact!
    14. -
    -

    Tips and tricks for playing Genshin Impact

    -

    Genshin Impact is a game that offers a lot of freedom and fun for its players. However, it can also be challenging and complex at times. If you want to make the most out of your gaming experience, here are some tips and tricks that you can use:

    -

    How to level up your characters and weapons

    -

    Leveling up your characters and weapons is essential for increasing your combat power and unlocking new skills and abilities. You can level up your characters by using character EXP materials that you can obtain from various sources, such as quests, events, domains, and ley line outcrops. You can also use other characters as materials to level up your main characters, but this is not recommended as it will consume a lot of resources and potential.

    -

    Leveling up your weapons is similar to leveling up your characters. You can use weapon EXP materials that you can obtain from various sources, such as quests, events, domains, and forging. You can also use other weapons as materials to level up your main weapons, but this is also not recommended for the same reasons as above.

    -

    Besides leveling up, you can also ascend your characters and weapons to increase their level cap and unlock new talents and stats. You will need specific materials for each ascension, such as elemental stones, boss drops, local specialties, and common items. You can check the required materials in the character or weapon menu.

    -

    How to optimize your team composition and elemental reactions

    -

    Genshin Impact is a game that relies heavily on elemental interactions and synergies. You can have up to four characters in your active party, each with their own elemental affinity. By switching between different characters and using their elemental skills and bursts, you can trigger various elemental reactions that can deal extra damage, inflict status effects, or provide buffs or debuffs to yourself or your enemies.

    -

    Some of the elemental reactions are:

    - - - - - - - - - - - - - - - - - - -
    ReactionEffect
    MeltIncreases damage when Pyro meets Cryo or vice versa
    VaporizeIncreases damage when Pyro meets Hydro or vice versa
    OverloadedCauses an explosion that deals AoE Pyro damage when Pyro meets Electro
    SuperconductCauses an explosion that deals AoE Cryo damage and reduces physical resistance when Cryo meets Electro
    Electro-ChargedCauses continuous Electro damage to enemies affected by Hydro
    FrozenFreezes enemies when Hydro meets Cryo
    ShatteredDeals extra physical damage to frozen enemies when hit by claymore, geo, or plunge attack
    SwirlSpreads the element that Anemo meets to nearby enemies and deals extra elemental damage
    CrystallizeCreates a shield that absorbs damage of the same element when Geo meets any other element except Anemo or Dendro
    BurningCauses continuous Pyro damage to enemies affected by Dendro
    BurntCauses continuous Pyro damage to grass or wooden objects
    Searing OnslaughtA special reaction that occurs when Diluc uses his elemental skill on enemies affected by Diona's elemental burst. It deals massive Pyro damage and reduces enemy Cryo resistance.
    FrostbiteA special reaction that occurs when Rosaria uses her elemental skill on enemies affected by Xingqiu's elemental burst. It deals massive Cryo damage and reduces enemy Hydro resistance.
    Rimechaser BladeA special reaction that occurs when Eula uses her elemental burst on enemies affected by Fischl's elemental skill. It deals massive Physical damage and reduces enemy Electro resistance.
    Nature's WrathA special reaction that occurs when Kazuha uses his elemental burst on enemies affected by any element except Anemo. It deals massive Anemo damage and increases the damage of the swirled element.
    Musou ShinsetsuA special reaction that occurs when Ayaka uses her elemental burst on enemies affected by Cryo. It deals massive Cryo damage and increases her critical rate and damage.
    -

    As you can see, there are many possible combinations and effects of elemental reactions. You should experiment with different characters and elements to find the best team composition for your playstyle and situation. You should also pay attention to the elemental resonance, which is a passive bonus that you get when you have two or more characters of the same element in your party. For example, having two Pyro characters will give you a 25% increase in attack power, while having two Anemo characters will reduce your stamina consumption by 15%.

    -

    How to explore the open world and find hidden treasures

    -

    Genshin Impact is a game that rewards exploration and curiosity. The open world of Teyvat is full of secrets, puzzles, quests, and treasures that you can discover and collect. You can use your map, your elemental sight, and your glider to navigate the terrain and find hidden locations. You can also interact with various NPCs, animals, plants, and objects to trigger events or obtain items.

    -

    Some of the things that you can find in the open world are:

    -
      -
    • Chests: These are containers that hold various rewards, such as primogems, mora, weapons, artifacts, and more. There are different types of chests, such as common, exquisite, precious, and luxurious. Some chests are easy to find, while others require you to solve puzzles, defeat enemies, or complete quests to unlock them.
    • -
    • Oculi: These are glowing orbs that represent the seven elements. You can collect them and offer them to the Statues of The Seven to increase your stamina, adventure rank, and primogems. There are different types of oculi for each region, such as Anemoculi in Mondstadt, Geoculi in Liyue, and Electroculi in Inazuma.
    • -
    • Seelies: These are cute spirits that guide you to hidden chests or locations. You can follow them and activate their pedestals to unlock their rewards. There are different types of seelies for each region, such as blue seelies in Mondstadt, yellow seelies in Liyue, and purple seelies in Inazuma.
    • -
    • Shrines: These are ancient structures that require keys to open. You can obtain keys by completing certain quests or domains. Inside the shrines, you can find luxurious chests that contain valuable items.
    • -
    • Domains: These are special dungeons that offer different challenges and rewards. You can enter them by spending resin or original resin, which are resources that regenerate over time. You can obtain various items from domains, such as artifacts, weapons, talent books, ascension materials, and more.
    • -
    -

    Conclusion

    -

    Genshin Impact is a game that offers a lot of fun and excitement for its players. The new patch APK adds a lot of new content to the game, such as new areas, characters, domains, main story, and more. You can download and install the new patch APK on your Android or PC device by following the steps we provided. You can also use our tips and tricks to optimize your team composition, level up your characters and weapons, and explore the open world. We hope you enjoy playing the new update of Genshin Impact!

    -

    FAQs

    -

    Here are some of the frequently asked questions about the genshin impact new patch apk:

    -
      -
    1. Q: Is the new patch APK safe to download and install?
    2. -
    3. A: Yes, the new patch APK is safe to download and install as long as you get it from the official website of Genshin Impact. You should avoid downloading it from any third-party sources or websites that may contain viruses or malware.
    4. -
    5. Q: Do I need to uninstall the previous version of Genshin Impact before installing the new patch APK?
    6. -
    7. A: No, you do not need to uninstall the previous version of Genshin Impact before installing the new patch APK. The new patch APK will overwrite the previous version and update your game data automatically.
    8. -
    9. Q: How much storage space do I need to download and install the new patch APK?
    10. -
    11. A: You will need at least 1.5 GB of free storage space on your device to download and install the new patch APK. You may also need additional space for downloading additional data after launching the game.
    12. -
    13. Q: How long does it take to download and install the new patch APK?
    14. -
    15. A: The time it takes to download and install the new patch APK depends on your internet speed and device performance. It may take anywhere from a few minutes to a few hours. You can check the progress of your download and installation in the game launcher.
    16. -
    17. Q: Can I play the new update of Genshin Impact offline?
    18. -
    19. A: No, you cannot play the new update of Genshin Impact offline. You will need a stable internet connection to play the game and access its features.
    20. -

    197e85843d
    -
    -
    \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Mod apk warriors io aksi royal tempur customize your character and weapons.md b/spaces/congsaPfin/Manga-OCR/logs/Mod apk warriors io aksi royal tempur customize your character and weapons.md deleted file mode 100644 index 4f6932dc4a1bfceb3818c3193a33dfabfbcfdf43..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Mod apk warriors io aksi royal tempur customize your character and weapons.md +++ /dev/null @@ -1,96 +0,0 @@ - -

    Mod Apk Warriors Io Aksi Royal Tempur: A Fun and Exciting Battle Royale Game for Android

    -

    If you are looking for a fun and exciting battle royale game for your Android device, you should try Mod Apk Warriors Io Aksi Royal Tempur. This is a modded version of the original game that gives you unlimited money, unlock all characters and weapons, and remove ads. In this article, we will tell you what Mod Apk Warriors Io Aksi Royal Tempur is, how to download and install it, and some tips and tricks for playing it.

    -

    What is Mod Apk Warriors Io Aksi Royal Tempur?

    -

    Mod Apk Warriors Io Aksi Royal Tempur is a modded version of the original game Warriors.io - Battle Royale Action. This is a multiplayer online game where you can choose from over 50 different characters and fight against other players in various modes. You can also customize your character with different weapons, skins, hats, and backpacks. The game has simple controls, colorful graphics, and addictive gameplay.

    -

    mod apk warriors io aksi royal tempur


    DOWNLOADhttps://urlca.com/2uOb0j



    -

    Features of Mod Apk Warriors Io Aksi Royal Tempur

    -

    The modded version of the game has some extra features that make it more enjoyable and easier to play. Here are some of them:

    -

    Unlimited money

    -

    With unlimited money, you can buy anything you want in the game without worrying about running out of coins or gems. You can use the money to upgrade your weapons, skills, and items. You can also buy new characters and weapons that are normally locked or require real money.

    -

    Unlock all characters and weapons

    -

    The modded version of the game unlocks all the characters and weapons that are available in the game. You can choose from over 50 different characters, each with their own unique abilities and stats. You can also use any weapon you want, from swords and axes to guns and grenades. You can mix and match different combinations of characters and weapons to suit your play style.

    -

    No ads

    -

    The modded version of the game removes all the annoying ads that pop up during the game. You can enjoy the game without any interruptions or distractions. You can also save your data and battery by not having to watch or download ads.

    -

    How to download and install Mod Apk Warriors Io Aksi Royal Tempur?

    -

    If you want to download and install Mod Apk Warriors Io Aksi Royal Tempur on your Android device, you need to follow these simple steps:

    -

    Step 1: Download the mod apk file from a trusted source

    -

    You can find many websites that offer mod apk files for various games, but not all of them are safe or reliable. You need to be careful when downloading mod apk files from unknown sources, as they may contain viruses or malware that can harm your device or steal your personal information. We recommend that you download the mod apk file from [this link](^1^), which is a trusted source that has been tested by many users.

    -

    Step 2: Enable

    Step 2: Enable unknown sources on your device settings

    -

    Before you can install the mod apk file, you need to enable unknown sources on your device settings. This will allow you to install apps that are not from the Google Play Store. To do this, go to your device settings, then security, then unknown sources, and toggle it on. You may see a warning message that says installing apps from unknown sources may harm your device, but you can ignore it as long as you trust the source of the mod apk file.

    -

    warriors io mod apk unlimited money and gems
    -download warriors io aksi royal tempur latest version
    -warriors io hack apk free download for android
    -warriors io aksi royal tempur gameplay and review
    -how to install warriors io mod apk on your device
    -warriors io cheats and tips for beginners
    -warriors io aksi royal tempur online multiplayer mode
    -warriors io mod apk offline no internet required
    -warriors io aksi royal tempur best weapons and skins
    -warriors io mod apk unlock all characters and levels
    -warriors io aksi royal tempur mod menu and features
    -warriors io hack apk no root or jailbreak needed
    -warriors io aksi royal tempur guide and walkthrough
    -warriors io mod apk unlimited coins and diamonds
    -warriors io aksi royal tempur trailer and screenshots
    -how to update warriors io mod apk to the latest version
    -warriors io hack apk download link and instructions
    -warriors io aksi royal tempur ranking and leaderboards
    -warriors io mod apk unlimited health and ammo
    -warriors io aksi royal tempur challenges and missions
    -how to play warriors io mod apk on pc or laptop
    -warriors io hack apk no verification or survey required
    -warriors io aksi royal tempur tips and tricks for advanced players
    -warriors io mod apk all weapons and items unlocked
    -warriors io aksi royal tempur story and characters
    -how to backup and restore warriors io mod apk data
    -warriors io hack apk anti ban and safe to use
    -warriors io aksi royal tempur events and rewards
    -warriors io mod apk premium features and benefits
    -warriors io aksi royal tempur feedback and ratings

    -

    Step 3: Install the mod apk file and enjoy the game

    -

    Now that you have downloaded the mod apk file and enabled unknown sources, you can install the mod apk file on your device. To do this, go to your file manager, then locate the mod apk file that you downloaded, and tap on it. You may see a prompt that asks you to confirm the installation, just tap on install and wait for it to finish. Once the installation is done, you can open the game and enjoy the modded features.

    -

    Tips and tricks for playing Mod Apk Warriors Io Aksi Royal Tempur

    -

    Now that you have installed Mod Apk Warriors Io Aksi Royal Tempur on your device, you can start playing the game and have fun. Here are some tips and tricks that can help you improve your skills and win more battles:

    -

    Choose your character wisely

    -

    The game offers over 50 different characters to choose from, each with their own strengths and weaknesses. You should choose a character that suits your play style and strategy. For example, if you like to play aggressively and deal high damage, you can choose a character with a high attack stat and a powerful weapon. If you prefer to play defensively and support your teammates, you can choose a character with a high health stat and a healing or shielding skill.

    -

    Upgrade your weapons and skills

    -

    As you play the game, you will earn coins and gems that you can use to upgrade your weapons and skills. Upgrading your weapons will increase their damage, range, accuracy, and fire rate. Upgrading your skills will reduce their cooldown time, increase their duration, and enhance their effects. You should upgrade your weapons and skills regularly to keep up with the increasing difficulty of the game.

    -

    Use the map and the radar to locate enemies and items

    -

    The game has a map and a radar that show you the location of enemies and items on the battlefield. You should use them to plan your movements and avoid being ambushed or surrounded by enemies. You should also use them to find items such as health packs, ammo boxes, chests, and crates that can help you survive longer and gain an advantage over your opponents.

    -

    Collect coins and gems to buy more items and characters

    -

    The game has a shop where you can buy more items and characters using coins and gems. Items include consumables such as grenades, mines, rockets, shields, medkits, etc. Characters include new ones that are not available in the original game or require real money. You should collect as many coins and gems as possible by playing the game modes, completing missions, watching ads, etc. You should also spend them wisely on items and characters that can benefit you in the game.

    -

    Conclusion

    -

    Mod Apk Warriors Io Aksi Royal Tempur is a fun and exciting battle royale game for Android devices that offers unlimited money, unlock all characters and weapons, and no ads. You can download and install it easily by following the steps above. You can also improve your skills and win more battles by following the tips and tricks above. If you are looking for a new game to play with your friends or online players, you should give Mod Apk Warriors Io Aksi Royal Tempur a try.

    -

    FAQs

    -

    Here are some frequently asked questions about Mod Apk Warriors Io Aksi Royal Tempur:

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    QuestionAnswer
    Is Mod Apk Warriors Io Aksi Royal Tempur safe to download and install?Yes, as long as you download it from a trusted source like [this link]. The mod apk file has been tested by many users and does not contain any viruses or malware.
    Will Mod Apk Warriors Io Aksi Royal Tempur affect my original game data?No, Mod Apk Warriors Io Aksi Royal Tempur will not affect your original game data. You can play both versions of the game separately without any problems.
    Can I play Mod Apk Warriors Io Aksi Royal Temp
    Can I play Mod Apk Warriors Io Aksi Royal Tempur online with other players?Yes, you can play Mod Apk Warriors Io Aksi Royal Tempur online with other players who have the same version of the game. You can also play with your friends by creating a private room and inviting them.
    What are the best characters and weapons to use in Mod Apk Warriors Io Aksi Royal Tempur?There is no definitive answer to this question, as different characters and weapons have different advantages and disadvantages. You should experiment with different combinations and find out what works best for you. However, some of the popular characters and weapons are: Ninja, Samurai, Sniper, Rocket Launcher, Machine Gun, and Shotgun.
    How can I contact the developer of Mod Apk Warriors Io Aksi Royal Tempur?You can contact the developer of Mod Apk Warriors Io Aksi Royal Tempur by visiting their official website [here] or by sending them an email at [this address].
    -

    I hope this article has been helpful and informative for you. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading and happy gaming!

    197e85843d
    -
    -
    \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Play 123 Free Solitaire Online or Offline - No Registration Required.md b/spaces/congsaPfin/Manga-OCR/logs/Play 123 Free Solitaire Online or Offline - No Registration Required.md deleted file mode 100644 index 3b5a2d6fb96d5307d1c603a229a43ee7517e1707..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Play 123 Free Solitaire Online or Offline - No Registration Required.md +++ /dev/null @@ -1,160 +0,0 @@ - -

    Download Solitaire 123 Free: How to Play the Classic Card Game on Your PC

    -

    Solitaire is one of the most popular and timeless card games in the world. It is a game of patience, strategy, and skill that can keep you entertained for hours. But did you know that you can play solitaire on your PC for free? In this article, we will show you how to download and play Solitaire 123 Free, a Microsoft Store version of the award-winning solitaire card game with millions of downloads since 1998. We will also share with you some features, tips, and benefits of playing this game. So, if you are ready to have some fun and challenge yourself, read on!

    -

    What is Solitaire 123 Free?

    -

    Solitaire 123 Free is a solitaire card game that you can download and play on your PC for free. It is developed by TreeCardGames, a company that specializes in creating high-quality card games for Windows devices. Solitaire 123 Free is based on the classic solitaire game, also known as Klondike, where you have to move all the cards from the tableau to the foundations in ascending order by suit. However, Solitaire 123 Free also offers other exciting game modes, such as Spider solitaire, FreeCell, Pyramid, TriPeaks, and more. You can choose from different levels of difficulty, card sets, backgrounds, and animations to customize your gaming experience.

    -

    download solitaire 123 free


    Download Ziphttps://urlca.com/2uOc3B



    -

    Features of Solitaire 123 Free

    -

    Some of the features that make Solitaire 123 Free stand out from other solitaire games are:

    -
      -
    • Smooth fluid and advanced animations
    • -
    • Many beautiful card sets, card backs and backgrounds to choose from
    • -
    • Automatic card flipping
    • -
    • Deal animation and winning animation
    • -
    • Single click or single touch for touch screens to auto move cards
    • -
    • "Automatically move cards to the foundations" option on/off
    • -
    • Unlimited undo and redo options
    • -
    • Statistics and Achievements tracking
    • -
    • Scores, Time and Moves counters
    • -
    • Save game progress
    • -
    • Hints will show you possible moves
    • -
    -

    How to download and install Solitaire 123 Free from the Microsoft Store

    -

    To download and install Solitaire 123 Free on your PC, you need to follow these simple steps:

    -
      -
    1. Go to the Microsoft Store app on your PC or visit this link: Get 123 Free Solitaire - Microsoft Store
    2. -
    3. Click on the "Get" button and sign in with your Microsoft account.
    4. -
    5. Wait for the download and installation process to complete.
    6. -
    7. Launch the game from your Start menu or desktop shortcut.
    8. -
    9. Enjoy playing Solitaire 123 Free!
    10. -
    -

    How to play Solitaire 123 Free

    -

    Playing Solitaire 123 Free is easy and fun. You just need to know the basic rules and controls of the game.

    -

    The rules of Solitaire 123 Free

    -

    The rules of Solitaire 123 Free are similar to the classic solitaire game. Here are the main points:

    -
      -
    • The game consists of a tableau (the main area where you arrange the cards), four foundations (the top right area where you place the cards in ascending order by suit), and a stock and a waste (the top left area where you draw and discard cards).
    • -
    • The goal of the game is to move all the cards from the tableau and the waste to the foundations.
    • -
    • You can move one card at a time, or a group of cards that are in sequence and of the same suit.
    • -
    • You can only move a card or a group of cards to another column if the top card of that column is of the opposite color and one rank higher than the card you are moving.
    • -
    • You can also move a card or a group of cards to an empty column.
    • -
    • You can move an ace or a group of cards starting with an ace to the foundations.
    • -
    • You can draw one card or three cards at a time from the stock to the waste, depending on your preference.
    • -
    • You can move a card from the waste to the tableau or the foundations, following the same rules as above.
    • -
    • You can restart the stock by clicking on its empty space, but you can only do this once per game.
    • -
    • The game is over when you have moved all the cards to the foundations, or when you have no more moves left.
    • -
    -

    The different game modes of Solitaire 123 Free

    -

    Solitaire 123 Free offers 12 different game modes for you to choose from. Each game mode has its own rules and challenges. Here are some examples:

    -
      -
    • Spider solitaire: You have to arrange the cards in descending order by suit, from king to ace. You can move any group of cards that are in sequence and of the same suit. You can deal 10 new cards from the stock when you have no more moves. You win when you have created eight complete sequences from king to ace.
    • -
    • FreeCell: You have four free cells where you can temporarily store one card each. You can move any card or group of cards that are in sequence and of alternating colors. You win when you have moved all the cards to the foundations.
    • -
    • Pyramid: You have to remove all the cards from the pyramid by pairing them up with another card that adds up to 13. You can only pair up cards that are not covered by other cards. You can also use the waste card or the stock card for pairing. You win when you have removed all the cards from the pyramid and the stock.
    • -
    • TriPeaks: You have to remove all the cards from the three peaks by selecting a card that is one rank higher or lower than the waste card. You can also use the stock card for selecting. You win when you have removed all the cards from the peaks and the stock.
    • -
    -

    Tips and tricks for Solitaire 123 Free

    -

    If you want to improve your skills and score in Solitaire 123 Free, here are some tips and tricks that you can use:

    -

    download 123 free solitaire for windows 10
    -download 123 free solitaire for pc
    -download 123 free solitaire for mac
    -download 123 free solitaire for android
    -download 123 free solitaire for iphone
    -download 123 free solitaire offline
    -download 123 free solitaire latest version
    -download 123 free solitaire spider
    -download 123 free solitaire freecell
    -download 123 free solitaire klondike
    -how to download 123 free solitaire
    -where to download 123 free solitaire
    -is 123 free solitaire safe to download
    -can i download 123 free solitaire on xbox
    -can i download 123 free solitaire on chromebook
    -best site to download 123 free solitaire
    -best alternative to 123 free solitaire download
    -benefits of downloading 123 free solitaire
    -reviews of 123 free solitaire download
    -features of 123 free solitaire download
    -tips and tricks for 123 free solitaire download
    -problems with 123 free solitaire download
    -solutions for 123 free solitaire download issues
    -updates for 123 free solitaire download
    -uninstall 123 free solitaire download
    -reinstall 123 free solitaire download
    -compare 123 free solitaire download with other games
    -play online without downloading 123 free solitaire
    -play with friends after downloading 123 free solitaire
    -play against computer after downloading 123 free solitaire
    -customize settings after downloading 123 free solitaire
    -change card backs after downloading 123 free solitaire
    -change backgrounds after downloading 123 free solitaire
    -change difficulty level after downloading 123 free solitaire
    -learn how to play after downloading 123 free solitaire
    -improve skills after downloading 123 free solitaire
    -win more games after downloading 123 free solitaire
    -earn achievements after downloading 123 free solitaire
    -track statistics after downloading 123 free solitaire
    -save progress after downloading 123 free solitaire

    -
      -
    • Plan ahead: Before making a move, think about how it will affect your future moves. Try to avoid blocking cards that you need later, or creating empty columns that you cannot fill.
    • -
    • Use the undo button: If you make a mistake or change your mind, you can use the undo button to go back to your previous move. You can undo as many times as you want, but it will affect your score and time.
    • -
    • Use the hints button: If you are stuck or need some guidance, you can use the hints button to show you possible moves. However, using hints will also reduce your score and time.
    • -
    • Play regularly: The more you play, the more familiar you will become with the game modes, rules, and strategies. You will also earn more achievements and improve your statistics.
    • -
    -

    Why you should play Solitaire 123 Free

    -

    Solitaire 123 Free is not only a fun and relaxing game, but also a beneficial one. Here are some reasons why you should play Solitaire 123 Free:

    -

    Benefits of playing Solitaire 123 Free

    -

    Playing Solitaire 123 Free can help you:

    -
      -
    • Improve your concentration, memory, and problem-solving skills
    • -
    • Reduce stress and anxiety
    • -
    • Increase your self-esteem and confidence
    • -
    • Enhance your mood and creativity
    • -
    • Kill time and boredom
    • -
    -

    Challenges and achievements of Solitaire 123 Free

    -

    If you are looking for some extra motivation and excitement, Solitaire 123 Free offers various challenges and achievements for you to complete. Some examples are:

    -
      -
    • Winning streak: Win 5 games in a row without using undo or hints
    • -
    • Perfect game : Win a game without using undo or hints, and without moving any card to the free cells (in FreeCell mode)
    • -
    • Speed demon: Win a game in less than 3 minutes
    • -
    • Master of solitaire: Win 100 games in total
    • -
    • And many more!
    • -
    -

    Alternatives to Solitaire 123 Free

    -

    If you want to try other solitaire games, there are plenty of alternatives to Solitaire 123 Free. Some of them are:

    -
      -
    • Solitaire Collection Free: A collection of 50 solitaire games, including Klondike, Spider, FreeCell, Pyramid, TriPeaks, Golf, and more.
    • -
    • Solitaire by MobilityWare: A classic solitaire game with daily challenges, themes, and leaderboards.
    • -
    • Solitaire Grand Harvest: A solitaire game with a farming twist. You can grow crops, harvest rewards, and play with cute animals.
    • -
    • Solitaire by Zynga: A solitaire game with social features. You can chat with other players, send gifts, and compete in tournaments.
    • -
    • Solitaire by Brainium: A solitaire game with elegant graphics, intuitive controls, and smart hints.
    • -
    -

    Conclusion

    -

    Solitaire 123 Free is a great way to enjoy the classic card game on your PC for free. You can download and install it from the Microsoft Store in a few minutes. You can play different game modes, customize your settings, and track your progress. You can also improve your skills, challenge yourself, and have fun. Solitaire 123 Free is a game that can benefit your mind, mood, and time. So what are you waiting for? Download Solitaire 123 Free today and start playing!

    -

    Summary of the main points

    -

    In this article, we have covered the following points:

    -
      -
    • What is Solitaire 123 Free and what are its features
    • -
    • How to download and install Solitaire 123 Free from the Microsoft Store
    • -
    • How to play Solitaire 123 Free and what are the rules and tips
    • -
    • Why you should play Solitaire 123 Free and what are the benefits and challenges
    • -
    • What are some alternatives to Solitaire 123 Free
    • -
    -

    Call to action

    -

    If you liked this article, please share it with your friends and family who might be interested in playing solitaire on their PC. You can also leave us a comment below and let us know what you think about Solitaire 123 Free. We would love to hear from you!

    -

    FAQs

    -

    Here are some frequently asked questions about Solitaire 123 Free:

    -
      -
    1. Is Solitaire 123 Free safe to download?
    2. -

      Yes, Solitaire 123 Free is safe to download from the Microsoft Store. It does not contain any viruses, malware, or spyware. It also does not require any personal information or permissions from your device.

      -
    3. Is Solitaire 123 Free compatible with Windows 10?
    4. -

      Yes, Solitaire 123 Free is compatible with Windows 10. It works well on both desktop and laptop computers. It also supports touch screen devices.

      -
    5. How much space does Solitaire 123 Free take on my PC?
    6. -

      Solitaire 123 Free takes about 50 MB of space on your PC. It is a lightweight and fast game that does not affect your PC's performance or battery life.

      -
    7. Can I play Solitaire 123 Free offline?
    8. -

      Yes, you can play Solitaire 123 Free offline. You do not need an internet connection to play the game. However, you will need an internet connection to download and update the game from the Microsoft Store.

      -
    9. Can I play Solitaire 123 Free with other people?
    10. -

      No, Solitaire 123 Free is a single-player game. You cannot play it with other people online or locally. However, you can compare your scores and achievements with other players on the leaderboards.

      -

    197e85843d
    -
    -
    \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Run Your Own Prison Empire with Idle Prison Manager Mod APK [Unlimited Money].md b/spaces/congsaPfin/Manga-OCR/logs/Run Your Own Prison Empire with Idle Prison Manager Mod APK [Unlimited Money].md deleted file mode 100644 index 7dea36e9042cbd5f786cf4aaf8a68559850872dc..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Run Your Own Prison Empire with Idle Prison Manager Mod APK [Unlimited Money].md +++ /dev/null @@ -1,139 +0,0 @@ - -

    Idle Prison Manager Mod APK: How to Download and Install

    -

    If you are a fan of management and idle games, you might want to try Idle Prison Manager Mod APK, a casual and easy-to-play game where you can build and run your own prison business. In this article, we will show you what Idle Prison Manager Mod APK is, how to download and install it on your Android device, how to play it, and how it compares with other prison tycoon games.

    -

    What is Idle Prison Manager Mod APK?

    -

    Idle Prison Manager Mod APK is a modified version of the original Idle Prison Manager game developed by Dotjoy. It is a simulation game where you can create your own prison from scratch, hire staff, manage resources, rehabilitate prisoners, and earn money. The modded version of the game gives you unlimited money to spend on upgrading your prison facilities, hiring more staff, and unlocking new features. You can also enjoy the game without any ads or in-app purchases.

    -

    idle prison manager mod apk


    Download Filehttps://urlca.com/2uO7mY



    -

    Features of Idle Prison Manager Mod APK

    -

    Some of the features of Idle Prison Manager Mod APK are:

    -
      -
    • You can build various types of buildings, such as cells, workshops, kitchens, clinics, libraries, gyms, and more.
    • -
    • You can customize your prison layout, design, and decoration.
    • -
    • You can hire different kinds of staff, such as guards, doctors, teachers, psychologists, and more.
    • -
    • You can assign staff to different tasks and monitor their performance.
    • -
    • You can rehabilitate prisoners by sending them to various therapies, such as VR therapy, zero gravity room, dance therapy, and more.
    • -
    • You can release prisoners on parole or keep them locked up for longer.
    • -
    • You can deal with prison gangs, riots, escapes, and other challenges.
    • -
    • You can earn money from prisoner factories, contracts, donations, and more.
    • -
    • You can use unlimited money to upgrade your prison and unlock new features.
    • -
    -

    Benefits of Idle Prison Manager Mod APK

    -

    Some of the benefits of Idle Prison Manager Mod APK are:

    -
      -
    • You can enjoy the game without any ads or interruptions.
    • -
    • You can play the game without any internet connection or registration.
    • -
    • You can experiment with different strategies and scenarios without worrying about money or resources.
    • -
    • You can have fun with the humorous and colorful graphics and animations.
    • -
    • You can learn about prison management and rehabilitation in a casual and entertaining way.
    • -
    -

    How to Download Idle Prison Manager Mod APK

    -

    To download and install Idle Prison Manager Mod APK on your Android device, you need to follow these steps:

    -

    Step 1: Allow Unknown Apps on Android

    -

    Before you can download APK files using Chrome or any other browser, you need to allow unknown apps on your device. To do this:

    -
      -
    1. Go to your device settings and tap Apps & Notifications (or Apps in older versions of Android).
    2. -
    3. Tap the three dots in the upper-right corner.
    4. -
    5. Tap Special access.
    6. -
    7. Tap Install unknown apps.
    8. -
    9. Tap Chrome (or whichever web browser you use).
    10. -
    11. Move Allow from this source to the On position.
    12. -
    -

    Step 2 Step 2: Install a File Manager App

    -

    To access the APK file that you downloaded, you need to install a file manager app on your device. A file manager app allows you to browse and manage the files and folders on your device. There are many file manager apps available on the Google Play Store, such as ES File Explorer, File Manager, and Files by Google. You can choose any file manager app that you like and install it on your device.

    -

    Step 3: Download the APK File from a Trusted Source

    -

    Now that you have allowed unknown apps and installed a file manager app, you can download the APK file of Idle Prison Manager Mod APK from a trusted source. There are many websites that offer APK files for free, but some of them may contain malware or viruses that can harm your device. Therefore, you should always download APK files from reputable and reliable sources. One of the sources that we recommend is APKPure.com, which is a popular and safe website that provides APK files for various Android apps and games. To download the APK file from APKPure.com, follow these steps:

    -

    idle prison manager mod apk unlimited money
    -idle prison manager mod apk latest version
    -idle prison manager mod apk android 1
    -idle prison manager mod apk download
    -idle prison manager mod apk free shopping
    -idle prison manager mod apk hack
    -idle prison manager mod apk revdl
    -idle prison manager mod apk 1.1.5
    -idle prison manager mod apk offline
    -idle prison manager mod apk 2023
    -idle prison tycoon mod apk
    -idle prison empire mod apk
    -idle prison simulator mod apk
    -idle prison tycoon gold miner clicker game mod apk
    -idle prison tycoon simulator mod apk
    -idle jailbreak mod apk
    -idle jailbreak tycoon mod apk
    -idle jailbreak simulator mod apk
    -idle jailbreak tycoon simulator mod apk
    -idle jailbreak clicker game mod apk
    -idle jail tycoon mod apk
    -idle jail tycoon simulator mod apk
    -idle jail tycoon clicker game mod apk
    -idle jail escape mod apk
    -idle jail escape tycoon mod apk
    -idle jail escape simulator mod apk
    -idle jail escape clicker game mod apk
    -idle jail escape tycoon simulator mod apk
    -idle prison management game mod apk
    -idle prison management simulator mod apk
    -idle prison management tycoon mod apk
    -idle prison management clicker game mod apk
    -idle prison management tycoon simulator mod apk
    -download game idle prison manager mod apk
    -download game idle prison tycoon mod apk
    -download game idle jailbreak tycoon mod apk
    -download game idle jail escape tycoon mod apk
    -download game idle prison management tycoon mod apk
    -how to install idle prison manager mod apk
    -how to play idle prison manager mod apk
    -how to update idle prison manager mod apk
    -how to hack idle prison manager mod apk
    -how to get unlimited money in idle prison manager mod apk
    -how to get free shopping in idle prison manager mod apk
    -how to unlock all prisons in idle prison manager mod apk
    -how to reset progress in idle prison manager mod apk
    -how to backup data in idle prison manager mod apk
    -how to restore data in idle prison manager mod apk

    -
      -
    1. Open Chrome (or any other web browser) on your device and go to https://apkpure.com/.
    2. -
    3. In the search box, type Idle Prison Manager Mod APK and tap the magnifying glass icon.
    4. -
    5. From the search results, tap the Idle Prison Manager Mod APK icon.
    6. -
    7. On the app page, tap Download APK.
    8. -
    9. Wait for the download to complete. You can check the progress in the notification bar.
    10. -
    -

    Step 4: Install the APK File on Your Device

    -

    Once the download is finished, you can install the APK file on your device using the file manager app that you installed earlier. To do this:

    -
      -
    1. Open the file manager app on your device and locate the APK file that you downloaded. It should be in the Downloads folder by default.
    2. -
    3. Tap the APK file to open it.
    4. -
    5. A pop-up window will appear asking you to confirm the installation. Tap Install.
    6. -
    7. Wait for the installation to complete. You can check the progress in the notification bar.
    8. -
    9. Once the installation is done, tap Open to launch the game or Done to exit.
    10. -
    -

    How to Play Idle Prison Manager Mod APK

    -

    Now that you have downloaded and installed Idle Prison Manager Mod APK on your device, you can start playing it and enjoy its features. Here are some tips on how to play Idle Prison Manager Mod APK:

    -

    Build and Manage Your Own Prison

    -

    Your main goal in Idle Prison Manager Mod APK is to build and manage your own prison business. You can start by building basic facilities, such as cells, offices, power plants, and water tanks. Then, you can expand your prison by adding more buildings, such as workshops, kitchens, clinics, libraries, gyms, and more. You can also customize your prison layout, design, and decoration according to your preference. You can use unlimited money to buy and upgrade anything you want in the game.

    -

    Hire and Train Staff

    -

    To run your prison smoothly, you need to hire staff to perform various tasks and duties. You can hire different kinds of staff, such as guards, doctors, teachers, psychologists, and more. Each staff member has different skills and abilities that affect their performance and efficiency. You can assign staff to different buildings and areas of your prison and monitor their work status. You can also train staff to improve their skills and productivity. You can use unlimited money to hire and train as many staff as you want in the game.

    -

    Rehabilitate and Release Prisoners

    -

    The most important aspect of Idle Prison Manager Mod APK is to rehabilitate prisoners and prepare them for release. You can admit prisoners from different backgrounds and crimes into your prison and assign them to different cells. Each prisoner has different needs and behaviors that affect their mood and satisfaction. You can rehabilitate prisoners by sending them to various therapies, such as VR therapy, zero gravity room, dance therapy, and more. These therapies can reduce their stress level and increase their happiness level. You can also educate prisoners by sending them to classes, such as math, language, art, and more. These classes can increase their intelligence level and skills level. You can release prisoners on parole or keep them locked up for longer depending on their behavior and progress. You can earn money from releasing prisoners or keeping them in your prison.

    -

    Comparison with Other Prison Tycoon Games

    -

    If you like Idle Prison Manager Mod APK, you might also want to check out other prison tycoon games that are available on various platforms. Here are some of the best prison tycoon games that you can play:

    -

    Prison Tycoon®: Under New Management

    -

    This is a new and improved version of the classic Prison Tycoon series, developed by Abylight Studios and published by Ziggurat. It is a simulation game where you can build and manage your own prison from the ground up, hiring staff, rehabilitating prisoners, and dealing with challenges. You can choose from five different climates, each with different difficulties and opportunities. You can also customize your prison layout, design, and decoration. You can use various therapies, such as VR therapy, zero gravity room, dance therapy, and more, to reduce the stress and increase the happiness of your prisoners. You can also educate them by sending them to classes, such as math, language, art, and more. You can release them on parole or keep them locked up for longer depending on their behavior and progress. You can earn money from prisoner factories, contracts, donations, and more. You can also play the game in sandbox mode, where you have unlimited resources to create the perfect prison. The game is available on Steam for $19.99.

    -

    Prison Tycoon 4: SuperMax

    -

    This is the fourth installment of the Prison Tycoon series, developed by Virtual Playground and published by Cosmi Valusoft. It is a simulation game where you can build and run a profitable privately run prison from scratch. You can start small and forge your reputation as a first-rate warden. You can grow your facility to SuperMax capabilities, housing the most dangerous and diabolical criminals on earth. You can build various facilities, such as cells, offices, power plants, water tanks, workshops, kitchens, clinics, libraries, gyms, and more. You can hire staff to perform various tasks and duties. You can fortify your security to withstand prison escapes and fights. You can monitor your prisoners to ensure they are happy and healthy. You can also rehabilitate them by sending them to various programs, such as education, work release, community service, and more. You can release them on parole or keep them locked up for longer depending on their behavior and progress. You can earn money from various sources, such as contracts, grants, donations, and more. The game is available on Steam for $9.99.

    -

    Prison Empire Tycoon-Idle Game

    -

    This is an idle game developed by Codigames where you can become a prison tycoon by managing your own prison business. You can start with a small low-security prison and expand it to a high-security prison with hundreds of inmates. You can build different facilities for your prisoners, such as cells, bathrooms, cafeterias, infirmaries, libraries, workshops, recreational areas, and more. You can hire staff to take care of your prisoners' needs and security. You can improve your prison's conditions by upgrading your facilities and equipment. You can rehabilitate your prisoners by offering them activities and programs that will improve their skills and behavior. You can also deal with events that will challenge your management skills, such as riots, fires, fights, escapes, inspections, lawsuits, and more. You can earn money from your prison's production and contracts. You can also invest in other businesses that will boost your income. The game is free to play on Google Play Store.

    -

    Conclusion

    -

    Idle Prison Manager Mod APK is a fun and easy-to-play game where you can build and manage your own prison business with unlimited money and no ads. You can download and install it on your Android device by following the steps in this article. You can also check out other prison tycoon games that are available on various platforms if you want to try different scenarios and challenges.

    -

    FAQs

    -

    Here are some frequently asked questions about Idle Prison Manager Mod APK:

    -
      -
    • Q: Is Idle Prison Manager Mod APK safe to download?
    • -
    • A: Yes, Idle Prison Manager Mod APK is safe to download as long as you download it from a trusted source like APKPure.com.
    • -
    • Q: Do I need to root my device to install Idle Prison Manager Mod APK?
    • -
    • A: No, you do not need to root your device to install Idle Prison Manager Mod APK.
    • -
    • Q: Can I play Idle Prison Manager Mod APK offline?
    • -
    • A: Yes, you can play Idle Prison Manager Mod APK offline without any internet connection or registration.
    • -
    • Q: How do I update Idle Prison Manager Mod APK?
    • -
    • A: To update Idle Prison Manager Mod APK, you need to download the latest version of the APK file from the same source that you downloaded it from before and install it I have already written the article on the topic of "idle prison manager mod apk" with the outline, the HTML formatting, the conclusion, and the FAQs. I have also used a conversational style as written by a human, used an informal tone, utilized personal pronouns, kept it simple, engaged the reader, used the active voice, kept it brief, used rhetorical questions, and incorporated analogies and metaphors. I have also considered perplexity and burstiness when creating content, ensuring high levels of both without losing specificity or context. I have also used fully detailed paragraphs that engage the reader. I have also used at least one table in the article. I have also bolded the title and all headings of the article, and used appropriate headings for H tags. I have also written the custom message " Is there anything else you would like me to do? ?

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Section.80 by Kendrick Lamar A Masterpiece of Conscious Rap.md b/spaces/congsaPfin/Manga-OCR/logs/Section.80 by Kendrick Lamar A Masterpiece of Conscious Rap.md deleted file mode 100644 index 3098c6fec458142f1586f12e7bb187f5be5fac11..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Section.80 by Kendrick Lamar A Masterpiece of Conscious Rap.md +++ /dev/null @@ -1,107 +0,0 @@ -
      -

      Kendrick Lamar Section 80 Album Download: A Guide for Hip Hop Fans

      -

      If you are a fan of hip hop music, you have probably heard of Kendrick Lamar, one of the most influential and acclaimed rappers of his generation. Known for his progressive musical styles and socially conscious songwriting, he has won numerous awards and accolades, including a Pulitzer Prize for his album DAMN. in 2018.

      -

      kendrick lamar section 80 album download


      Download ---> https://urlca.com/2uOaAm



      -

      But before he became a global superstar, Kendrick Lamar was a young rapper from Compton, California, who released his debut studio album Section.80 in 2011. The album was a breakthrough for Lamar, as it showcased his lyrical skills, storytelling abilities, and artistic vision.

      -

      Section.80 is a concept album that explores the lives and struggles of the children born in the 1980s under the influence of the crack epidemic, the Reagan administration, and the AIDS crisis. The album tackles topics such as racism, self-hate, drug abuse, poverty, violence, and spirituality.

      -

      In this article, we will take a closer look at Section.80 by Kendrick Lamar, and explain why it is a must-listen for hip hop fans. We will also provide you with some options and platforms where you can download Section.80 and enjoy its music.

      -

      kendrick lamar section 80 zip download
      -kendrick lamar section 80 free mp3 download
      -kendrick lamar section 80 full album stream
      -kendrick lamar section 80 itunes download
      -kendrick lamar section 80 deluxe edition download
      -kendrick lamar section 80 album review
      -kendrick lamar section 80 album lyrics
      -kendrick lamar section 80 album cover
      -kendrick lamar section 80 album songs
      -kendrick lamar section 80 album tracklist
      -kendrick lamar section 80 album sales
      -kendrick lamar section 80 album credits
      -kendrick lamar section 80 album meaning
      -kendrick lamar section 80 album download reddit
      -kendrick lamar section 80 album download datpiff
      -kendrick lamar section 80 album download audiomack
      -kendrick lamar section 80 album download google drive
      -kendrick lamar section 80 album download zip file
      -kendrick lamar section 80 album download rar
      -kendrick lamar section 80 album download mp4
      -kendrick lamar section 80 album download flac
      -kendrick lamar section 80 album download m4a
      -kendrick lamar section 80 album download qobuz
      -kendrick lamar section 80 album download apple music
      -kendrick lamar section 80 album download spotify
      -kendrick lamar section 80 album download tidal
      -kendrick lamar section 80 album download youtube
      -kendrick lamar section 80 album download soundcloud
      -kendrick lamar section 80 album download bandcamp
      -kendrick lamar section 80 album download mixtape monkey
      -kendrick lamar section 80 album download leak
      -kendrick lamar section 80 album download torrent
      -kendrick lamar section 80 album download blogspot
      -kendrick lamar section 80 album download mediafire
      -kendrick lamar section 80 album download mega.nz
      -kendrick lamar section 80 instrumental download
      -kendrick lamar section 80 acapella download
      -kendrick lamar hiiipower mp3 download from section.80
      -kendrick lamar adhd mp3 download from section.80
      -kendrick lamar rigamortus mp3 download from section.80
      -how to download kendrick lamar's section.80 for free
      -where can i download kendrick lamar's section.80
      -is it legal to download kendrick lamar's section.80
      -how to buy and support kendrick lamar's section.80
      -why you should listen to and appreciate kendrick lamar's section.80

      -

      A Track-by-Track Analysis of Section.80

      -

      Section.80 consists of 15 tracks that are divided into chapters that follow a narrative structure. The album features guest appearances from other rappers such as Ab-Soul, ScHoolboy Q, RZA, GLC, BJ the Chicago Kid, as well as singers such as Colin Munroe and Alori Joh.

      -

      The album also features production from various producers such as Sounwave, J. Cole, THC, Wyldfyer, Dave Free, Terrace Martin, Willie B., Tommy Black, Tae Beast, and Kendrick Lamar himself.

      -

      Here is a brief summary of each track on Section.80:

      -
        -
      • F*ck Your Ethnicity: The opening track sets the tone for the album, as Lamar addresses his listeners regardless of their race or background. He urges them to unite under a common cause and to embrace their individuality.
      • -
      • Hol' Up: The second track is a more upbeat and playful song that showcases Lamar's charisma and confidence. He raps about his ambitions, his skills, his lifestyle, and his hometown.
      • -
      • A.D.H.D: The third track is one of the most popular songs on the album, as it deals with the effects of attention deficit hyperactivity disorder (ADHD) on Lamar's generation. He describes how they cope with drugs, alcohol, sex, and parties to escape their reality.
      • -
      • No Make-Up (Her Vice): The fourth track is a song that focuses on the insecurities and pressures that women face in society. Lamar raps from the perspective of a woman who feels like she needs to wear make-up to be accepted and loved.
      • -

        A Track-by-Track Analysis of Section.80 (Continued)

        -
          -
        • Tammy's Song (Her Evils): The fifth track is a song that tells the story of two women, Tammy and Keisha, who are betrayed by their boyfriends and decide to turn to each other for comfort and revenge. Lamar raps from the perspective of Tammy, who expresses her anger and frustration.
        • -
        • Chapter Six: The sixth track is a song that references the sixth chapter of the Book of John in the Bible, where Jesus feeds a multitude of people with five loaves of bread and two fish. Lamar compares himself to Jesus, as he claims to feed his fans with his music and his words.
        • -
        • Ronald Reagan Era (His Evils): The seventh track is a song that explores the impact of the Reagan administration on Lamar's generation, especially in terms of the crack epidemic, the war on drugs, and the gang violence. Lamar raps about his experiences growing up in Compton during that era, and how he survived and thrived despite the odds.
        • -
        • Poe Mans Dreams (His Vice): The eighth track is a song that features a guest verse from GLC, a rapper from Chicago who was affiliated with Kanye West. The song is about the dreams and aspirations of poor men who resort to vices such as drugs, money, and women to cope with their hardships.
        • -
        • The Spiteful Chant: The ninth track is a song that features a guest verse from ScHoolboy Q, another rapper from Compton who is part of Lamar's group Black Hippy. The song is about the resentment and jealousy that Lamar and Q face from their haters and rivals, who try to bring them down.
        • -
        • Chapter Ten: The tenth track is a short interlude that references the tenth chapter of the Book of John in the Bible, where Jesus says that he is the good shepherd who lays down his life for his sheep. Lamar compares himself to Jesus again, as he says that he is willing to sacrifice himself for his fans and his people.
        • -
        • Keisha's Song (Her Pain): The eleventh track is a song that tells the story of Keisha, a 17-year-old girl who becomes a prostitute to support her family. Lamar raps from the perspective of Keisha, who reveals her pain and trauma. The song is based on a true story of one of Lamar's friends who died in a similar situation.
        • -
        • Rigamortus: The twelfth track is a song that showcases Lamar's technical skills and rapid-fire flow. He raps over a jazzy beat that samples "The Thorn" by Willie Jones III. He claims to kill his competition with his rhymes, leaving them in a state of rigamortus.
        • -
        • Kush & Corinthians (His Pain): The thirteenth track is a song that features a guest verse from BJ the Chicago Kid, a singer from Chicago who has worked with artists such as Kanye West, Chance the Rapper, and Dr. Dre. The song is about the contradictions and dilemmas that Lamar faces as a rapper and as a human being. He questions his morality, his faith, his purpose, and his destiny.
        • -
        • Blow My High (Members Only): The fourteenth track is a song that pays tribute to Aaliyah, the late R&B singer who died in a plane crash in 2001. The song samples her song "4 Page Letter" and includes references to her lyrics and songs. Lamar raps about his admiration for Aaliyah and how her music influenced him.
        • -
        • Ab-Soul's Outro: The fifteenth track is a song that features a guest verse from Ab-Soul, another rapper from Compton who is part of Lamar's group Black Hippy. The song also features vocals from Alori Joh, a singer who was Ab-Soul's girlfriend and collaborator before she died in 2012. The song is an outro that summarizes the themes and messages of Section.80, as Ab-Soul raps about politics, religion, philosophy, history, and culture.
        • -

          A Track-by-Track Analysis of Section.80 (Continued)

          -
            -
          • HiiiPoWeR: The sixteenth and final track is a bonus track that was produced by J. Cole, a rapper and producer from North Carolina who has collaborated with Lamar on several occasions. The song is about HiiiPoWeR, a movement and philosophy that Lamar created with Ab-Soul and J. Cole. HiiiPoWeR stands for Heart, Honor, and Respect, and it represents the three "i"s in their names. The song is a call to action for Lamar's fans and peers to elevate themselves and their communities, and to challenge the status quo and the system. The song also references influential figures such as Martin Luther King Jr., Malcolm X, Nelson Mandela, Tupac Shakur, and Nipsey Hussle.
          • -
          -

          A Comparison of Section.80 with Other Albums by Kendrick Lamar and Other Contemporary Hip Hop Artists

          -

          Section.80 is widely regarded as one of the best albums by Kendrick Lamar, and one of the best hip hop albums of the 2010s. It is also considered as a precursor to Lamar's later albums, such as Good Kid, M.A.A.D City (2012), To Pimp a Butterfly (2015), and DAMN. (2017), which are also concept albums that explore different aspects of Lamar's identity, culture, history, and society.

          -

          Section.80 is different from Lamar's other albums in terms of its sound, style, and scope. It is more experimental and eclectic, as it incorporates elements from various genres such as jazz, soul, funk, rock, and electronic music. It is also more personal and intimate, as it reflects Lamar's experiences and thoughts as a young man growing up in Compton.

          -

          Section.80 is also different from other hip hop albums that were released around the same time, such as Watch the Throne by Jay-Z and Kanye West (2011), Take Care by Drake (2011), Tha Carter IV by Lil Wayne (2011), My Beautiful Dark Twisted Fantasy by Kanye West (2010), and Recovery by Eminem (2010). These albums were more mainstream and commercial, as they focused on themes such as fame, wealth, power, love, and ego.

          -

          Section.80 was more underground and independent, as it focused on themes such as social justice, self-awareness, spirituality, and empowerment. It was also more innovative and creative, as it challenged the conventions and expectations of hip hop music.

          -

          A Summary of the Critical Reception and Commercial Performance of Section.80

          -

          Section.80 received critical acclaim from music critics and fans alike, who praised Lamar's lyricism, storytelling, production, and originality. The album was ranked among the best albums of 2011 by various publications such as Complex, Pitchfork, Rolling Stone, Spin, The Source, XXL, and others.

          -

          Section.80 also performed well commercially, despite being released independently through Top Dawg Entertainment without any major label support or promotion. The album debuted at number 113 on the Billboard 200 chart, selling 5,300 copies in its first week. It later peaked at number 100 on the chart, selling over 130,000 copies as of 2013.

          -

          A Summary of the Critical Reception and Commercial Performance of Section.80 (Continued)

          -

          Section.80 also spawned several singles that gained popularity and recognition in the hip hop scene, such as "HiiiPoWeR", "A.D.H.D", "Ronald Reagan Era", "The Spiteful Chant", and "Rigamortus". The album also earned Lamar several nominations and awards, such as the BET Hip Hop Award for Lyricist of the Year in 2012, and the MTV Video Music Award for Best New Artist in 2013.

          -

          Section.80 also influenced and inspired many other artists and listeners, who appreciated Lamar's artistic vision and social commentary. The album is considered as a classic and a landmark in hip hop history, as it marked the rise of Kendrick Lamar as one of the most important and influential rappers of his era.

          -

          Conclusion

          -

          In conclusion, Section.80 by Kendrick Lamar is a masterpiece of hip hop music that deserves to be heard and appreciated by anyone who loves music and culture. The album is a powerful and profound expression of Lamar's experiences, thoughts, and emotions as a young man growing up in Compton in the 1980s and 1990s.

          -

          The album is also a reflection and a critique of the society and the system that shaped and affected Lamar's generation, who faced many challenges and obstacles such as racism, poverty, violence, drugs, and disease. The album is also a celebration and a tribute to the people and the music that inspired and influenced Lamar, such as his family, his friends, his mentors, his idols, and his peers.

          -

          If you want to download Section.80 by Kendrick Lamar and enjoy its music, you have several options and platforms to choose from. You can buy the album from online stores such as iTunes, Amazon, or Google Play. You can also stream the album from online services such as Spotify, Apple Music, Tidal, or YouTube. You can also download the album from torrent sites or file-sharing sites, but be careful of viruses and malware.

          -

          Whatever option you choose, we hope that you will enjoy Section.80 by Kendrick Lamar as much as we did. We also hope that you will learn something from the album, and that you will be inspired by its messages and its music.

          -

          Thank you for reading this article, and remember: HiiiPoWeR!

          -

          FAQs

          -
            -
          • Where can I download Section.80 by Kendrick Lamar?: You can buy the album from online stores such as iTunes, Amazon, or Google Play. You can also stream the album from online services such as Spotify, Apple Music, Tidal, or YouTube. You can also download the album from torrent sites or file-sharing sites, but be careful of viruses and malware.
          • -
          • When was Section.80 released and how long is it?: Section.80 was released on July 2, 2011 by Top Dawg Entertainment. The album is 59 minutes and 55 seconds long.
          • -

            FAQs (Continued)

            -
              -
            • Who are the guest artists and producers on Section.80?: The album features guest appearances from other rappers such as Ab-Soul, ScHoolboy Q, RZA, GLC, BJ the Chicago Kid, as well as singers such as Colin Munroe and Alori Joh. The album also features production from various producers such as Sounwave, J. Cole, THC, Wyldfyer, Dave Free, Terrace Martin, Willie B., Tommy Black, Tae Beast, and Kendrick Lamar himself.
            • -
            • What is the meaning of HiiiPoWeR and how does it relate to Section.80?: HiiiPoWeR is a movement and philosophy that Lamar created with Ab-Soul and J. Cole. HiiiPoWeR stands for Heart, Honor, and Respect, and it represents the three "i"s in their names. The song "HiiiPoWeR" is the bonus track on Section.80, and it is a call to action for Lamar's fans and peers to elevate themselves and their communities, and to challenge the status quo and the system.
            • -
            • What is the difference between Section.80 and Good Kid, M.A.A.D City?: Section.80 and Good Kid, M.A.A.D City are both concept albums by Kendrick Lamar that explore different aspects of his life and identity. Section.80 is more focused on the generational and societal issues that Lamar faced as a child of the 1980s in Compton. Good Kid, M.A.A.D City is more focused on the personal and familial issues that Lamar faced as a teenager in Compton.
            • -

            197e85843d
            -
            -
            \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Stockfish Chess Engine How to Download and Install on Any Device.md b/spaces/congsaPfin/Manga-OCR/logs/Stockfish Chess Engine How to Download and Install on Any Device.md deleted file mode 100644 index 33d79e5c2a9384490ee2d22859a2e1163cb32439..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Stockfish Chess Engine How to Download and Install on Any Device.md +++ /dev/null @@ -1,155 +0,0 @@ -
            -

            Stockfish Chess APK Download: How to Get the Strongest Chess Engine on Your Device

            -

            If you are a chess enthusiast, you probably have heard of Stockfish, the strongest chess engine in the world. But do you know how to get it on your device? In this article, we will show you how to download and install Stockfish chess APK, a free and open-source program that can help you improve your chess skills and enjoy the game more. We will also cover some of the features, history, and comparison of Stockfish chess APK with other chess engines.

            -

            stockfish chess apk download


            Download Filehttps://urlca.com/2uOfO1



            -

            Features of Stockfish Chess APK

            -

            Stockfish chess APK is not just a powerful chess engine, but also a versatile and user-friendly tool that offers many features for chess players of all levels. Here are some of the features that make Stockfish chess APK stand out:

            -
              -
            • Strength and accuracy of analysis: Stockfish chess APK can evaluate any position with incredible depth and speed, using advanced algorithms and techniques. It can also suggest the best moves and variations for both sides, giving you a clear understanding of the position. Its estimated Elo rating is over 3500, making it stronger than any human player in history.
            • -
            • Support for Chess960 and Syzygy tablebases: Stockfish chess APK can play not only standard chess, but also Chess960, a variant that randomizes the initial position of the pieces. This adds more variety and challenge to the game, as you have to adapt to different setups. Stockfish chess APK also supports Syzygy tablebases, which are databases that contain perfect information for all endgames with up to seven pieces. This allows Stockfish chess APK to play these endgames flawlessly.
            • -
            • Compatibility with various platforms and GUIs: Stockfish chess APK can run on various devices, such as Windows, Mac OS X, Linux, iOS, and Android. It can also work with different graphical user interfaces (GUIs), such as Chess.com, Lichess.org, SmallFish, DroidFish, Scid vs PC, Arena, Fritz, ChessBase, etc. This means you can use Stockfish chess APK in your favorite chess app or software.
            • -
            • Open-source and free license: Stockfish chess APK is an open-source project that is developed and maintained by a community of volunteers. It is distributed under the GNU General Public License version 3 (GPL v3), which means you can use it for free, modify it, share it, or contribute to it. You can also access the source code and learn how it works.
            • -
            -

            How to

            How to Download and Install Stockfish Chess APK

            -

            Downloading and installing Stockfish chess APK is easy and fast. Just follow these simple steps:

            -
              -
            1. Choose the right version for your device: Depending on your device's operating system and architecture, you need to choose the appropriate version of Stockfish chess APK. For example, if you have an Android device with a 64-bit ARM processor, you need to download the Stockfish chess APK for arm64-v8a. You can find the list of available versions on the official website of Stockfish or on the GitHub page of Stockfish.
            2. -
            3. Download the APK file from a trusted source: Once you have chosen the right version, you need to download the APK file from a trusted source. You can either download it directly from the official website of Stockfish or from a reputable third-party site, such as APKPure or APKMirror. Make sure you download the latest version of Stockfish chess APK, which is currently 14.1 as of June 2023.
            4. -
            5. Install the APK file on your device: After downloading the APK file, you need to install it on your device. To do this, you need to enable the installation of apps from unknown sources in your device's settings. This may vary depending on your device model and OS version, but generally, you can find this option under Security or Privacy settings. Once you have enabled this option, you can open the APK file and follow the instructions to install it.
            6. -
            7. Use Stockfish in your preferred chess app or software: After installing Stockfish chess APK, you can use it in your preferred chess app or software. To do this, you need to select Stockfish as the engine or analysis tool in your app or software settings. This may also vary depending on your app or software, but generally, you can find this option under Engine or Analysis settings. Once you have selected Stockfish, you can start using it to play or analyze chess games.
            8. -
            -

            How to Use Stockfish Chess APK for Improving Your Chess Skills

            -

            Stockfish chess APK is not only a powerful chess engine, but also a great tool for improving your chess skills. Here are some ways you can use Stockfish chess APK for learning and training:

            -
              -
            • Analyze your games and learn from your mistakes: One of the best ways to improve your chess skills is to analyze your own games and learn from your mistakes. You can use Stockfish chess APK to review your games and see where you went wrong or missed opportunities. You can also compare your moves with Stockfish's suggestions and understand why they are better or worse. This will help you improve your calculation, evaluation, and decision-making skills.
            • -
            • Play against Stockfish and challenge yourself: Another way to improve your chess skills is to play against Stockfish and challenge yourself. You can adjust the level of difficulty and style of Stockfish according to your preference and skill level. You can also try different openings, strategies, and tactics against Stockfish and see how it responds. This will help you improve your repertoire, creativity, and adaptability skills.
            • -
            • Study Stockfish's games and learn from the best: A third way to improve your chess skills is to study Stockfish's games and learn from the best. You can watch or replay some of the games that Stockfish has played against other engines or human players and see how it handles different positions and situations. You can also analyze some of the key moves and variations that Stockfish makes and understand the logic behind them. This will help you improve your knowledge, intuition, and inspiration skills.
            • -
            -

            Comparison of Stockfish Chess APK with Other Chess Engines

            -

            Stockfish chess APK is not the only chess engine available, but it is widely considered to be the strongest one. How does it compare with other chess engines? Here are some comparisons of Stockfish chess APK with some of the most popular and powerful chess engines:

            -

            stockfish chess engine download for android
            -stockfish chess app free download
            -stockfish chess analysis download
            -stockfish chess gui download
            -stockfish chess latest version download
            -stockfish chess source code download
            -stockfish chess for windows 10 download
            -stockfish chess for ios download
            -stockfish chess for mac download
            -stockfish chess for linux download
            -stockfish chess 64 bit download
            -stockfish chess popcnt download
            -stockfish chess armv8 download
            -stockfish chess armv7 download
            -stockfish chess homebrew download
            -stockfish chess smallfish download
            -stockfish chess uci download
            -stockfish chess command line download
            -stockfish chess development build download
            -stockfish chess old releases download
            -stockfish chess github download
            -stockfish chess zip file download
            -stockfish chess online play
            -stockfish chess online analysis
            -stockfish chess online engine
            -stockfish chess online app
            -stockfish chess online free
            -stockfish chess online vs computer
            -stockfish chess online multiplayer
            -stockfish chess online tutorial
            -stockfish chess online rating
            -stockfish chess online simulator
            -stockfish chess online browser
            -stockfish chess online training
            -stockfish chess online review
            -stockfish chess online forum
            -stockfish chess online support
            -stockfish chess online tips
            -stockfish chess online tricks
            -stockfish chess online guide
            -how to install stockfish chess apk
            -how to use stockfish chess apk
            -how to update stockfish chess apk
            -how to uninstall stockfish chess apk
            -how to configure stockfish chess apk
            -how to run stockfish chess apk
            -how to play with stockfish chess apk
            -how to improve with stockfish chess apk
            -how to learn from stockfish chess apk

            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            EngineElo RatingTypeFeaturesAdvantagesDisadvantages
            Stockfish~3500Traditional (AB)- Free and open-source
            - Supports Chess960 and Syzygy
            - Compatible with various platforms and GUIs
            - Constantly updated by community
            - Strongest engine in terms of raw power
            - Fastest engine in terms of speed
            - Most versatile engine in terms of features and compatibility
            - None
            AlphaZero~3400Neural network (NN)- Self-taught by playing against itself
            - Uses deep reinforcement learning and Monte Carlo tree search
            - Has a unique and dynamic style of play
            - Only available for research purposes
            - Strongest engine in terms of creativity and intuition
            - Most human-like engine in terms of style and understanding
            - Most innovative engine in terms of learning and development
            - Not free or open-source
            - Not compatible with most platforms and GUIs
            - Not updated or improved by community
            Leela Chess Zero~3300Neural network (NN)- Inspired by AlphaZero and based on the same principles
            - Uses distributed computing and crowdsourcing to train itself
            - Has a similar and dynamic style of play
            - Free and open-source
            - Strongest engine in terms of creativity and intuition after AlphaZero
            - Most human-like engine in terms of style and understanding after AlphaZero
            - Most innovative engine in terms of learning and development after AlphaZero
            - Not as strong or fast as Stockfish or AlphaZero
            - Not compatible with some platforms and GUIs
            - Requires a lot of computing power and resources to run optimally
            Komodo~3200Traditional (AB)- Commercial and proprietary
            - Supports Chess960 and Syzygy
            - Compatible with various platforms and GUIs
            - Has a balanced and solid style of play
            - Strongest engine in terms of positional play and endgames
            - Fastest engine in terms of search speed after Stockfish
            - Most versatile engine in terms of features and compatibility after Stockfish
            - Not free or open-source
            - Not as strong or creative as Stockfish, AlphaZero, or Leela Chess Zero
            - Not updated or improved by community as frequently as Stockfish or Leela Chess Zero
            Houdini~3100Traditional (AB)- Commercial and proprietary
            - Supports Chess960 and Syzygy
            - Compatible with various platforms and GUIs
            - Has a tactical and aggressive style of play
            - Strongest engine in terms of tactical play and attacks
            - Fastest engine in terms of search speed after Stockfish and Komodo
            - Most versatile engine in terms of features and compatibility after Stockfish and Komodo
            - Not free or open-source
            - Not as strong or creative as Stockfish, AlphaZero, Leela Chess Zero, or Komodo
            - Not updated or improved by community as frequently as Stockfish or Leela Chess Zero
            Rybka~3000Traditional (AB)- Commercial and proprietary
            - Supports Chess960 and Syzygy
            - Compatible with various platforms and GUIs
            - Has a dynamic and flexible style of play
            - Strongest engine in terms of dynamic play and sacrifices
            - Fastest engine in terms of search speed after Stockfish, Komodo, and Houdini
            - Most versatile engine in terms of features and compatibility after Stockfish, Komodo, and Houdini
            - Not free or open-source
            - Not as strong or creative as Stockfish, AlphaZero, Leela Chess Zero, Komodo, or Houdini
            - Controversial and disputed due to allegations of plagiarism and cheating
            -

            History and Development of Stockfish Chess APK

            -

            Stockfish chess APK has a long and rich history and development that spans over a decade. Here are some of the milestones and highlights of Stockfish chess APK's evolution:

            -
              -
            • Origin from Glaurung and evolution over the years: Stockfish chess APK originated from Glaurung, a chess engine created by Tord Romstad in 2004. Glaurung was one of the first engines to support Chess960 and to use bitboards, a data structure that represents the chess board as a series of bits. In 2008, Marco Costalba forked Glaurung and renamed it Stockfish, which means codfish in Norwegian. Since then, Stockfish has been improved by many developers, such as Joona Kiiski, Gary Linscott, Stéphane Nicolet, Daniel José Queraltó, etc. Stockfish has also incorporated ideas and code from other projects, such as Ippolit, RobboLito, Crafty, Fruit, etc.
            • -
            • Contribution from the open-source community and collaboration with other projects: Stockfish chess APK is an open-source project that is developed and maintained by a community of volunteers. Anyone can contribute to Stockfish by submitting patches, testing new versions, reporting bugs, suggesting features, etc. Stockfish also collaborates with other projects, such as Fishtest, a distributed testing framework that allows thousands of users to run Stockfish games on their computers; Syzygy, a project that provides endgame tablebases for Stockfish; OpenBench, a project that provides a platform for testing and comparing different chess engines; etc.
            • -
            • Achievements and records in computer chess competitions and rating lists: Stockfish chess APK has achieved many impressive results and records in computer chess competitions and rating lists. Some of them are: winning the Top Chess Engine Championship (TCEC) 10 times; winning the Computer Chess Rating Lists (CCRL) 40/40 rating list 18 times; winning the Chess.com Computer Chess Championship (CCCC) 6 times; setting the world record for the highest Elo rating ever achieved by a chess engine (over 3600); defeating several human grandmasters and world champions in exhibition matches; etc.
            • -
            -

            Conclusion and FAQs

            -

            In conclusion, Stockfish chess APK is the strongest chess engine in the world that offers many features and benefits for chess players of all levels. It is free and open-source, supports Chess960 and Syzygy tablebases, compatible with various platforms and GUIs, constantly updated by the community, and can help you improve your chess skills and enjoy the game more. If you want to get Stockfish chess APK on your device, you just need to follow the simple steps we have shown you in this article.

            -

            Here are some FAQs about Stockfish chess APK that you may find useful:

            -
              -
            1. Q: Is Stockfish chess APK safe to download?
              A: Yes, Stockfish chess APK is safe to download as long as you download it from a trusted source. You can either download it directly from the official website of Stockfish or from a reputable third-party site.
            2. -
            3. Q: How can I update Stockfish chess APK?
              A: You can update Stockfish chess APK by downloading the latest version from the same source you downloaded it from. You can also check for updates in your app or software settings.
            4. -
            5. Q: How can I contact the developers of Stockfish chess APK?
              A: You can contact the developers of Stockfish chess APK by visiting their official website or their GitHub page. You can also join their online forum or mailing list. You can also follow them on social media platforms, such as Facebook, Twitter, or YouTube.
            6. -
            7. Q: How can I support the development of Stockfish chess APK?
              A: You can support the development of Stockfish chess APK by donating to the project, contributing to the code, testing new versions, reporting bugs, suggesting features, etc. You can also spread the word about Stockfish chess APK and share it with your friends and family.
            8. -
            9. Q: How can I learn more about Stockfish chess APK?
              A: You can learn more about Stockfish chess APK by visiting their official website or their GitHub page. You can also read their documentation, wiki, blog, or articles. You can also watch their videos, podcasts, or webinars.
            10. -
            11. Q: What are some alternatives to Stockfish chess APK?
              A: Some alternatives to Stockfish chess APK are AlphaZero, Leela Chess Zero, Komodo, Houdini, Rybka, etc. You can compare them with Stockfish chess APK and see which one suits your needs and preferences better.
            12. -

            401be4b1e0
            -
            -
            \ No newline at end of file diff --git a/spaces/contluForse/HuggingGPT/assets/Crackcdkeygodofwar3pcdownload.md b/spaces/contluForse/HuggingGPT/assets/Crackcdkeygodofwar3pcdownload.md deleted file mode 100644 index 0f13ed11c71052546aec743d8f4ec185563f618e..0000000000000000000000000000000000000000 --- a/spaces/contluForse/HuggingGPT/assets/Crackcdkeygodofwar3pcdownload.md +++ /dev/null @@ -1,34 +0,0 @@ -

            Crackcdkeygodofwar3pcdownload


            Download File ►►►►► https://ssurll.com/2uzydf



            -
            -, if you have another key pls put it in the text as wellA new species of the genus Hyperacrabes from New Caledonia (Coleoptera, Curculionidae, Entiminae). - -Hyperacrabes taiwanesis sp. nov. is described from Mount Tai in New Caledonia. A key for the species is provided. Illustrations of the male and female terminalia are given, based on a series of photographs taken with a Canon EOS 700D camera.Q: - -Docker container is randomly stopped and started - -We are running docker on Kubernetes and we have some error in the logs. I saw that sometimes the container is randomly stopped and started. - -It is not stopped because the logs are being written to a file. And it is not restarted because the logs are not rolled over and it is not restarted because the pods are not being restarted. - -I can't see anything in the logs to identify which container is causing the problem. - -Are there any logs which can help me to identify the exact container which causes this problem? - -A: - -The logs should be generated even if the pod is not restarted. - -If the pod is not restarted the logs will not be flushed into a file. - -In your logs you can find - -Mar 25 09:10:35 kube-engine-wkunf6-app-2 app[6856]: 2017-03-25 09:10:35.553554 I [34]: /bin/sh -c /bin/echo 10 > /proc/sys/kernel/hung_task_timeout_secs - -It seems to be hung for sometime. - -Exercise, high blood pressure, obesity and cancer: the link between physical activity, diet, and cancer. - -Exercise can be an effective treatment for several chronic conditions including hypertension, obesity, and type 2 diabetes. It can also have a role in prevention, and early detection, of cancer. Data from several recent prospective and case-control studies indicate that physically active people have a lower risk of cancer than inactive people. These beneficial effects of physical activity may partly be explained by favorable changes in lifestyle factors such as smoking and dietary intake. However, the associations between physical activity and cancer are complex and biologic mechanisms remain to be elucidated 4fefd39f24
            -
            -
            -

            diff --git a/spaces/contluForse/HuggingGPT/assets/Download The Kaabil In Hindi Hd A Must-Watch For All Hrithik Roshan Fans.md b/spaces/contluForse/HuggingGPT/assets/Download The Kaabil In Hindi Hd A Must-Watch For All Hrithik Roshan Fans.md deleted file mode 100644 index 8913d2c5e6a03c7d1b418835e549e832e8ee0ce1..0000000000000000000000000000000000000000 --- a/spaces/contluForse/HuggingGPT/assets/Download The Kaabil In Hindi Hd A Must-Watch For All Hrithik Roshan Fans.md +++ /dev/null @@ -1,5 +0,0 @@ - -

            Tags: Kaabil Hero movie download, Kaabil Hero 2016 south movie free download, Kaabil Hero yami gautam full movie download in hd quality, Kaabil Hero hindi dubbed 720p hd quality, yami gautam south movie download in hindi dubed Kaabil Hero 720p

            How to Download from SSR Movies? Facebook

          Prev Article Next Article Add Comment Cancel Reply

          -

          Download The Kaabil In Hindi Hd


          Download ❤❤❤ https://ssurll.com/2uzxGS



          aaccfb2cb3
          -
          -
          \ No newline at end of file diff --git a/spaces/cooelf/Multimodal-CoT/timm/models/hub.py b/spaces/cooelf/Multimodal-CoT/timm/models/hub.py deleted file mode 100644 index 9a9b553031fb9d1846338990cd3b6f77228174c6..0000000000000000000000000000000000000000 --- a/spaces/cooelf/Multimodal-CoT/timm/models/hub.py +++ /dev/null @@ -1,96 +0,0 @@ -import json -import logging -import os -from functools import partial -from typing import Union, Optional - -import torch -from torch.hub import load_state_dict_from_url, download_url_to_file, urlparse, HASH_REGEX -try: - from torch.hub import get_dir -except ImportError: - from torch.hub import _get_torch_home as get_dir - -from timm import __version__ -try: - from huggingface_hub import hf_hub_url - from huggingface_hub import cached_download - cached_download = partial(cached_download, library_name="timm", library_version=__version__) -except ImportError: - hf_hub_url = None - cached_download = None - -_logger = logging.getLogger(__name__) - - -def get_cache_dir(child_dir=''): - """ - Returns the location of the directory where models are cached (and creates it if necessary). - """ - # Issue warning to move data if old env is set - if os.getenv('TORCH_MODEL_ZOO'): - _logger.warning('TORCH_MODEL_ZOO is deprecated, please use env TORCH_HOME instead') - - hub_dir = get_dir() - child_dir = () if not child_dir else (child_dir,) - model_dir = os.path.join(hub_dir, 'checkpoints', *child_dir) - os.makedirs(model_dir, exist_ok=True) - return model_dir - - -def download_cached_file(url, check_hash=True, progress=False): - parts = urlparse(url) - filename = os.path.basename(parts.path) - cached_file = os.path.join(get_cache_dir(), filename) - if not os.path.exists(cached_file): - _logger.info('Downloading: "{}" to {}\n'.format(url, cached_file)) - hash_prefix = None - if check_hash: - r = HASH_REGEX.search(filename) # r is Optional[Match[str]] - hash_prefix = r.group(1) if r else None - download_url_to_file(url, cached_file, hash_prefix, progress=progress) - return cached_file - - -def has_hf_hub(necessary=False): - if hf_hub_url is None and necessary: - # if no HF Hub module installed and it is necessary to continue, raise error - raise RuntimeError( - 'Hugging Face hub model specified but package not installed. Run `pip install huggingface_hub`.') - return hf_hub_url is not None - - -def hf_split(hf_id): - rev_split = hf_id.split('@') - assert 0 < len(rev_split) <= 2, 'hf_hub id should only contain one @ character to identify revision.' - hf_model_id = rev_split[0] - hf_revision = rev_split[-1] if len(rev_split) > 1 else None - return hf_model_id, hf_revision - - -def load_cfg_from_json(json_file: Union[str, os.PathLike]): - with open(json_file, "r", encoding="utf-8") as reader: - text = reader.read() - return json.loads(text) - - -def _download_from_hf(model_id: str, filename: str): - hf_model_id, hf_revision = hf_split(model_id) - url = hf_hub_url(hf_model_id, filename, revision=hf_revision) - return cached_download(url, cache_dir=get_cache_dir('hf')) - - -def load_model_config_from_hf(model_id: str): - assert has_hf_hub(True) - cached_file = _download_from_hf(model_id, 'config.json') - default_cfg = load_cfg_from_json(cached_file) - default_cfg['hf_hub'] = model_id # insert hf_hub id for pretrained weight load during model creation - model_name = default_cfg.get('architecture') - return default_cfg, model_name - - -def load_state_dict_from_hf(model_id: str): - assert has_hf_hub(True) - cached_file = _download_from_hf(model_id, 'pytorch_model.bin') - state_dict = torch.load(cached_file, map_location='cpu') - return state_dict diff --git a/spaces/cooelf/Multimodal-CoT/timm/models/selecsls.py b/spaces/cooelf/Multimodal-CoT/timm/models/selecsls.py deleted file mode 100644 index 1f3379db3da5e5303d9af2c78098b9a5424a5fde..0000000000000000000000000000000000000000 --- a/spaces/cooelf/Multimodal-CoT/timm/models/selecsls.py +++ /dev/null @@ -1,362 +0,0 @@ -"""PyTorch SelecSLS Net example for ImageNet Classification -License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/legalcode) -Author: Dushyant Mehta (@mehtadushy) - -SelecSLS (core) Network Architecture as proposed in "XNect: Real-time Multi-person 3D -Human Pose Estimation with a Single RGB Camera, Mehta et al." -https://arxiv.org/abs/1907.00837 - -Based on ResNet implementation in https://github.com/rwightman/pytorch-image-models -and SelecSLS Net implementation in https://github.com/mehtadushy/SelecSLS-Pytorch -""" -from typing import List - -import torch -import torch.nn as nn -import torch.nn.functional as F - -from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD -from .helpers import build_model_with_cfg -from .layers import create_classifier -from .registry import register_model - -__all__ = ['SelecSLS'] # model_registry will add each entrypoint fn to this - - -def _cfg(url='', **kwargs): - return { - 'url': url, - 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (4, 4), - 'crop_pct': 0.875, 'interpolation': 'bilinear', - 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'stem.0', 'classifier': 'fc', - **kwargs - } - - -default_cfgs = { - 'selecsls42': _cfg( - url='', - interpolation='bicubic'), - 'selecsls42b': _cfg( - url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-selecsls/selecsls42b-8af30141.pth', - interpolation='bicubic'), - 'selecsls60': _cfg( - url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-selecsls/selecsls60-bbf87526.pth', - interpolation='bicubic'), - 'selecsls60b': _cfg( - url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-selecsls/selecsls60b-94e619b5.pth', - interpolation='bicubic'), - 'selecsls84': _cfg( - url='', - interpolation='bicubic'), -} - - -class SequentialList(nn.Sequential): - - def __init__(self, *args): - super(SequentialList, self).__init__(*args) - - @torch.jit._overload_method # noqa: F811 - def forward(self, x): - # type: (List[torch.Tensor]) -> (List[torch.Tensor]) - pass - - @torch.jit._overload_method # noqa: F811 - def forward(self, x): - # type: (torch.Tensor) -> (List[torch.Tensor]) - pass - - def forward(self, x) -> List[torch.Tensor]: - for module in self: - x = module(x) - return x - - -class SelectSeq(nn.Module): - def __init__(self, mode='index', index=0): - super(SelectSeq, self).__init__() - self.mode = mode - self.index = index - - @torch.jit._overload_method # noqa: F811 - def forward(self, x): - # type: (List[torch.Tensor]) -> (torch.Tensor) - pass - - @torch.jit._overload_method # noqa: F811 - def forward(self, x): - # type: (Tuple[torch.Tensor]) -> (torch.Tensor) - pass - - def forward(self, x) -> torch.Tensor: - if self.mode == 'index': - return x[self.index] - else: - return torch.cat(x, dim=1) - - -def conv_bn(in_chs, out_chs, k=3, stride=1, padding=None, dilation=1): - if padding is None: - padding = ((stride - 1) + dilation * (k - 1)) // 2 - return nn.Sequential( - nn.Conv2d(in_chs, out_chs, k, stride, padding=padding, dilation=dilation, bias=False), - nn.BatchNorm2d(out_chs), - nn.ReLU(inplace=True) - ) - - -class SelecSLSBlock(nn.Module): - def __init__(self, in_chs, skip_chs, mid_chs, out_chs, is_first, stride, dilation=1): - super(SelecSLSBlock, self).__init__() - self.stride = stride - self.is_first = is_first - assert stride in [1, 2] - - # Process input with 4 conv blocks with the same number of input and output channels - self.conv1 = conv_bn(in_chs, mid_chs, 3, stride, dilation=dilation) - self.conv2 = conv_bn(mid_chs, mid_chs, 1) - self.conv3 = conv_bn(mid_chs, mid_chs // 2, 3) - self.conv4 = conv_bn(mid_chs // 2, mid_chs, 1) - self.conv5 = conv_bn(mid_chs, mid_chs // 2, 3) - self.conv6 = conv_bn(2 * mid_chs + (0 if is_first else skip_chs), out_chs, 1) - - def forward(self, x: List[torch.Tensor]) -> List[torch.Tensor]: - if not isinstance(x, list): - x = [x] - assert len(x) in [1, 2] - - d1 = self.conv1(x[0]) - d2 = self.conv3(self.conv2(d1)) - d3 = self.conv5(self.conv4(d2)) - if self.is_first: - out = self.conv6(torch.cat([d1, d2, d3], 1)) - return [out, out] - else: - return [self.conv6(torch.cat([d1, d2, d3, x[1]], 1)), x[1]] - - -class SelecSLS(nn.Module): - """SelecSLS42 / SelecSLS60 / SelecSLS84 - - Parameters - ---------- - cfg : network config dictionary specifying block type, feature, and head args - num_classes : int, default 1000 - Number of classification classes. - in_chans : int, default 3 - Number of input (color) channels. - drop_rate : float, default 0. - Dropout probability before classifier, for training - global_pool : str, default 'avg' - Global pooling type. One of 'avg', 'max', 'avgmax', 'catavgmax' - """ - - def __init__(self, cfg, num_classes=1000, in_chans=3, drop_rate=0.0, global_pool='avg'): - self.num_classes = num_classes - self.drop_rate = drop_rate - super(SelecSLS, self).__init__() - - self.stem = conv_bn(in_chans, 32, stride=2) - self.features = SequentialList(*[cfg['block'](*block_args) for block_args in cfg['features']]) - self.from_seq = SelectSeq() # from List[tensor] -> Tensor in module compatible way - self.head = nn.Sequential(*[conv_bn(*conv_args) for conv_args in cfg['head']]) - self.num_features = cfg['num_features'] - self.feature_info = cfg['feature_info'] - - self.global_pool, self.fc = create_classifier(self.num_features, self.num_classes, pool_type=global_pool) - - for n, m in self.named_modules(): - if isinstance(m, nn.Conv2d): - nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') - elif isinstance(m, nn.BatchNorm2d): - nn.init.constant_(m.weight, 1.) - nn.init.constant_(m.bias, 0.) - - def get_classifier(self): - return self.fc - - def reset_classifier(self, num_classes, global_pool='avg'): - self.num_classes = num_classes - self.global_pool, self.fc = create_classifier(self.num_features, self.num_classes, pool_type=global_pool) - - def forward_features(self, x): - x = self.stem(x) - x = self.features(x) - x = self.head(self.from_seq(x)) - return x - - def forward(self, x): - x = self.forward_features(x) - x = self.global_pool(x) - if self.drop_rate > 0.: - x = F.dropout(x, p=self.drop_rate, training=self.training) - x = self.fc(x) - return x - - -def _create_selecsls(variant, pretrained, **kwargs): - cfg = {} - feature_info = [dict(num_chs=32, reduction=2, module='stem.2')] - if variant.startswith('selecsls42'): - cfg['block'] = SelecSLSBlock - # Define configuration of the network after the initial neck - cfg['features'] = [ - # in_chs, skip_chs, mid_chs, out_chs, is_first, stride - (32, 0, 64, 64, True, 2), - (64, 64, 64, 128, False, 1), - (128, 0, 144, 144, True, 2), - (144, 144, 144, 288, False, 1), - (288, 0, 304, 304, True, 2), - (304, 304, 304, 480, False, 1), - ] - feature_info.extend([ - dict(num_chs=128, reduction=4, module='features.1'), - dict(num_chs=288, reduction=8, module='features.3'), - dict(num_chs=480, reduction=16, module='features.5'), - ]) - # Head can be replaced with alternative configurations depending on the problem - feature_info.append(dict(num_chs=1024, reduction=32, module='head.1')) - if variant == 'selecsls42b': - cfg['head'] = [ - (480, 960, 3, 2), - (960, 1024, 3, 1), - (1024, 1280, 3, 2), - (1280, 1024, 1, 1), - ] - feature_info.append(dict(num_chs=1024, reduction=64, module='head.3')) - cfg['num_features'] = 1024 - else: - cfg['head'] = [ - (480, 960, 3, 2), - (960, 1024, 3, 1), - (1024, 1024, 3, 2), - (1024, 1280, 1, 1), - ] - feature_info.append(dict(num_chs=1280, reduction=64, module='head.3')) - cfg['num_features'] = 1280 - - elif variant.startswith('selecsls60'): - cfg['block'] = SelecSLSBlock - # Define configuration of the network after the initial neck - cfg['features'] = [ - # in_chs, skip_chs, mid_chs, out_chs, is_first, stride - (32, 0, 64, 64, True, 2), - (64, 64, 64, 128, False, 1), - (128, 0, 128, 128, True, 2), - (128, 128, 128, 128, False, 1), - (128, 128, 128, 288, False, 1), - (288, 0, 288, 288, True, 2), - (288, 288, 288, 288, False, 1), - (288, 288, 288, 288, False, 1), - (288, 288, 288, 416, False, 1), - ] - feature_info.extend([ - dict(num_chs=128, reduction=4, module='features.1'), - dict(num_chs=288, reduction=8, module='features.4'), - dict(num_chs=416, reduction=16, module='features.8'), - ]) - # Head can be replaced with alternative configurations depending on the problem - feature_info.append(dict(num_chs=1024, reduction=32, module='head.1')) - if variant == 'selecsls60b': - cfg['head'] = [ - (416, 756, 3, 2), - (756, 1024, 3, 1), - (1024, 1280, 3, 2), - (1280, 1024, 1, 1), - ] - feature_info.append(dict(num_chs=1024, reduction=64, module='head.3')) - cfg['num_features'] = 1024 - else: - cfg['head'] = [ - (416, 756, 3, 2), - (756, 1024, 3, 1), - (1024, 1024, 3, 2), - (1024, 1280, 1, 1), - ] - feature_info.append(dict(num_chs=1280, reduction=64, module='head.3')) - cfg['num_features'] = 1280 - - elif variant == 'selecsls84': - cfg['block'] = SelecSLSBlock - # Define configuration of the network after the initial neck - cfg['features'] = [ - # in_chs, skip_chs, mid_chs, out_chs, is_first, stride - (32, 0, 64, 64, True, 2), - (64, 64, 64, 144, False, 1), - (144, 0, 144, 144, True, 2), - (144, 144, 144, 144, False, 1), - (144, 144, 144, 144, False, 1), - (144, 144, 144, 144, False, 1), - (144, 144, 144, 304, False, 1), - (304, 0, 304, 304, True, 2), - (304, 304, 304, 304, False, 1), - (304, 304, 304, 304, False, 1), - (304, 304, 304, 304, False, 1), - (304, 304, 304, 304, False, 1), - (304, 304, 304, 512, False, 1), - ] - feature_info.extend([ - dict(num_chs=144, reduction=4, module='features.1'), - dict(num_chs=304, reduction=8, module='features.6'), - dict(num_chs=512, reduction=16, module='features.12'), - ]) - # Head can be replaced with alternative configurations depending on the problem - cfg['head'] = [ - (512, 960, 3, 2), - (960, 1024, 3, 1), - (1024, 1024, 3, 2), - (1024, 1280, 3, 1), - ] - cfg['num_features'] = 1280 - feature_info.extend([ - dict(num_chs=1024, reduction=32, module='head.1'), - dict(num_chs=1280, reduction=64, module='head.3') - ]) - else: - raise ValueError('Invalid net configuration ' + variant + ' !!!') - cfg['feature_info'] = feature_info - - # this model can do 6 feature levels by default, unlike most others, leave as 0-4 to avoid surprises? - return build_model_with_cfg( - SelecSLS, variant, pretrained, - default_cfg=default_cfgs[variant], - model_cfg=cfg, - feature_cfg=dict(out_indices=(0, 1, 2, 3, 4), flatten_sequential=True), - **kwargs) - - -@register_model -def selecsls42(pretrained=False, **kwargs): - """Constructs a SelecSLS42 model. - """ - return _create_selecsls('selecsls42', pretrained, **kwargs) - - -@register_model -def selecsls42b(pretrained=False, **kwargs): - """Constructs a SelecSLS42_B model. - """ - return _create_selecsls('selecsls42b', pretrained, **kwargs) - - -@register_model -def selecsls60(pretrained=False, **kwargs): - """Constructs a SelecSLS60 model. - """ - return _create_selecsls('selecsls60', pretrained, **kwargs) - - -@register_model -def selecsls60b(pretrained=False, **kwargs): - """Constructs a SelecSLS60_B model. - """ - return _create_selecsls('selecsls60b', pretrained, **kwargs) - - -@register_model -def selecsls84(pretrained=False, **kwargs): - """Constructs a SelecSLS84 model. - """ - return _create_selecsls('selecsls84', pretrained, **kwargs) diff --git a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmcv/ops/carafe.py b/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmcv/ops/carafe.py deleted file mode 100644 index 5154cb3abfccfbbe0a1b2daa67018dbf80aaf6d2..0000000000000000000000000000000000000000 --- a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmcv/ops/carafe.py +++ /dev/null @@ -1,287 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import torch -import torch.nn as nn -import torch.nn.functional as F -from torch.autograd import Function -from torch.nn.modules.module import Module - -from ..cnn import UPSAMPLE_LAYERS, normal_init, xavier_init -from ..utils import ext_loader - -ext_module = ext_loader.load_ext('_ext', [ - 'carafe_naive_forward', 'carafe_naive_backward', 'carafe_forward', - 'carafe_backward' -]) - - -class CARAFENaiveFunction(Function): - - @staticmethod - def symbolic(g, features, masks, kernel_size, group_size, scale_factor): - return g.op( - 'mmcv::MMCVCARAFENaive', - features, - masks, - kernel_size_i=kernel_size, - group_size_i=group_size, - scale_factor_f=scale_factor) - - @staticmethod - def forward(ctx, features, masks, kernel_size, group_size, scale_factor): - assert scale_factor >= 1 - assert masks.size(1) == kernel_size * kernel_size * group_size - assert masks.size(-1) == features.size(-1) * scale_factor - assert masks.size(-2) == features.size(-2) * scale_factor - assert features.size(1) % group_size == 0 - assert (kernel_size - 1) % 2 == 0 and kernel_size >= 1 - ctx.kernel_size = kernel_size - ctx.group_size = group_size - ctx.scale_factor = scale_factor - ctx.feature_size = features.size() - ctx.mask_size = masks.size() - - n, c, h, w = features.size() - output = features.new_zeros((n, c, h * scale_factor, w * scale_factor)) - ext_module.carafe_naive_forward( - features, - masks, - output, - kernel_size=kernel_size, - group_size=group_size, - scale_factor=scale_factor) - - if features.requires_grad or masks.requires_grad: - ctx.save_for_backward(features, masks) - return output - - @staticmethod - def backward(ctx, grad_output): - assert grad_output.is_cuda - - features, masks = ctx.saved_tensors - kernel_size = ctx.kernel_size - group_size = ctx.group_size - scale_factor = ctx.scale_factor - - grad_input = torch.zeros_like(features) - grad_masks = torch.zeros_like(masks) - ext_module.carafe_naive_backward( - grad_output.contiguous(), - features, - masks, - grad_input, - grad_masks, - kernel_size=kernel_size, - group_size=group_size, - scale_factor=scale_factor) - - return grad_input, grad_masks, None, None, None - - -carafe_naive = CARAFENaiveFunction.apply - - -class CARAFENaive(Module): - - def __init__(self, kernel_size, group_size, scale_factor): - super(CARAFENaive, self).__init__() - - assert isinstance(kernel_size, int) and isinstance( - group_size, int) and isinstance(scale_factor, int) - self.kernel_size = kernel_size - self.group_size = group_size - self.scale_factor = scale_factor - - def forward(self, features, masks): - return carafe_naive(features, masks, self.kernel_size, self.group_size, - self.scale_factor) - - -class CARAFEFunction(Function): - - @staticmethod - def symbolic(g, features, masks, kernel_size, group_size, scale_factor): - return g.op( - 'mmcv::MMCVCARAFE', - features, - masks, - kernel_size_i=kernel_size, - group_size_i=group_size, - scale_factor_f=scale_factor) - - @staticmethod - def forward(ctx, features, masks, kernel_size, group_size, scale_factor): - assert scale_factor >= 1 - assert masks.size(1) == kernel_size * kernel_size * group_size - assert masks.size(-1) == features.size(-1) * scale_factor - assert masks.size(-2) == features.size(-2) * scale_factor - assert features.size(1) % group_size == 0 - assert (kernel_size - 1) % 2 == 0 and kernel_size >= 1 - ctx.kernel_size = kernel_size - ctx.group_size = group_size - ctx.scale_factor = scale_factor - ctx.feature_size = features.size() - ctx.mask_size = masks.size() - - n, c, h, w = features.size() - output = features.new_zeros((n, c, h * scale_factor, w * scale_factor)) - routput = features.new_zeros(output.size(), requires_grad=False) - rfeatures = features.new_zeros(features.size(), requires_grad=False) - rmasks = masks.new_zeros(masks.size(), requires_grad=False) - ext_module.carafe_forward( - features, - masks, - rfeatures, - routput, - rmasks, - output, - kernel_size=kernel_size, - group_size=group_size, - scale_factor=scale_factor) - - if features.requires_grad or masks.requires_grad: - ctx.save_for_backward(features, masks, rfeatures) - return output - - @staticmethod - def backward(ctx, grad_output): - assert grad_output.is_cuda - - features, masks, rfeatures = ctx.saved_tensors - kernel_size = ctx.kernel_size - group_size = ctx.group_size - scale_factor = ctx.scale_factor - - rgrad_output = torch.zeros_like(grad_output, requires_grad=False) - rgrad_input_hs = torch.zeros_like(grad_output, requires_grad=False) - rgrad_input = torch.zeros_like(features, requires_grad=False) - rgrad_masks = torch.zeros_like(masks, requires_grad=False) - grad_input = torch.zeros_like(features, requires_grad=False) - grad_masks = torch.zeros_like(masks, requires_grad=False) - ext_module.carafe_backward( - grad_output.contiguous(), - rfeatures, - masks, - rgrad_output, - rgrad_input_hs, - rgrad_input, - rgrad_masks, - grad_input, - grad_masks, - kernel_size=kernel_size, - group_size=group_size, - scale_factor=scale_factor) - return grad_input, grad_masks, None, None, None - - -carafe = CARAFEFunction.apply - - -class CARAFE(Module): - """ CARAFE: Content-Aware ReAssembly of FEatures - - Please refer to https://arxiv.org/abs/1905.02188 for more details. - - Args: - kernel_size (int): reassemble kernel size - group_size (int): reassemble group size - scale_factor (int): upsample ratio - - Returns: - upsampled feature map - """ - - def __init__(self, kernel_size, group_size, scale_factor): - super(CARAFE, self).__init__() - - assert isinstance(kernel_size, int) and isinstance( - group_size, int) and isinstance(scale_factor, int) - self.kernel_size = kernel_size - self.group_size = group_size - self.scale_factor = scale_factor - - def forward(self, features, masks): - return carafe(features, masks, self.kernel_size, self.group_size, - self.scale_factor) - - -@UPSAMPLE_LAYERS.register_module(name='carafe') -class CARAFEPack(nn.Module): - """A unified package of CARAFE upsampler that contains: 1) channel - compressor 2) content encoder 3) CARAFE op. - - Official implementation of ICCV 2019 paper - CARAFE: Content-Aware ReAssembly of FEatures - Please refer to https://arxiv.org/abs/1905.02188 for more details. - - Args: - channels (int): input feature channels - scale_factor (int): upsample ratio - up_kernel (int): kernel size of CARAFE op - up_group (int): group size of CARAFE op - encoder_kernel (int): kernel size of content encoder - encoder_dilation (int): dilation of content encoder - compressed_channels (int): output channels of channels compressor - - Returns: - upsampled feature map - """ - - def __init__(self, - channels, - scale_factor, - up_kernel=5, - up_group=1, - encoder_kernel=3, - encoder_dilation=1, - compressed_channels=64): - super(CARAFEPack, self).__init__() - self.channels = channels - self.scale_factor = scale_factor - self.up_kernel = up_kernel - self.up_group = up_group - self.encoder_kernel = encoder_kernel - self.encoder_dilation = encoder_dilation - self.compressed_channels = compressed_channels - self.channel_compressor = nn.Conv2d(channels, self.compressed_channels, - 1) - self.content_encoder = nn.Conv2d( - self.compressed_channels, - self.up_kernel * self.up_kernel * self.up_group * - self.scale_factor * self.scale_factor, - self.encoder_kernel, - padding=int((self.encoder_kernel - 1) * self.encoder_dilation / 2), - dilation=self.encoder_dilation, - groups=1) - self.init_weights() - - def init_weights(self): - for m in self.modules(): - if isinstance(m, nn.Conv2d): - xavier_init(m, distribution='uniform') - normal_init(self.content_encoder, std=0.001) - - def kernel_normalizer(self, mask): - mask = F.pixel_shuffle(mask, self.scale_factor) - n, mask_c, h, w = mask.size() - # use float division explicitly, - # to void inconsistency while exporting to onnx - mask_channel = int(mask_c / float(self.up_kernel**2)) - mask = mask.view(n, mask_channel, -1, h, w) - - mask = F.softmax(mask, dim=2, dtype=mask.dtype) - mask = mask.view(n, mask_c, h, w).contiguous() - - return mask - - def feature_reassemble(self, x, mask): - x = carafe(x, mask, self.up_kernel, self.up_group, self.scale_factor) - return x - - def forward(self, x): - compressed_x = self.channel_compressor(x) - mask = self.content_encoder(compressed_x) - mask = self.kernel_normalizer(mask) - - x = self.feature_reassemble(x, mask) - return x diff --git a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/zoe/zoedepth/data/data_mono.py b/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/zoe/zoedepth/data/data_mono.py deleted file mode 100644 index 80a8486f239a35331df553f490e213f9bf71e735..0000000000000000000000000000000000000000 --- a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/zoe/zoedepth/data/data_mono.py +++ /dev/null @@ -1,573 +0,0 @@ -# MIT License - -# Copyright (c) 2022 Intelligent Systems Lab Org - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# File author: Shariq Farooq Bhat - -# This file is partly inspired from BTS (https://github.com/cleinc/bts/blob/master/pytorch/bts_dataloader.py); author: Jin Han Lee - -import itertools -import os -import random - -import numpy as np -import cv2 -import torch -import torch.nn as nn -import torch.utils.data.distributed -from zoedepth.utils.easydict import EasyDict as edict -from PIL import Image, ImageOps -from torch.utils.data import DataLoader, Dataset -from torchvision import transforms - -from zoedepth.utils.config import change_dataset - -from .ddad import get_ddad_loader -from .diml_indoor_test import get_diml_indoor_loader -from .diml_outdoor_test import get_diml_outdoor_loader -from .diode import get_diode_loader -from .hypersim import get_hypersim_loader -from .ibims import get_ibims_loader -from .sun_rgbd_loader import get_sunrgbd_loader -from .vkitti import get_vkitti_loader -from .vkitti2 import get_vkitti2_loader - -from .preprocess import CropParams, get_white_border, get_black_border - - -def _is_pil_image(img): - return isinstance(img, Image.Image) - - -def _is_numpy_image(img): - return isinstance(img, np.ndarray) and (img.ndim in {2, 3}) - - -def preprocessing_transforms(mode, **kwargs): - return transforms.Compose([ - ToTensor(mode=mode, **kwargs) - ]) - - -class DepthDataLoader(object): - def __init__(self, config, mode, device='cpu', transform=None, **kwargs): - """ - Data loader for depth datasets - - Args: - config (dict): Config dictionary. Refer to utils/config.py - mode (str): "train" or "online_eval" - device (str, optional): Device to load the data on. Defaults to 'cpu'. - transform (torchvision.transforms, optional): Transform to apply to the data. Defaults to None. - """ - - self.config = config - - if config.dataset == 'ibims': - self.data = get_ibims_loader(config, batch_size=1, num_workers=1) - return - - if config.dataset == 'sunrgbd': - self.data = get_sunrgbd_loader( - data_dir_root=config.sunrgbd_root, batch_size=1, num_workers=1) - return - - if config.dataset == 'diml_indoor': - self.data = get_diml_indoor_loader( - data_dir_root=config.diml_indoor_root, batch_size=1, num_workers=1) - return - - if config.dataset == 'diml_outdoor': - self.data = get_diml_outdoor_loader( - data_dir_root=config.diml_outdoor_root, batch_size=1, num_workers=1) - return - - if "diode" in config.dataset: - self.data = get_diode_loader( - config[config.dataset+"_root"], batch_size=1, num_workers=1) - return - - if config.dataset == 'hypersim_test': - self.data = get_hypersim_loader( - config.hypersim_test_root, batch_size=1, num_workers=1) - return - - if config.dataset == 'vkitti': - self.data = get_vkitti_loader( - config.vkitti_root, batch_size=1, num_workers=1) - return - - if config.dataset == 'vkitti2': - self.data = get_vkitti2_loader( - config.vkitti2_root, batch_size=1, num_workers=1) - return - - if config.dataset == 'ddad': - self.data = get_ddad_loader(config.ddad_root, resize_shape=( - 352, 1216), batch_size=1, num_workers=1) - return - - img_size = self.config.get("img_size", None) - img_size = img_size if self.config.get( - "do_input_resize", False) else None - - if transform is None: - transform = preprocessing_transforms(mode, size=img_size) - - if mode == 'train': - - Dataset = DataLoadPreprocess - self.training_samples = Dataset( - config, mode, transform=transform, device=device) - - if config.distributed: - self.train_sampler = torch.utils.data.distributed.DistributedSampler( - self.training_samples) - else: - self.train_sampler = None - - self.data = DataLoader(self.training_samples, - batch_size=config.batch_size, - shuffle=(self.train_sampler is None), - num_workers=config.workers, - pin_memory=True, - persistent_workers=True, - # prefetch_factor=2, - sampler=self.train_sampler) - - elif mode == 'online_eval': - self.testing_samples = DataLoadPreprocess( - config, mode, transform=transform) - if config.distributed: # redundant. here only for readability and to be more explicit - # Give whole test set to all processes (and report evaluation only on one) regardless - self.eval_sampler = None - else: - self.eval_sampler = None - self.data = DataLoader(self.testing_samples, 1, - shuffle=kwargs.get("shuffle_test", False), - num_workers=1, - pin_memory=False, - sampler=self.eval_sampler) - - elif mode == 'test': - self.testing_samples = DataLoadPreprocess( - config, mode, transform=transform) - self.data = DataLoader(self.testing_samples, - 1, shuffle=False, num_workers=1) - - else: - print( - 'mode should be one of \'train, test, online_eval\'. Got {}'.format(mode)) - - -def repetitive_roundrobin(*iterables): - """ - cycles through iterables but sample wise - first yield first sample from first iterable then first sample from second iterable and so on - then second sample from first iterable then second sample from second iterable and so on - - If one iterable is shorter than the others, it is repeated until all iterables are exhausted - repetitive_roundrobin('ABC', 'D', 'EF') --> A D E B D F C D E - """ - # Repetitive roundrobin - iterables_ = [iter(it) for it in iterables] - exhausted = [False] * len(iterables) - while not all(exhausted): - for i, it in enumerate(iterables_): - try: - yield next(it) - except StopIteration: - exhausted[i] = True - iterables_[i] = itertools.cycle(iterables[i]) - # First elements may get repeated if one iterable is shorter than the others - yield next(iterables_[i]) - - -class RepetitiveRoundRobinDataLoader(object): - def __init__(self, *dataloaders): - self.dataloaders = dataloaders - - def __iter__(self): - return repetitive_roundrobin(*self.dataloaders) - - def __len__(self): - # First samples get repeated, thats why the plus one - return len(self.dataloaders) * (max(len(dl) for dl in self.dataloaders) + 1) - - -class MixedNYUKITTI(object): - def __init__(self, config, mode, device='cpu', **kwargs): - config = edict(config) - config.workers = config.workers // 2 - self.config = config - nyu_conf = change_dataset(edict(config), 'nyu') - kitti_conf = change_dataset(edict(config), 'kitti') - - # make nyu default for testing - self.config = config = nyu_conf - img_size = self.config.get("img_size", None) - img_size = img_size if self.config.get( - "do_input_resize", False) else None - if mode == 'train': - nyu_loader = DepthDataLoader( - nyu_conf, mode, device=device, transform=preprocessing_transforms(mode, size=img_size)).data - kitti_loader = DepthDataLoader( - kitti_conf, mode, device=device, transform=preprocessing_transforms(mode, size=img_size)).data - # It has been changed to repetitive roundrobin - self.data = RepetitiveRoundRobinDataLoader( - nyu_loader, kitti_loader) - else: - self.data = DepthDataLoader(nyu_conf, mode, device=device).data - - -def remove_leading_slash(s): - if s[0] == '/' or s[0] == '\\': - return s[1:] - return s - - -class CachedReader: - def __init__(self, shared_dict=None): - if shared_dict: - self._cache = shared_dict - else: - self._cache = {} - - def open(self, fpath): - im = self._cache.get(fpath, None) - if im is None: - im = self._cache[fpath] = Image.open(fpath) - return im - - -class ImReader: - def __init__(self): - pass - - # @cache - def open(self, fpath): - return Image.open(fpath) - - -class DataLoadPreprocess(Dataset): - def __init__(self, config, mode, transform=None, is_for_online_eval=False, **kwargs): - self.config = config - if mode == 'online_eval': - with open(config.filenames_file_eval, 'r') as f: - self.filenames = f.readlines() - else: - with open(config.filenames_file, 'r') as f: - self.filenames = f.readlines() - - self.mode = mode - self.transform = transform - self.to_tensor = ToTensor(mode) - self.is_for_online_eval = is_for_online_eval - if config.use_shared_dict: - self.reader = CachedReader(config.shared_dict) - else: - self.reader = ImReader() - - def postprocess(self, sample): - return sample - - def __getitem__(self, idx): - sample_path = self.filenames[idx] - focal = float(sample_path.split()[2]) - sample = {} - - if self.mode == 'train': - if self.config.dataset == 'kitti' and self.config.use_right and random.random() > 0.5: - image_path = os.path.join( - self.config.data_path, remove_leading_slash(sample_path.split()[3])) - depth_path = os.path.join( - self.config.gt_path, remove_leading_slash(sample_path.split()[4])) - else: - image_path = os.path.join( - self.config.data_path, remove_leading_slash(sample_path.split()[0])) - depth_path = os.path.join( - self.config.gt_path, remove_leading_slash(sample_path.split()[1])) - - image = self.reader.open(image_path) - depth_gt = self.reader.open(depth_path) - w, h = image.size - - if self.config.do_kb_crop: - height = image.height - width = image.width - top_margin = int(height - 352) - left_margin = int((width - 1216) / 2) - depth_gt = depth_gt.crop( - (left_margin, top_margin, left_margin + 1216, top_margin + 352)) - image = image.crop( - (left_margin, top_margin, left_margin + 1216, top_margin + 352)) - - # Avoid blank boundaries due to pixel registration? - # Train images have white border. Test images have black border. - if self.config.dataset == 'nyu' and self.config.avoid_boundary: - # print("Avoiding Blank Boundaries!") - # We just crop and pad again with reflect padding to original size - # original_size = image.size - crop_params = get_white_border(np.array(image, dtype=np.uint8)) - image = image.crop((crop_params.left, crop_params.top, crop_params.right, crop_params.bottom)) - depth_gt = depth_gt.crop((crop_params.left, crop_params.top, crop_params.right, crop_params.bottom)) - - # Use reflect padding to fill the blank - image = np.array(image) - image = np.pad(image, ((crop_params.top, h - crop_params.bottom), (crop_params.left, w - crop_params.right), (0, 0)), mode='reflect') - image = Image.fromarray(image) - - depth_gt = np.array(depth_gt) - depth_gt = np.pad(depth_gt, ((crop_params.top, h - crop_params.bottom), (crop_params.left, w - crop_params.right)), 'constant', constant_values=0) - depth_gt = Image.fromarray(depth_gt) - - - if self.config.do_random_rotate and (self.config.aug): - random_angle = (random.random() - 0.5) * 2 * self.config.degree - image = self.rotate_image(image, random_angle) - depth_gt = self.rotate_image( - depth_gt, random_angle, flag=Image.NEAREST) - - image = np.asarray(image, dtype=np.float32) / 255.0 - depth_gt = np.asarray(depth_gt, dtype=np.float32) - depth_gt = np.expand_dims(depth_gt, axis=2) - - if self.config.dataset == 'nyu': - depth_gt = depth_gt / 1000.0 - else: - depth_gt = depth_gt / 256.0 - - if self.config.aug and (self.config.random_crop): - image, depth_gt = self.random_crop( - image, depth_gt, self.config.input_height, self.config.input_width) - - if self.config.aug and self.config.random_translate: - # print("Random Translation!") - image, depth_gt = self.random_translate(image, depth_gt, self.config.max_translation) - - image, depth_gt = self.train_preprocess(image, depth_gt) - mask = np.logical_and(depth_gt > self.config.min_depth, - depth_gt < self.config.max_depth).squeeze()[None, ...] - sample = {'image': image, 'depth': depth_gt, 'focal': focal, - 'mask': mask, **sample} - - else: - if self.mode == 'online_eval': - data_path = self.config.data_path_eval - else: - data_path = self.config.data_path - - image_path = os.path.join( - data_path, remove_leading_slash(sample_path.split()[0])) - image = np.asarray(self.reader.open(image_path), - dtype=np.float32) / 255.0 - - if self.mode == 'online_eval': - gt_path = self.config.gt_path_eval - depth_path = os.path.join( - gt_path, remove_leading_slash(sample_path.split()[1])) - has_valid_depth = False - try: - depth_gt = self.reader.open(depth_path) - has_valid_depth = True - except IOError: - depth_gt = False - # print('Missing gt for {}'.format(image_path)) - - if has_valid_depth: - depth_gt = np.asarray(depth_gt, dtype=np.float32) - depth_gt = np.expand_dims(depth_gt, axis=2) - if self.config.dataset == 'nyu': - depth_gt = depth_gt / 1000.0 - else: - depth_gt = depth_gt / 256.0 - - mask = np.logical_and( - depth_gt >= self.config.min_depth, depth_gt <= self.config.max_depth).squeeze()[None, ...] - else: - mask = False - - if self.config.do_kb_crop: - height = image.shape[0] - width = image.shape[1] - top_margin = int(height - 352) - left_margin = int((width - 1216) / 2) - image = image[top_margin:top_margin + 352, - left_margin:left_margin + 1216, :] - if self.mode == 'online_eval' and has_valid_depth: - depth_gt = depth_gt[top_margin:top_margin + - 352, left_margin:left_margin + 1216, :] - - if self.mode == 'online_eval': - sample = {'image': image, 'depth': depth_gt, 'focal': focal, 'has_valid_depth': has_valid_depth, - 'image_path': sample_path.split()[0], 'depth_path': sample_path.split()[1], - 'mask': mask} - else: - sample = {'image': image, 'focal': focal} - - if (self.mode == 'train') or ('has_valid_depth' in sample and sample['has_valid_depth']): - mask = np.logical_and(depth_gt > self.config.min_depth, - depth_gt < self.config.max_depth).squeeze()[None, ...] - sample['mask'] = mask - - if self.transform: - sample = self.transform(sample) - - sample = self.postprocess(sample) - sample['dataset'] = self.config.dataset - sample = {**sample, 'image_path': sample_path.split()[0], 'depth_path': sample_path.split()[1]} - - return sample - - def rotate_image(self, image, angle, flag=Image.BILINEAR): - result = image.rotate(angle, resample=flag) - return result - - def random_crop(self, img, depth, height, width): - assert img.shape[0] >= height - assert img.shape[1] >= width - assert img.shape[0] == depth.shape[0] - assert img.shape[1] == depth.shape[1] - x = random.randint(0, img.shape[1] - width) - y = random.randint(0, img.shape[0] - height) - img = img[y:y + height, x:x + width, :] - depth = depth[y:y + height, x:x + width, :] - - return img, depth - - def random_translate(self, img, depth, max_t=20): - assert img.shape[0] == depth.shape[0] - assert img.shape[1] == depth.shape[1] - p = self.config.translate_prob - do_translate = random.random() - if do_translate > p: - return img, depth - x = random.randint(-max_t, max_t) - y = random.randint(-max_t, max_t) - M = np.float32([[1, 0, x], [0, 1, y]]) - # print(img.shape, depth.shape) - img = cv2.warpAffine(img, M, (img.shape[1], img.shape[0])) - depth = cv2.warpAffine(depth, M, (depth.shape[1], depth.shape[0])) - depth = depth.squeeze()[..., None] # add channel dim back. Affine warp removes it - # print("after", img.shape, depth.shape) - return img, depth - - def train_preprocess(self, image, depth_gt): - if self.config.aug: - # Random flipping - do_flip = random.random() - if do_flip > 0.5: - image = (image[:, ::-1, :]).copy() - depth_gt = (depth_gt[:, ::-1, :]).copy() - - # Random gamma, brightness, color augmentation - do_augment = random.random() - if do_augment > 0.5: - image = self.augment_image(image) - - return image, depth_gt - - def augment_image(self, image): - # gamma augmentation - gamma = random.uniform(0.9, 1.1) - image_aug = image ** gamma - - # brightness augmentation - if self.config.dataset == 'nyu': - brightness = random.uniform(0.75, 1.25) - else: - brightness = random.uniform(0.9, 1.1) - image_aug = image_aug * brightness - - # color augmentation - colors = np.random.uniform(0.9, 1.1, size=3) - white = np.ones((image.shape[0], image.shape[1])) - color_image = np.stack([white * colors[i] for i in range(3)], axis=2) - image_aug *= color_image - image_aug = np.clip(image_aug, 0, 1) - - return image_aug - - def __len__(self): - return len(self.filenames) - - -class ToTensor(object): - def __init__(self, mode, do_normalize=False, size=None): - self.mode = mode - self.normalize = transforms.Normalize( - mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) if do_normalize else nn.Identity() - self.size = size - if size is not None: - self.resize = transforms.Resize(size=size) - else: - self.resize = nn.Identity() - - def __call__(self, sample): - image, focal = sample['image'], sample['focal'] - image = self.to_tensor(image) - image = self.normalize(image) - image = self.resize(image) - - if self.mode == 'test': - return {'image': image, 'focal': focal} - - depth = sample['depth'] - if self.mode == 'train': - depth = self.to_tensor(depth) - return {**sample, 'image': image, 'depth': depth, 'focal': focal} - else: - has_valid_depth = sample['has_valid_depth'] - image = self.resize(image) - return {**sample, 'image': image, 'depth': depth, 'focal': focal, 'has_valid_depth': has_valid_depth, - 'image_path': sample['image_path'], 'depth_path': sample['depth_path']} - - def to_tensor(self, pic): - if not (_is_pil_image(pic) or _is_numpy_image(pic)): - raise TypeError( - 'pic should be PIL Image or ndarray. Got {}'.format(type(pic))) - - if isinstance(pic, np.ndarray): - img = torch.from_numpy(pic.transpose((2, 0, 1))) - return img - - # handle PIL Image - if pic.mode == 'I': - img = torch.from_numpy(np.array(pic, np.int32, copy=False)) - elif pic.mode == 'I;16': - img = torch.from_numpy(np.array(pic, np.int16, copy=False)) - else: - img = torch.ByteTensor( - torch.ByteStorage.from_buffer(pic.tobytes())) - # PIL image mode: 1, L, P, I, F, RGB, YCbCr, RGBA, CMYK - if pic.mode == 'YCbCr': - nchannel = 3 - elif pic.mode == 'I;16': - nchannel = 1 - else: - nchannel = len(pic.mode) - img = img.view(pic.size[1], pic.size[0], nchannel) - - img = img.transpose(0, 1).transpose(0, 2).contiguous() - if isinstance(img, torch.ByteTensor): - return img.float() - else: - return img diff --git a/spaces/cosmicdream/Image_Variations/README.md b/spaces/cosmicdream/Image_Variations/README.md deleted file mode 100644 index ad1301b7ac10c74726fb4b5258fc27aba95a5367..0000000000000000000000000000000000000000 --- a/spaces/cosmicdream/Image_Variations/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Image Variations -emoji: 😻 -colorFrom: yellow -colorTo: indigo -sdk: gradio -sdk_version: 3.0.24 -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/daddyjin/TalkingFaceGeneration/FONT/train.py b/spaces/daddyjin/TalkingFaceGeneration/FONT/train.py deleted file mode 100644 index c9a2dfd5feae7b2a48c689df94797db7acbc3680..0000000000000000000000000000000000000000 --- a/spaces/daddyjin/TalkingFaceGeneration/FONT/train.py +++ /dev/null @@ -1,430 +0,0 @@ -from tqdm import trange -import torch -import torch.nn as nn -from torch.utils.data import DataLoader - -from logger import Logger -from modules.model import DiscriminatorFullModel, TrainPart1Model, TrainPart2Model -import itertools - -from torch.optim.lr_scheduler import MultiStepLR - -from sync_batchnorm import DataParallelWithCallback - -from frames_dataset import DatasetRepeater,TestsetRepeater -import time -from tensorboardX import SummaryWriter - -def train_part1(config, generator, discriminator, kp_detector, kp_detector_a,audio_feature, checkpoint, audio_checkpoint, log_dir, dataset, test_dataset, device_ids, name): - train_params = config['train_params'] - - optimizer_audio_feature = torch.optim.Adam(itertools.chain(audio_feature.parameters(),kp_detector_a.parameters()), lr=train_params['lr_audio_feature'], betas=(0.5, 0.999)) - optimizer_generator = None - optimizer_discriminator = None - optimizer_kp_detector = None - - if checkpoint is not None: - start_epoch = Logger.load_cpk(checkpoint, generator, discriminator, kp_detector, audio_feature, - optimizer_generator, optimizer_discriminator, - None if train_params['lr_kp_detector'] == 0 else optimizer_kp_detector, - None if train_params['lr_audio_feature'] == 0 else optimizer_audio_feature) - - - # audio_feature load wav2lip - wav2lip_ckpt_path = "/data/liujin/Wav2Lip-master/checkpoints/wav2lip.pth" - checkpoint = torch.load(wav2lip_ckpt_path) - s = checkpoint["state_dict"] - new_s = {} - for k, v in s.items(): - new_s[k.replace('module.', '')] = v - audio_feature.load_state_dict(new_s, strict=False) - - - if audio_checkpoint is not None: - pretrain = torch.load(audio_checkpoint) - kp_detector_a.load_state_dict(pretrain['kp_detector_a']) - audio_feature.load_state_dict(pretrain['audio_feature']) - optimizer_audio_feature.load_state_dict(pretrain['optimizer_audio_feature']) - start_epoch = pretrain['epoch'] - - else: - start_epoch = 0 - - - scheduler_audio_feature = MultiStepLR(optimizer_audio_feature, train_params['epoch_milestones'], gamma=0.1, - last_epoch=-1 + start_epoch * (train_params['lr_audio_feature'] != 0)) - - if 'num_repeats' in train_params or train_params['num_repeats'] != 1: - dataset = DatasetRepeater(dataset, train_params['num_repeats']) - test_dataset = TestsetRepeater(test_dataset, train_params['num_repeats']) - dataloader = DataLoader(dataset, batch_size=train_params['batch_size'], shuffle=True, num_workers=0, drop_last=True)#6 - test_dataloader = DataLoader(test_dataset, batch_size=train_params['batch_size'], shuffle=True, num_workers=0, drop_last=True)#6 - num_steps_per_epoch = len(dataloader) - num_steps_test_epoch = len(test_dataloader) - generator_full = TrainPart1Model(kp_detector, kp_detector_a, audio_feature, generator, discriminator, train_params,device_ids) - discriminator_full = DiscriminatorFullModel(kp_detector, generator, discriminator, train_params) - - if len(device_ids)>1: - generator_full=torch.nn.DataParallel(generator_full) - discriminator_full=torch.nn.DataParallel(discriminator_full) - - if torch.cuda.is_available(): - if len(device_ids) == 1: - generator_full = DataParallelWithCallback(generator_full, device_ids=device_ids) - discriminator_full = DataParallelWithCallback(discriminator_full, device_ids=device_ids) - elif len(device_ids)>1: - generator_full = generator_full.to(device_ids[0]) - discriminator_full = discriminator_full.to(device_ids[0]) - - step = 0 - t0 = time.time() - - writer=SummaryWriter(comment=name) - train_itr=0 - test_itr=0 - with Logger(log_dir=log_dir, visualizer_params=config['visualizer_params'], checkpoint_freq=train_params['checkpoint_freq']) as logger: - for epoch in trange(start_epoch, train_params['num_epochs']): - - for x in dataloader: - - losses_generator, generated = generator_full(x) - - - loss_values = [val.mean() for val in losses_generator.values()] - loss = sum(loss_values) - - writer.add_scalar('Train',loss,train_itr) - - writer.add_scalar('Train_value',loss_values[0],train_itr) - writer.add_scalar('Train_heatmap',loss_values[1],train_itr) - writer.add_scalar('Train_jacobian',loss_values[2],train_itr) - - train_itr+=1 - loss.backward() - - - optimizer_audio_feature.step() - optimizer_audio_feature.zero_grad() - d = time.time() - - # if train_params['loss_weights']['generator_gan'] != 0: - # optimizer_discriminator.zero_grad() - # else: - # losses_discriminator = {} - - # losses_generator.update(losses_discriminator) - losses = {key: value.mean().detach().data.cpu().numpy() for key, value in losses_generator.items()} - logger.log_iter(losses=losses) - e = time.time() - - step += 1 - - if(step % 2500 == 0): - print('Save ckpt and training visualization!') - logger.log_epoch(epoch,step, {'audio_feature': audio_feature, - 'kp_detector_a':kp_detector_a, - 'optimizer_audio_feature': optimizer_audio_feature}, inp=x, out=generated) - - - scheduler_audio_feature.step() - - - for x in test_dataloader: - with torch.no_grad(): - losses_generator, generated = generator_full(x) - - loss_values = [val.mean() for val in losses_generator.values()] - loss = sum(loss_values) - - writer.add_scalar('Test',loss,test_itr) - - writer.add_scalar('Test_value',loss_values[0],test_itr) - writer.add_scalar('Test_heatmap',loss_values[1],test_itr) - writer.add_scalar('Test_jacobian',loss_values[2],test_itr) - - test_itr+=1 - - - -def train_part1_fine_tune(config, generator, discriminator, kp_detector, kp_detector_a,audio_feature, checkpoint, audio_checkpoint, log_dir, dataset, test_dataset, device_ids, name): - train_params = config['train_params'] - - optimizer_generator = torch.optim.Adam(generator.parameters(), lr=train_params['lr_generator'], betas=(0.5, 0.999)) - optimizer_discriminator = torch.optim.Adam(discriminator.parameters(), lr=train_params['lr_discriminator'], betas=(0.5, 0.999)) - optimizer_audio_feature = torch.optim.Adam(itertools.chain(audio_feature.parameters(),kp_detector_a.parameters()), lr=train_params['lr_audio_feature'], betas=(0.5, 0.999)) - # optimizer_kp_detector_a = torch.optim.Adam(kp_detector_a.parameters(), lr=train_params['lr_audio_feature'], betas=(0.5, 0.999)) - optimizer_kp_detector = None - - - if checkpoint is not None: - start_epoch = Logger.load_cpk(checkpoint, generator, discriminator, kp_detector, audio_feature, - optimizer_generator, optimizer_discriminator, - None if train_params['lr_kp_detector'] == 0 else optimizer_kp_detector, - None if train_params['lr_audio_feature'] == 0 else optimizer_audio_feature) - if audio_checkpoint is not None: - pretrain = torch.load(audio_checkpoint) - kp_detector_a.load_state_dict(pretrain['kp_detector_a']) - audio_feature.load_state_dict(pretrain['audio_feature']) - # optimizer_kp_detector_a.load_state_dict(pretrain['optimizer_kp_detector_a']) - optimizer_audio_feature.load_state_dict(pretrain['optimizer_audio_feature']) - start_epoch = pretrain['epoch'] - - - else: - start_epoch = 0 - - scheduler_generator = MultiStepLR(optimizer_generator, train_params['epoch_milestones'], gamma=0.1, - last_epoch=start_epoch - 1) - scheduler_discriminator = MultiStepLR(optimizer_discriminator, train_params['epoch_milestones'], gamma=0.1, - last_epoch=start_epoch - 1) - scheduler_audio_feature = MultiStepLR(optimizer_audio_feature, train_params['epoch_milestones'], gamma=0.1, - last_epoch=-1 + start_epoch * (train_params['lr_audio_feature'] != 0)) - - if 'num_repeats' in train_params or train_params['num_repeats'] != 1: - dataset = DatasetRepeater(dataset, train_params['num_repeats']) - test_dataset = TestsetRepeater(test_dataset, train_params['num_repeats']) - dataloader = DataLoader(dataset, batch_size=train_params['batch_size'], shuffle=True, num_workers=0, drop_last=True)#6 - test_dataloader = DataLoader(test_dataset, batch_size=train_params['batch_size'], shuffle=True, num_workers=0, drop_last=True)#6 - num_steps_per_epoch = len(dataloader) - num_steps_test_epoch = len(test_dataloader) - # generator_full = TrainFullModel(kp_detector, kp_detector_a, audio_feature, generator, discriminator, train_params,device_ids) - generator_full = TrainPart1Model(kp_detector, kp_detector_a, audio_feature, generator, discriminator, train_params, device_ids) - - - discriminator_full = DiscriminatorFullModel(kp_detector, generator, discriminator, train_params) - print('End dataload ', file=open('log/MEAD_LRW_test_a.txt', 'a')) - if len(device_ids)>1: - generator_full=torch.nn.DataParallel(generator_full) - discriminator_full=torch.nn.DataParallel(discriminator_full) - - if torch.cuda.is_available(): - if len(device_ids) == 1: - generator_full = DataParallelWithCallback(generator_full, device_ids=device_ids) - discriminator_full = DataParallelWithCallback(discriminator_full, device_ids=device_ids) - elif len(device_ids)>1: - generator_full = generator_full.to(device_ids[0]) - discriminator_full = discriminator_full.to(device_ids[0]) - - step = 0 - t0 = time.time() - - writer=SummaryWriter(comment=name) - train_itr=0 - test_itr=0 - with Logger(log_dir=log_dir, visualizer_params=config['visualizer_params'], checkpoint_freq=train_params['checkpoint_freq']) as logger: - for epoch in trange(start_epoch, train_params['num_epochs']): - - for x in dataloader: - - - losses_generator, generated = generator_full(x) - - loss_values = [val.mean() for val in losses_generator.values()] - loss = sum(loss_values) - - writer.add_scalar('Train',loss,train_itr) - - writer.add_scalar('Train_value',loss_values[0],train_itr) - writer.add_scalar('Train_heatmap',loss_values[1],train_itr) - writer.add_scalar('Train_jacobian',loss_values[2],train_itr) - writer.add_scalar('Train_perceptual',loss_values[3],train_itr) - - - train_itr+=1 - loss.backward() - - - - optimizer_audio_feature.step() - optimizer_audio_feature.zero_grad() - - optimizer_generator.step() - optimizer_generator.zero_grad() - # optimizer_kp_detector_a.step() - # optimizer_kp_detector_a.zero_grad() - - if train_params['loss_weights']['discriminator_gan'] != 0: - optimizer_discriminator.zero_grad() - # losses_discriminator = discriminator_full(x, generated) - # loss_values = [val.mean() for val in losses_discriminator.values()] - # loss = sum(loss_values) - - # loss.backward() - # optimizer_discriminator.step() - # optimizer_discriminator.zero_grad() - else: - losses_discriminator = {} - - losses_generator.update(losses_discriminator) - losses = {key: value.mean().detach().data.cpu().numpy() for key, value in losses_generator.items()} - logger.log_iter(losses=losses) - - step += 1 - - if(step % 5000 == 0): - - logger.log_epoch(epoch,step, {'audio_feature': audio_feature, - 'kp_detector_a':kp_detector_a, - 'generator': generator, - 'optimizer_generator':optimizer_generator, - 'optimizer_audio_feature': optimizer_audio_feature}, inp=x, out=generated) - - scheduler_generator.step() - scheduler_discriminator.step() - scheduler_audio_feature.step() - - - for x in test_dataloader: - with torch.no_grad(): - losses_generator, generated = generator_full(x) - - loss_values = [val.mean() for val in losses_generator.values()] - loss = sum(loss_values) - - writer.add_scalar('Test',loss,test_itr) - - writer.add_scalar('Test_value',loss_values[0],test_itr) - writer.add_scalar('Test_heatmap',loss_values[1],test_itr) - writer.add_scalar('Test_jacobian',loss_values[2],test_itr) - writer.add_scalar('Test_perceptual',loss_values[3],test_itr) - - test_itr+=1 - - -def train_part2(config, generator, discriminator, kp_detector, emo_detector, kp_detector_a,audio_feature, checkpoint, audio_checkpoint, emo_checkpoint, log_dir, dataset, test_dataset, device_ids, exp_name): - train_params = config['train_params'] - - optimizer_emo_detector = torch.optim.Adam(emo_detector.parameters(), lr=train_params['lr_audio_feature'], betas=(0.5, 0.999)) - - if checkpoint is not None: - start_epoch = Logger.load_cpk(checkpoint, generator, discriminator, kp_detector, audio_feature, - optimizer_generator, optimizer_discriminator, - None if train_params['lr_kp_detector'] == 0 else optimizer_kp_detector, - None if train_params['lr_audio_feature'] == 0 else optimizer_audio_feature) - if emo_checkpoint is not None: - pretrain = torch.load(emo_checkpoint) - tgt_state = emo_detector.state_dict() - strip = 'module.' - if 'emo_detector' in pretrain: - emo_detector.load_state_dict(pretrain['emo_detector']) - optimizer_emo_detector.load_state_dict(pretrain['optimizer_emo_detector']) - print('emo_detector in pretrain + load', file=open('log/'+exp_name+'.txt', 'a')) - for name, param in pretrain.items(): - if isinstance(param, nn.Parameter): - param = param.data - if strip is not None and name.startswith(strip): - name = name[len(strip):] - if name not in tgt_state: - continue - tgt_state[name].copy_(param) - print(name) - if audio_checkpoint is not None: - pretrain = torch.load(audio_checkpoint) - kp_detector_a.load_state_dict(pretrain['kp_detector_a']) - audio_feature.load_state_dict(pretrain['audio_feature']) - optimizer_audio_feature.load_state_dict(pretrain['optimizer_audio_feature']) - if 'emo_detector' in pretrain: - emo_detector.load_state_dict(pretrain['emo_detector']) - optimizer_emo_detector.load_state_dict(pretrain['optimizer_emo_detector']) - start_epoch = pretrain['epoch'] - - else: - start_epoch = 0 - - - scheduler_emo_detector = MultiStepLR(optimizer_emo_detector, train_params['epoch_milestones'], gamma=0.1, - last_epoch=-1 + start_epoch * (train_params['lr_audio_feature'] != 0)) - - if 'num_repeats' in train_params or train_params['num_repeats'] != 1: - dataset = DatasetRepeater(dataset, train_params['num_repeats']) - test_dataset = TestsetRepeater(test_dataset, train_params['num_repeats']) - dataloader = DataLoader(dataset, batch_size=train_params['batch_size'], shuffle=True, num_workers=0, drop_last=True)#6 - test_dataloader = DataLoader(test_dataset, batch_size=train_params['batch_size'], shuffle=True, num_workers=0, drop_last=True)#6 - num_steps_per_epoch = len(dataloader) - num_steps_test_epoch = len(test_dataloader) - generator_full = TrainPart2Model(kp_detector, emo_detector,kp_detector_a, audio_feature,generator, discriminator, train_params,device_ids) - discriminator_full = DiscriminatorFullModel(kp_detector, generator, discriminator, train_params) - - if len(device_ids)>1: - generator_full=torch.nn.DataParallel(generator_full) - discriminator_full=torch.nn.DataParallel(discriminator_full) - - if torch.cuda.is_available(): - if len(device_ids) == 1: - generator_full = DataParallelWithCallback(generator_full, device_ids=device_ids) - discriminator_full = DataParallelWithCallback(discriminator_full, device_ids=device_ids) - elif len(device_ids)>1: - generator_full = generator_full.to(device_ids[0]) - discriminator_full = discriminator_full.to(device_ids[0]) - - step = 0 - t0 = time.time() - - writer=SummaryWriter(comment=exp_name) - train_itr=0 - test_itr=0 - with Logger(log_dir=log_dir, visualizer_params=config['visualizer_params'], checkpoint_freq=train_params['checkpoint_freq']) as logger: - for epoch in trange(start_epoch, train_params['num_epochs']): - - for x in dataloader: - - losses_generator, generated = generator_full(x) - - loss_values = [val.mean() for val in losses_generator.values()] - loss = sum(loss_values) - - writer.add_scalar('Train',loss,train_itr) - - writer.add_scalar('Train_value',loss_values[0],train_itr) - # writer.add_scalar('Train_heatmap',loss_values[1],train_itr) - writer.add_scalar('Train_jacobian',loss_values[1],train_itr) - writer.add_scalar('Train_classify',loss_values[2],train_itr) - - - - train_itr+=1 - loss.backward() - - - optimizer_emo_detector.step() - optimizer_emo_detector.zero_grad() - - - losses = {key: value.mean().detach().data.cpu().numpy() for key, value in losses_generator.items()} - logger.log_iter(losses=losses) - - step += 1 - - if(step % 1000 == 0): - - logger.log_epoch(epoch,step, {'audio_feature': audio_feature, - 'kp_detector_a':kp_detector_a, - 'emo_detector':emo_detector, - 'optimizer_emo_detector': optimizer_emo_detector, - # 'optimizer_kp_detector_a':optimizer_kp_detector_a, - 'optimizer_audio_feature': optimizer_audio_feature}, inp=x, out=generated) - - scheduler_emo_detector.step() - - - for x in test_dataloader: - with torch.no_grad(): - losses_generator, generated = generator_full(x) - - loss_values = [val.mean() for val in losses_generator.values()] - loss = sum(loss_values) - - writer.add_scalar('Test',loss,test_itr) - - writer.add_scalar('Test_value',loss_values[0],test_itr) - # writer.add_scalar('Test_heatmap',loss_values[1],test_itr) - writer.add_scalar('Test_jacobian',loss_values[1],test_itr) - writer.add_scalar('Test_classify',loss_values[2],test_itr) - - - test_itr+=1 - - - - - diff --git a/spaces/datasciencedojo/Finger-Counting-Right-Hand/README.md b/spaces/datasciencedojo/Finger-Counting-Right-Hand/README.md deleted file mode 100644 index 0675040eac9debe9c9feda4c9ef7860f83c18abb..0000000000000000000000000000000000000000 --- a/spaces/datasciencedojo/Finger-Counting-Right-Hand/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Finger Counting Right Hand -emoji: 🌖 -colorFrom: blue -colorTo: indigo -sdk: gradio -sdk_version: 3.4.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/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/fontTools/subset/cff.py b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/fontTools/subset/cff.py deleted file mode 100644 index dd79f6db37a482891b6f151159ef4c9b89475b8e..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/fontTools/subset/cff.py +++ /dev/null @@ -1,536 +0,0 @@ -from fontTools.misc import psCharStrings -from fontTools import ttLib -from fontTools.pens.basePen import NullPen -from fontTools.misc.roundTools import otRound -from fontTools.misc.loggingTools import deprecateFunction -from fontTools.subset.util import _add_method, _uniq_sort - - -class _ClosureGlyphsT2Decompiler(psCharStrings.SimpleT2Decompiler): - def __init__(self, components, localSubrs, globalSubrs): - psCharStrings.SimpleT2Decompiler.__init__(self, localSubrs, globalSubrs) - self.components = components - - def op_endchar(self, index): - args = self.popall() - if len(args) >= 4: - from fontTools.encodings.StandardEncoding import StandardEncoding - - # endchar can do seac accent bulding; The T2 spec says it's deprecated, - # but recent software that shall remain nameless does output it. - adx, ady, bchar, achar = args[-4:] - baseGlyph = StandardEncoding[bchar] - accentGlyph = StandardEncoding[achar] - self.components.add(baseGlyph) - self.components.add(accentGlyph) - - -@_add_method(ttLib.getTableClass("CFF ")) -def closure_glyphs(self, s): - cff = self.cff - assert len(cff) == 1 - font = cff[cff.keys()[0]] - glyphSet = font.CharStrings - - decompose = s.glyphs - while decompose: - components = set() - for g in decompose: - if g not in glyphSet: - continue - gl = glyphSet[g] - - subrs = getattr(gl.private, "Subrs", []) - decompiler = _ClosureGlyphsT2Decompiler(components, subrs, gl.globalSubrs) - decompiler.execute(gl) - components -= s.glyphs - s.glyphs.update(components) - decompose = components - - -def _empty_charstring(font, glyphName, isCFF2, ignoreWidth=False): - c, fdSelectIndex = font.CharStrings.getItemAndSelector(glyphName) - if isCFF2 or ignoreWidth: - # CFF2 charstrings have no widths nor 'endchar' operators - c.setProgram([] if isCFF2 else ["endchar"]) - else: - if hasattr(font, "FDArray") and font.FDArray is not None: - private = font.FDArray[fdSelectIndex].Private - else: - private = font.Private - dfltWdX = private.defaultWidthX - nmnlWdX = private.nominalWidthX - pen = NullPen() - c.draw(pen) # this will set the charstring's width - if c.width != dfltWdX: - c.program = [c.width - nmnlWdX, "endchar"] - else: - c.program = ["endchar"] - - -@_add_method(ttLib.getTableClass("CFF ")) -def prune_pre_subset(self, font, options): - cff = self.cff - # CFF table must have one font only - cff.fontNames = cff.fontNames[:1] - - if options.notdef_glyph and not options.notdef_outline: - isCFF2 = cff.major > 1 - for fontname in cff.keys(): - font = cff[fontname] - _empty_charstring(font, ".notdef", isCFF2=isCFF2) - - # Clear useless Encoding - for fontname in cff.keys(): - font = cff[fontname] - # https://github.com/fonttools/fonttools/issues/620 - font.Encoding = "StandardEncoding" - - return True # bool(cff.fontNames) - - -@_add_method(ttLib.getTableClass("CFF ")) -def subset_glyphs(self, s): - cff = self.cff - for fontname in cff.keys(): - font = cff[fontname] - cs = font.CharStrings - - glyphs = s.glyphs.union(s.glyphs_emptied) - - # Load all glyphs - for g in font.charset: - if g not in glyphs: - continue - c, _ = cs.getItemAndSelector(g) - - if cs.charStringsAreIndexed: - indices = [i for i, g in enumerate(font.charset) if g in glyphs] - csi = cs.charStringsIndex - csi.items = [csi.items[i] for i in indices] - del csi.file, csi.offsets - if hasattr(font, "FDSelect"): - sel = font.FDSelect - sel.format = None - sel.gidArray = [sel.gidArray[i] for i in indices] - newCharStrings = {} - for indicesIdx, charsetIdx in enumerate(indices): - g = font.charset[charsetIdx] - if g in cs.charStrings: - newCharStrings[g] = indicesIdx - cs.charStrings = newCharStrings - else: - cs.charStrings = {g: v for g, v in cs.charStrings.items() if g in glyphs} - font.charset = [g for g in font.charset if g in glyphs] - font.numGlyphs = len(font.charset) - - if s.options.retain_gids: - isCFF2 = cff.major > 1 - for g in s.glyphs_emptied: - _empty_charstring(font, g, isCFF2=isCFF2, ignoreWidth=True) - - return True # any(cff[fontname].numGlyphs for fontname in cff.keys()) - - -@_add_method(psCharStrings.T2CharString) -def subset_subroutines(self, subrs, gsubrs): - p = self.program - for i in range(1, len(p)): - if p[i] == "callsubr": - assert isinstance(p[i - 1], int) - p[i - 1] = subrs._used.index(p[i - 1] + subrs._old_bias) - subrs._new_bias - elif p[i] == "callgsubr": - assert isinstance(p[i - 1], int) - p[i - 1] = ( - gsubrs._used.index(p[i - 1] + gsubrs._old_bias) - gsubrs._new_bias - ) - - -@_add_method(psCharStrings.T2CharString) -def drop_hints(self): - hints = self._hints - - if hints.deletions: - p = self.program - for idx in reversed(hints.deletions): - del p[idx - 2 : idx] - - if hints.has_hint: - assert not hints.deletions or hints.last_hint <= hints.deletions[0] - self.program = self.program[hints.last_hint :] - if not self.program: - # TODO CFF2 no need for endchar. - self.program.append("endchar") - if hasattr(self, "width"): - # Insert width back if needed - if self.width != self.private.defaultWidthX: - # For CFF2 charstrings, this should never happen - assert ( - self.private.defaultWidthX is not None - ), "CFF2 CharStrings must not have an initial width value" - self.program.insert(0, self.width - self.private.nominalWidthX) - - if hints.has_hintmask: - i = 0 - p = self.program - while i < len(p): - if p[i] in ["hintmask", "cntrmask"]: - assert i + 1 <= len(p) - del p[i : i + 2] - continue - i += 1 - - assert len(self.program) - - del self._hints - - -class _MarkingT2Decompiler(psCharStrings.SimpleT2Decompiler): - def __init__(self, localSubrs, globalSubrs, private): - psCharStrings.SimpleT2Decompiler.__init__( - self, localSubrs, globalSubrs, private - ) - for subrs in [localSubrs, globalSubrs]: - if subrs and not hasattr(subrs, "_used"): - subrs._used = set() - - def op_callsubr(self, index): - self.localSubrs._used.add(self.operandStack[-1] + self.localBias) - psCharStrings.SimpleT2Decompiler.op_callsubr(self, index) - - def op_callgsubr(self, index): - self.globalSubrs._used.add(self.operandStack[-1] + self.globalBias) - psCharStrings.SimpleT2Decompiler.op_callgsubr(self, index) - - -class _DehintingT2Decompiler(psCharStrings.T2WidthExtractor): - class Hints(object): - def __init__(self): - # Whether calling this charstring produces any hint stems - # Note that if a charstring starts with hintmask, it will - # have has_hint set to True, because it *might* produce an - # implicit vstem if called under certain conditions. - self.has_hint = False - # Index to start at to drop all hints - self.last_hint = 0 - # Index up to which we know more hints are possible. - # Only relevant if status is 0 or 1. - self.last_checked = 0 - # The status means: - # 0: after dropping hints, this charstring is empty - # 1: after dropping hints, there may be more hints - # continuing after this, or there might be - # other things. Not clear yet. - # 2: no more hints possible after this charstring - self.status = 0 - # Has hintmask instructions; not recursive - self.has_hintmask = False - # List of indices of calls to empty subroutines to remove. - self.deletions = [] - - pass - - def __init__( - self, css, localSubrs, globalSubrs, nominalWidthX, defaultWidthX, private=None - ): - self._css = css - psCharStrings.T2WidthExtractor.__init__( - self, localSubrs, globalSubrs, nominalWidthX, defaultWidthX - ) - self.private = private - - def execute(self, charString): - old_hints = charString._hints if hasattr(charString, "_hints") else None - charString._hints = self.Hints() - - psCharStrings.T2WidthExtractor.execute(self, charString) - - hints = charString._hints - - if hints.has_hint or hints.has_hintmask: - self._css.add(charString) - - if hints.status != 2: - # Check from last_check, make sure we didn't have any operators. - for i in range(hints.last_checked, len(charString.program) - 1): - if isinstance(charString.program[i], str): - hints.status = 2 - break - else: - hints.status = 1 # There's *something* here - hints.last_checked = len(charString.program) - - if old_hints: - assert hints.__dict__ == old_hints.__dict__ - - def op_callsubr(self, index): - subr = self.localSubrs[self.operandStack[-1] + self.localBias] - psCharStrings.T2WidthExtractor.op_callsubr(self, index) - self.processSubr(index, subr) - - def op_callgsubr(self, index): - subr = self.globalSubrs[self.operandStack[-1] + self.globalBias] - psCharStrings.T2WidthExtractor.op_callgsubr(self, index) - self.processSubr(index, subr) - - def op_hstem(self, index): - psCharStrings.T2WidthExtractor.op_hstem(self, index) - self.processHint(index) - - def op_vstem(self, index): - psCharStrings.T2WidthExtractor.op_vstem(self, index) - self.processHint(index) - - def op_hstemhm(self, index): - psCharStrings.T2WidthExtractor.op_hstemhm(self, index) - self.processHint(index) - - def op_vstemhm(self, index): - psCharStrings.T2WidthExtractor.op_vstemhm(self, index) - self.processHint(index) - - def op_hintmask(self, index): - rv = psCharStrings.T2WidthExtractor.op_hintmask(self, index) - self.processHintmask(index) - return rv - - def op_cntrmask(self, index): - rv = psCharStrings.T2WidthExtractor.op_cntrmask(self, index) - self.processHintmask(index) - return rv - - def processHintmask(self, index): - cs = self.callingStack[-1] - hints = cs._hints - hints.has_hintmask = True - if hints.status != 2: - # Check from last_check, see if we may be an implicit vstem - for i in range(hints.last_checked, index - 1): - if isinstance(cs.program[i], str): - hints.status = 2 - break - else: - # We are an implicit vstem - hints.has_hint = True - hints.last_hint = index + 1 - hints.status = 0 - hints.last_checked = index + 1 - - def processHint(self, index): - cs = self.callingStack[-1] - hints = cs._hints - hints.has_hint = True - hints.last_hint = index - hints.last_checked = index - - def processSubr(self, index, subr): - cs = self.callingStack[-1] - hints = cs._hints - subr_hints = subr._hints - - # Check from last_check, make sure we didn't have - # any operators. - if hints.status != 2: - for i in range(hints.last_checked, index - 1): - if isinstance(cs.program[i], str): - hints.status = 2 - break - hints.last_checked = index - - if hints.status != 2: - if subr_hints.has_hint: - hints.has_hint = True - - # Decide where to chop off from - if subr_hints.status == 0: - hints.last_hint = index - else: - hints.last_hint = index - 2 # Leave the subr call in - - elif subr_hints.status == 0: - hints.deletions.append(index) - - hints.status = max(hints.status, subr_hints.status) - - -@_add_method(ttLib.getTableClass("CFF ")) -def prune_post_subset(self, ttfFont, options): - cff = self.cff - for fontname in cff.keys(): - font = cff[fontname] - cs = font.CharStrings - - # Drop unused FontDictionaries - if hasattr(font, "FDSelect"): - sel = font.FDSelect - indices = _uniq_sort(sel.gidArray) - sel.gidArray = [indices.index(ss) for ss in sel.gidArray] - arr = font.FDArray - arr.items = [arr[i] for i in indices] - del arr.file, arr.offsets - - # Desubroutinize if asked for - if options.desubroutinize: - cff.desubroutinize() - - # Drop hints if not needed - if not options.hinting: - self.remove_hints() - elif not options.desubroutinize: - self.remove_unused_subroutines() - return True - - -def _delete_empty_subrs(private_dict): - if hasattr(private_dict, "Subrs") and not private_dict.Subrs: - if "Subrs" in private_dict.rawDict: - del private_dict.rawDict["Subrs"] - del private_dict.Subrs - - -@deprecateFunction( - "use 'CFFFontSet.desubroutinize()' instead", category=DeprecationWarning -) -@_add_method(ttLib.getTableClass("CFF ")) -def desubroutinize(self): - self.cff.desubroutinize() - - -@_add_method(ttLib.getTableClass("CFF ")) -def remove_hints(self): - cff = self.cff - for fontname in cff.keys(): - font = cff[fontname] - cs = font.CharStrings - # This can be tricky, but doesn't have to. What we do is: - # - # - Run all used glyph charstrings and recurse into subroutines, - # - For each charstring (including subroutines), if it has any - # of the hint stem operators, we mark it as such. - # Upon returning, for each charstring we note all the - # subroutine calls it makes that (recursively) contain a stem, - # - Dropping hinting then consists of the following two ops: - # * Drop the piece of the program in each charstring before the - # last call to a stem op or a stem-calling subroutine, - # * Drop all hintmask operations. - # - It's trickier... A hintmask right after hints and a few numbers - # will act as an implicit vstemhm. As such, we track whether - # we have seen any non-hint operators so far and do the right - # thing, recursively... Good luck understanding that :( - css = set() - for g in font.charset: - c, _ = cs.getItemAndSelector(g) - c.decompile() - subrs = getattr(c.private, "Subrs", []) - decompiler = _DehintingT2Decompiler( - css, - subrs, - c.globalSubrs, - c.private.nominalWidthX, - c.private.defaultWidthX, - c.private, - ) - decompiler.execute(c) - c.width = decompiler.width - for charstring in css: - charstring.drop_hints() - del css - - # Drop font-wide hinting values - all_privs = [] - if hasattr(font, "FDArray"): - all_privs.extend(fd.Private for fd in font.FDArray) - else: - all_privs.append(font.Private) - for priv in all_privs: - for k in [ - "BlueValues", - "OtherBlues", - "FamilyBlues", - "FamilyOtherBlues", - "BlueScale", - "BlueShift", - "BlueFuzz", - "StemSnapH", - "StemSnapV", - "StdHW", - "StdVW", - "ForceBold", - "LanguageGroup", - "ExpansionFactor", - ]: - if hasattr(priv, k): - setattr(priv, k, None) - self.remove_unused_subroutines() - - -@_add_method(ttLib.getTableClass("CFF ")) -def remove_unused_subroutines(self): - cff = self.cff - for fontname in cff.keys(): - font = cff[fontname] - cs = font.CharStrings - # Renumber subroutines to remove unused ones - - # Mark all used subroutines - for g in font.charset: - c, _ = cs.getItemAndSelector(g) - subrs = getattr(c.private, "Subrs", []) - decompiler = _MarkingT2Decompiler(subrs, c.globalSubrs, c.private) - decompiler.execute(c) - - all_subrs = [font.GlobalSubrs] - if hasattr(font, "FDArray"): - all_subrs.extend( - fd.Private.Subrs - for fd in font.FDArray - if hasattr(fd.Private, "Subrs") and fd.Private.Subrs - ) - elif hasattr(font.Private, "Subrs") and font.Private.Subrs: - all_subrs.append(font.Private.Subrs) - - subrs = set(subrs) # Remove duplicates - - # Prepare - for subrs in all_subrs: - if not hasattr(subrs, "_used"): - subrs._used = set() - subrs._used = _uniq_sort(subrs._used) - subrs._old_bias = psCharStrings.calcSubrBias(subrs) - subrs._new_bias = psCharStrings.calcSubrBias(subrs._used) - - # Renumber glyph charstrings - for g in font.charset: - c, _ = cs.getItemAndSelector(g) - subrs = getattr(c.private, "Subrs", []) - c.subset_subroutines(subrs, font.GlobalSubrs) - - # Renumber subroutines themselves - for subrs in all_subrs: - if subrs == font.GlobalSubrs: - if not hasattr(font, "FDArray") and hasattr(font.Private, "Subrs"): - local_subrs = font.Private.Subrs - else: - local_subrs = [] - else: - local_subrs = subrs - - subrs.items = [subrs.items[i] for i in subrs._used] - if hasattr(subrs, "file"): - del subrs.file - if hasattr(subrs, "offsets"): - del subrs.offsets - - for subr in subrs.items: - subr.subset_subroutines(local_subrs, font.GlobalSubrs) - - # Delete local SubrsIndex if empty - if hasattr(font, "FDArray"): - for fd in font.FDArray: - _delete_empty_subrs(fd.Private) - else: - _delete_empty_subrs(font.Private) - - # Cleanup - for subrs in all_subrs: - del subrs._used, subrs._old_bias, subrs._new_bias diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/fontTools/ufoLib/plistlib.py b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/fontTools/ufoLib/plistlib.py deleted file mode 100644 index 1f52f20a2b4836e39d3e292496928185dfe08534..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/fontTools/ufoLib/plistlib.py +++ /dev/null @@ -1,46 +0,0 @@ -"""DEPRECATED - This module is kept here only as a backward compatibility shim -for the old ufoLib.plistlib module, which was moved to fontTools.misc.plistlib. -Please use the latter instead. -""" -from fontTools.misc.plistlib import dump, dumps, load, loads -from fontTools.misc.textTools import tobytes - -# The following functions were part of the old py2-like ufoLib.plistlib API. -# They are kept only for backward compatiblity. -from fontTools.ufoLib.utils import deprecated - - -@deprecated("Use 'fontTools.misc.plistlib.load' instead") -def readPlist(path_or_file): - did_open = False - if isinstance(path_or_file, str): - path_or_file = open(path_or_file, "rb") - did_open = True - try: - return load(path_or_file, use_builtin_types=False) - finally: - if did_open: - path_or_file.close() - - -@deprecated("Use 'fontTools.misc.plistlib.dump' instead") -def writePlist(value, path_or_file): - did_open = False - if isinstance(path_or_file, str): - path_or_file = open(path_or_file, "wb") - did_open = True - try: - dump(value, path_or_file, use_builtin_types=False) - finally: - if did_open: - path_or_file.close() - - -@deprecated("Use 'fontTools.misc.plistlib.loads' instead") -def readPlistFromString(data): - return loads(tobytes(data, encoding="utf-8"), use_builtin_types=False) - - -@deprecated("Use 'fontTools.misc.plistlib.dumps' instead") -def writePlistToString(value): - return dumps(value, use_builtin_types=False) diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/templates/frontend/assets/index-49c152ed.css b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/templates/frontend/assets/index-49c152ed.css deleted file mode 100644 index 0af4e02cc7c84a94d8719b02e4d6d8d67e582557..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/templates/frontend/assets/index-49c152ed.css +++ /dev/null @@ -1 +0,0 @@ -.wrap.svelte-1cl284s{display:flex;flex-direction:column;width:100%}.head.svelte-1cl284s{display:flex;justify-content:space-between}input[type=number].svelte-1cl284s{display:block;position:relative;outline:none!important;box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius);background:var(--input-background-fill);padding:var(--size-2) var(--size-2);height:var(--size-6);color:var(--body-text-color);font-size:var(--input-text-size);line-height:var(--line-sm);text-align:center}input.svelte-1cl284s:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1}input[type=number].svelte-1cl284s:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}input.svelte-1cl284s::placeholder{color:var(--input-placeholder-color)}input[type=range].svelte-1cl284s{width:100%;accent-color:var(--slider-color)}input[disabled].svelte-1cl284s{cursor:not-allowed} diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/h11/tests/test_helpers.py b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/h11/tests/test_helpers.py deleted file mode 100644 index c329c767834f73b1dd8991a4ac12d4972a41e98a..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/h11/tests/test_helpers.py +++ /dev/null @@ -1,32 +0,0 @@ -from .._events import ( - ConnectionClosed, - Data, - EndOfMessage, - Event, - InformationalResponse, - Request, - Response, -) -from .helpers import normalize_data_events - - -def test_normalize_data_events() -> None: - assert normalize_data_events( - [ - Data(data=bytearray(b"1")), - Data(data=b"2"), - Response(status_code=200, headers=[]), # type: ignore[arg-type] - Data(data=b"3"), - Data(data=b"4"), - EndOfMessage(), - Data(data=b"5"), - Data(data=b"6"), - Data(data=b"7"), - ] - ) == [ - Data(data=b"12"), - Response(status_code=200, headers=[]), # type: ignore[arg-type] - Data(data=b"34"), - EndOfMessage(), - Data(data=b"567"), - ] diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/jsonschema/__init__.py b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/jsonschema/__init__.py deleted file mode 100644 index 79924cf7e51665d03295ecdb7d0930bdeb806d4f..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/jsonschema/__init__.py +++ /dev/null @@ -1,120 +0,0 @@ -""" -An implementation of JSON Schema for Python. - -The main functionality is provided by the validator classes for each of the -supported JSON Schema versions. - -Most commonly, `jsonschema.validators.validate` is the quickest way to simply -validate a given instance under a schema, and will create a validator -for you. -""" -import warnings - -from jsonschema._format import FormatChecker -from jsonschema._types import TypeChecker -from jsonschema.exceptions import SchemaError, ValidationError -from jsonschema.validators import ( - Draft3Validator, - Draft4Validator, - Draft6Validator, - Draft7Validator, - Draft201909Validator, - Draft202012Validator, - validate, -) - - -def __getattr__(name): - if name == "__version__": - warnings.warn( - "Accessing jsonschema.__version__ is deprecated and will be " - "removed in a future release. Use importlib.metadata directly " - "to query for jsonschema's version.", - DeprecationWarning, - stacklevel=2, - ) - - from importlib import metadata - return metadata.version("jsonschema") - elif name == "RefResolver": - from jsonschema.validators import _RefResolver - warnings.warn( - _RefResolver._DEPRECATION_MESSAGE, - DeprecationWarning, - stacklevel=2, - ) - return _RefResolver - elif name == "ErrorTree": - warnings.warn( - "Importing ErrorTree directly from the jsonschema package " - "is deprecated and will become an ImportError. Import it from " - "jsonschema.exceptions instead.", - DeprecationWarning, - stacklevel=2, - ) - from jsonschema.exceptions import ErrorTree - return ErrorTree - elif name == "FormatError": - warnings.warn( - "Importing FormatError directly from the jsonschema package " - "is deprecated and will become an ImportError. Import it from " - "jsonschema.exceptions instead.", - DeprecationWarning, - stacklevel=2, - ) - from jsonschema.exceptions import FormatError - return FormatError - elif name == "Validator": - warnings.warn( - "Importing Validator directly from the jsonschema package " - "is deprecated and will become an ImportError. Import it from " - "jsonschema.protocols instead.", - DeprecationWarning, - stacklevel=2, - ) - from jsonschema.protocols import Validator - return Validator - elif name == "RefResolutionError": - from jsonschema.exceptions import _RefResolutionError - warnings.warn( - _RefResolutionError._DEPRECATION_MESSAGE, - DeprecationWarning, - stacklevel=2, - ) - return _RefResolutionError - - format_checkers = { - "draft3_format_checker": Draft3Validator, - "draft4_format_checker": Draft4Validator, - "draft6_format_checker": Draft6Validator, - "draft7_format_checker": Draft7Validator, - "draft201909_format_checker": Draft201909Validator, - "draft202012_format_checker": Draft202012Validator, - } - ValidatorForFormat = format_checkers.get(name) - if ValidatorForFormat is not None: - warnings.warn( - f"Accessing jsonschema.{name} is deprecated and will be " - "removed in a future release. Instead, use the FORMAT_CHECKER " - "attribute on the corresponding Validator.", - DeprecationWarning, - stacklevel=2, - ) - return ValidatorForFormat.FORMAT_CHECKER - - raise AttributeError(f"module {__name__} has no attribute {name}") - - -__all__ = [ - "Draft201909Validator", - "Draft202012Validator", - "Draft3Validator", - "Draft4Validator", - "Draft6Validator", - "Draft7Validator", - "FormatChecker", - "SchemaError", - "TypeChecker", - "ValidationError", - "validate", -] diff --git a/spaces/deepghs/auto_image_censor/nudenet.py b/spaces/deepghs/auto_image_censor/nudenet.py deleted file mode 100644 index 5b04f657c2c6d2ca75b38d4fc77c7e20705dd94d..0000000000000000000000000000000000000000 --- a/spaces/deepghs/auto_image_censor/nudenet.py +++ /dev/null @@ -1,71 +0,0 @@ -from functools import lru_cache -from pathlib import Path -from typing import Tuple, List - -import numpy as np -import onnxruntime -from PIL import Image -from huggingface_hub import hf_hub_download - - -def _read_bgr_data(image) -> np.ndarray: - """ Read an image in BGR format. - Args - path: Path to the image. - """ - data = np.ascontiguousarray(image.convert('RGB')) - return data[:, :, ::-1] - - -CAFFE_MASK = np.asarray([103.939, 116.779, 123.68]).astype(np.float32) - - -def _preprocess_image(x) -> np.ndarray: - return x.astype(np.float32) - CAFFE_MASK - - -def _get_resize_scale(size, min_side=800, max_side=1333): - width, height = size - smallest_side = min(width, height) - largest_side = max(width, height) - - scale = min_side / smallest_side - if largest_side * scale > max_side: - scale = max_side / largest_side - - return scale - - -def preprocess_image( - image: Image.Image, min_side=800, max_side=1333, -): - width, height = image.size - scale = _get_resize_scale((width, height), min_side=min_side, max_side=max_side) - new_width, new_height = map(lambda x: int(x * scale), (width, height)) - data = _read_bgr_data(image.resize((new_width, new_height))) - data = _preprocess_image(data) - return data, scale - - -FILE_URLS = { - "default": { - "checkpoint": ('narugo/gchar_models', 'nudenet/baseline/detector_v2_default_checkpoint.onnx'), - "classes": ('narugo/gchar_models', 'nudenet/baseline/detector_v2_default_classes'), - }, - "base": { - "checkpoint": ('narugo/gchar_models', 'nudenet/baseline/detector_v2_base_checkpoint.onnx'), - "classes": ('narugo/gchar_models', 'nudenet/baseline/detector_v2_base_classes'), - }, -} - - -@lru_cache() -def open_model_session(model: str = 'default') -> Tuple[onnxruntime.InferenceSession, List[str]]: - ckpt_repo_id, ckpt_repo_file = FILE_URLS[model]['checkpoint'] - ckpt_file = hf_hub_download(ckpt_repo_id, ckpt_repo_file) - classes_repo_id, classes_repo_file = FILE_URLS[model]['classes'] - classes_file = hf_hub_download(classes_repo_id, classes_repo_file) - - onnx_model = onnxruntime.InferenceSession(ckpt_file) - classes = [line.strip() for line in Path(classes_file).read_text().splitlines(keepends=False) if line] - return onnx_model, classes diff --git a/spaces/deepozzzie/chatgpt/app.py b/spaces/deepozzzie/chatgpt/app.py deleted file mode 100644 index 0239be9a490df6aa09e8951a3561eecaf71662bd..0000000000000000000000000000000000000000 --- a/spaces/deepozzzie/chatgpt/app.py +++ /dev/null @@ -1,118 +0,0 @@ -import gradio as gr -import os -import time - -from langchain.document_loaders import OnlinePDFLoader - -from langchain.text_splitter import CharacterTextSplitter - - -from langchain.llms import OpenAI - -from langchain.embeddings import OpenAIEmbeddings - - -from langchain.vectorstores import Chroma - -from langchain.chains import ConversationalRetrievalChain - -def loading_pdf(): - print("loading_pdf") - return "Loading..." - -def pdf_changes(pdf_doc, open_ai_key): - print("pdf_change") - if openai_key is not None: - os.environ['OPENAI_API_KEY'] = open_ai_key - loader = OnlinePDFLoader(pdf_doc.name) - print(loader) - documents = loader.load() - print(documents) - text_splitter = CharacterTextSplitter(chunk_size=2048, chunk_overlap=0) - print(text_splitter) - texts = text_splitter.split_documents(documents) - print(texts) - embeddings = OpenAIEmbeddings() - print(embeddings) - db = Chroma.from_documents(texts, embeddings) - print(db) - retriever = db.as_retriever() - print(retriever) - global qa - qa = ConversationalRetrievalChain.from_llm( - llm=OpenAI(temperature=0.3), - retriever=retriever, - return_source_documents=False) - return "Ready" - else: - return "You forgot OpenAI API key" - -def add_text(history, text): - history = history + [(text, None)] - print(history) - return history, "" - -def bot(history): - response = infer(history[-1][0], history) - history[-1][1] = "" - - for character in response: - history[-1][1] += character - time.sleep(0.05) - yield history - - -def infer(question, history): - - res = [] - for human, ai in history[:-1]: - pair = (human, ai) - res.append(pair) - - chat_history = res - #print(chat_history) - query = question - result = qa({"question": query, "chat_history": chat_history}) - #print(result) - print(result["answer"]) - return result["answer"] - -css=""" -#col-container {max-width: 700px; margin-left: auto; margin-right: auto;} -""" - -title = """ -
          -

          Chat with PDF • OpenAI

          -

          Upload a .PDF from your computer, click the "Load PDF" button,
          - when everything is ready, you can start asking questions about the pdf
          - This version is set to store chat history, and uses OpenAI as LLM, don't forget to copy/paste your OpenAI API key

          -
          -""" - - -with gr.Blocks(css=css) as demo: - with gr.Column(elem_id="col-container"): - gr.HTML(title) - - with gr.Column(): - openai_key = gr.Textbox(label="You OpenAI API key", type="password") - pdf_doc = gr.File(label="Load a pdf", file_types=['.pdf'], type="file") - with gr.Row(): - langchain_status = gr.Textbox(label="Status", placeholder="", interactive=False) - load_pdf = gr.Button("Load pdf") - - chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350) - question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter ") - submit_btn = gr.Button("Send Message") - load_pdf.click(loading_pdf, None, langchain_status, queue=False) - load_pdf.click(pdf_changes, inputs=[pdf_doc, openai_key], outputs=[langchain_status], queue=False) - question.submit(add_text, [chatbot, question], [chatbot, question]).then( - bot, chatbot, chatbot - ) - submit_btn.click(add_text, [chatbot, question], [chatbot, question]).then( - bot, chatbot, chatbot) - - - -demo.launch() diff --git a/spaces/deepwisdom/MetaGPT/metagpt/actions/write_prd.py b/spaces/deepwisdom/MetaGPT/metagpt/actions/write_prd.py deleted file mode 100644 index 97f9138fd3fd2a94d8213eed848fd3d23d84ea23..0000000000000000000000000000000000000000 --- a/spaces/deepwisdom/MetaGPT/metagpt/actions/write_prd.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -@Time : 2023/5/11 17:45 -@Author : alexanderwu -@File : write_prd.py -""" -from typing import List, Tuple - -import aiofiles - -from metagpt.actions import Action, ActionOutput -from metagpt.actions.search_and_summarize import SearchAndSummarize -from metagpt.config import CONFIG -from metagpt.logs import logger -from metagpt.utils.common import CodeParser -from metagpt.utils.mermaid import mermaid_to_file - -PROMPT_TEMPLATE = """ -# Context -## Original Requirements -{requirements} - -## Search Information -{search_information} - -## mermaid quadrantChart code syntax example. DONT USE QUOTO IN CODE DUE TO INVALID SYNTAX. Replace the with REAL COMPETITOR NAME -```mermaid -quadrantChart - title Reach and engagement of campaigns - x-axis Low Reach --> High Reach - y-axis Low Engagement --> High Engagement - quadrant-1 We should expand - quadrant-2 Need to promote - quadrant-3 Re-evaluate - quadrant-4 May be improved - "Campaign: A": [0.3, 0.6] - "Campaign B": [0.45, 0.23] - "Campaign C": [0.57, 0.69] - "Campaign D": [0.78, 0.34] - "Campaign E": [0.40, 0.34] - "Campaign F": [0.35, 0.78] - "Our Target Product": [0.5, 0.6] -``` - -## Format example -{format_example} ------ -Role: You are a professional product manager; the goal is to design a concise, usable, efficient product -Requirements: According to the context, fill in the following missing information, note that each sections are returned in Python code triple quote form seperatedly. If the requirements are unclear, ensure minimum viability and avoid excessive design -ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. AND '## ' SHOULD WRITE BEFORE the code and triple quote. Output carefully referenced "Format example" in format. - -## Original Requirements: Provide as Plain text, place the polished complete original requirements here - -## Product Goals: Provided as Python list[str], up to 3 clear, orthogonal product goals. If the requirement itself is simple, the goal should also be simple - -## User Stories: Provided as Python list[str], up to 5 scenario-based user stories, If the requirement itself is simple, the user stories should also be less - -## Competitive Analysis: Provided as Python list[str], up to 7 competitive product analyses, consider as similar competitors as possible - -## Competitive Quadrant Chart: Use mermaid quadrantChart code syntax. up to 14 competitive products. Translation: Distribute these competitor scores evenly between 0 and 1, trying to conform to a normal distribution centered around 0.5 as much as possible. - -## Requirement Analysis: Provide as Plain text. Be simple. LESS IS MORE. Make your requirements less dumb. Delete the parts unnessasery. - -## Requirement Pool: Provided as Python list[str, str], the parameters are requirement description, priority(P0/P1/P2), respectively, comply with PEP standards; no more than 5 requirements and consider to make its difficulty lower - -## UI Design draft: Provide as Plain text. Be simple. Describe the elements and functions, also provide a simple style description and layout description. -## Anything UNCLEAR: Provide as Plain text. Make clear here. -""" -FORMAT_EXAMPLE = """ ---- -## Original Requirements -The boss ... - -## Product Goals -```python -[ - "Create a ...", -] -``` - -## User Stories -```python -[ - "As a user, ...", -] -``` - -## Competitive Analysis -```python -[ - "Python Snake Game: ...", -] -``` - -## Competitive Quadrant Chart -```mermaid -quadrantChart - title Reach and engagement of campaigns - ... - "Our Target Product": [0.6, 0.7] -``` - -## Requirement Analysis -The product should be a ... - -## Requirement Pool -```python -[ - ("End game ...", "P0") -] -``` - -## UI Design draft -Give a basic function description, and a draft - -## Anything UNCLEAR -There are no unclear points. ---- -""" -OUTPUT_MAPPING = { - "Original Requirements": (str, ...), - "Product Goals": (List[str], ...), - "User Stories": (List[str], ...), - "Competitive Analysis": (List[str], ...), - "Competitive Quadrant Chart": (str, ...), - "Requirement Analysis": (str, ...), - "Requirement Pool": (List[Tuple[str, str]], ...), - "UI Design draft": (str, ...), - "Anything UNCLEAR": (str, ...), -} - - -class WritePRD(Action): - def __init__(self, name="", context=None, llm=None): - super().__init__(name, context, llm) - - async def run(self, requirements, *args, **kwargs) -> ActionOutput: - sas = SearchAndSummarize() - # rsp = await sas.run(context=requirements, system_text=SEARCH_AND_SUMMARIZE_SYSTEM_EN_US) - rsp = "" - info = f"### Search Results\n{sas.result}\n\n### Search Summary\n{rsp}" - if sas.result: - logger.info(sas.result) - logger.info(rsp) - - prompt = PROMPT_TEMPLATE.format( - requirements=requirements, search_information=info, format_example=FORMAT_EXAMPLE - ) - logger.debug(prompt) - prd = await self._aask_v1(prompt, "prd", OUTPUT_MAPPING) - - await self._save(prd.content) - return prd - - async def _save_prd(self, docs_path, resources_path, prd): - prd_file = docs_path / "prd.md" - quadrant_chart = CodeParser.parse_code(block="Competitive Quadrant Chart", text=prd) - await mermaid_to_file( - mermaid_code=quadrant_chart, output_file_without_suffix=resources_path / "competitive_analysis" - ) - async with aiofiles.open(prd_file, "w") as f: - await f.write(prd) - logger.info(f"Saving PRD to {prd_file}") - - async def _save(self, prd): - workspace = CONFIG.workspace - workspace.mkdir(parents=True, exist_ok=True) - - docs_path = workspace / "docs" - resources_path = workspace / "resources" - docs_path.mkdir(parents=True, exist_ok=True) - resources_path.mkdir(parents=True, exist_ok=True) - await self._save_prd(docs_path, resources_path, prd) diff --git a/spaces/derek-thomas/disc-golf-simulator/utilities/visualize.py b/spaces/derek-thomas/disc-golf-simulator/utilities/visualize.py deleted file mode 100644 index 7c46e28aee8388c40437638aeb629319cae8d023..0000000000000000000000000000000000000000 --- a/spaces/derek-thomas/disc-golf-simulator/utilities/visualize.py +++ /dev/null @@ -1,270 +0,0 @@ -import math -import numpy as np -import plotly.graph_objects as go -from pathlib import Path -from plotly.colors import sequential -from stl.mesh import Mesh - -from .extrema import find_extrema - -proj_dir = Path(__file__).parents[1] - -# Taken from https://community.plotly.com/t/view-3d-cad-data/16920/9 -stl_meshes = {disc.stem: Mesh.from_file(disc) for disc in (proj_dir / 'shotshaper' / 'discs').glob('*.stl')} - - -def visualize_disc(stl_mesh, nose, roll): - """ - Taken from https://community.plotly.com/t/view-3d-cad-data/16920/9 - """ - stl_mesh.rotate([1, 0, 0], math.radians(-1 * nose)) - stl_mesh.rotate([0, 1, 0], math.radians(roll)) - # stl_mesh.rotate([0, 0, 1], math.radians(z_angle)) - - p, q, r = stl_mesh.vectors.shape # (p, 3, 3) - # the array stl_mesh.vectors.reshape(p*q, r) can contain multiple copies of the same vertex; - # extract unique vertices from all mesh triangles - vertices, ixr = np.unique(stl_mesh.vectors.reshape(p * q, r), return_inverse=True, axis=0) - I = np.take(ixr, [3 * k for k in range(p)]) - J = np.take(ixr, [3 * k + 1 for k in range(p)]) - K = np.take(ixr, [3 * k + 2 for k in range(p)]) - - x, y, z = vertices.T - trace = go.Mesh3d(x=x, y=y, z=z, i=I, j=J, k=K) - # optional parameters to make it look nicer - trace.update(flatshading=True, lighting_facenormalsepsilon=0, lighting_ambient=0.7) - - fig = go.Figure(trace) - - # Add camera controls to the plot - camera = dict( - eye=dict(x=0, y=-3, z=0) - ) - fig.update_layout(scene_camera=camera) - - fig.update_layout( - scene=dict( - dragmode=False, - xaxis=dict(nticks=4, range=[-0.11, 0.11], ), - yaxis=dict(nticks=4, range=[-0.11, 0.11], ), - zaxis=dict(nticks=4, range=[-0.11, 0.11], ), ) - ) - return fig - - -import plotly.subplots as sp - - -def get_plot(x, y, z): - xm = np.min(x) - 1.5 - xM = np.max(x) + 1.5 - ym = -5 - yM = np.max(y) + 1.5 - zm = np.min(z) - zM = np.max(z) - N = len(x) - category = 'Height' - x_extrema, y_extrema, extrema_type = find_extrema(x, y) - - xM_abs = max(abs(xm), abs(xM)) - xm_abs = -1 * xM_abs - - carats_v = go.Scatter( - x=[category, category], - y=[min(z), max(z)], - mode='markers', - showlegend=False, - marker=dict(symbol=['arrow-up', 'arrow-down'], size=20, color=['red', 'red']), - name='Carets', - ) - carats_h = go.Scatter( - x=[min(x), max(x)], - y=['', ''], - mode='markers', - showlegend=False, - marker=dict(symbol=['arrow-right', 'arrow-left'], size=20, color=['red', 'red']), - name='Carets', - ) - - extrema = go.Scatter( - x=x_extrema, - y=y_extrema, - mode='markers', - showlegend=False, - marker=dict(symbol=extrema_type, size=20, color='blue'), - name='Extrema', - ) - - # Create figure with subplots - fig = sp.make_subplots(rows=2, cols=2, subplot_titles=("Flight Path", "Height (over time)", "Lateral Deviance (left and right motion)"), - specs=[[{"rowspan": 2}, {}], [None, {}]], row_heights=[0.5, 0.5]) - - # Add traces to the main plot - fig.add_trace( - go.Scatter(x=x, y=y, - mode="lines", - showlegend=False, - line=dict(width=1, color='black')), - row=1, col=1 - ) - - fig.add_trace( - go.Scatter(x=x, y=y, - showlegend=False, - mode="markers", marker_colorscale=sequential.Peach, - marker=dict(color=z, size=3, showscale=True)), - row=1, col=1 - ) - - fig.add_trace( - extrema, - row=1, col=1 - ) - - # Add trace for the subplot - fig.add_trace(carats_v, - row=1, col=2 - ) - fig.add_trace( - go.Bar( - x=[], - y=[], - showlegend=False, - ), - row=1, col=2 - ) - # Add trace for the subplot - fig.add_trace(carats_h, - row=2, col=2 - ) - fig.add_trace( - go.Bar( - x=[], - y=[], - showlegend=False, - orientation='h', - ), - row=2, col=2 - ) - - # Update layout - fig.update_layout( - xaxis=dict(range=[xm, xM], autorange=False, zeroline=False), - yaxis=dict(range=[ym, yM], autorange=False, zeroline=False), - title_text="Flight Path", - hovermode="closest", - updatemenus=[ - dict( - type="buttons", - buttons=[ - dict( - label="Play", - method="animate", - args=[None, {"frame": {"duration": 30, "redraw": True}, "fromcurrent": True}] - ), - dict( - label="Pause", - method="animate", - args=[[None], {"frame": {"duration": 0, "redraw": False}, "mode": "immediate", - "transition": {"duration": 0}}] - ) - ], - showactive=False, - x=0.05, - y=0.05 - ) - ], - ) - - # Create frames for the main plot and subplot - all_frames = [ - go.Frame(data=[ - go.Scatter( - x=[x[k]], - y=[y[k]], - mode="markers", - showlegend=False, - marker=dict(color="red", size=10)), - go.Scatter(x=x, y=y, - mode="markers", marker_colorscale=sequential.Peach, - marker=dict(color=z, size=3, showscale=True)), - extrema, - carats_v, - go.Bar( - x=['Height'], - y=[z[k]], - showlegend=False, - name='Value', - marker=dict(color='orange', line=dict(width=1)) - # Set color of value bar to orange and line width to 1 - ), - carats_h, - go.Bar( - x=[x[k]], - y=[''], - showlegend=False, - name='Value', - orientation='h', - marker=dict(color='orange', line=dict(width=1)) - # Set color of value bar to orange and line width to 1 - ) - ]) - for k in range(N) - ] - - # Combine frames for the main plot and subplot - fig.frames = all_frames - fig.update_yaxes(scaleanchor="x", scaleratio=1, row=1, col=1) - fig.update_yaxes(range=[zm - 2, zM + 2], fixedrange=True, row=1, col=2) - fig.update_xaxes(range=[xm_abs, xM_abs], fixedrange=True, row=2, col=2) - - # # Add green rectangle at the bottom of the plot - fig.update_layout( - shapes=[dict(type="rect", xref="x", yref="y", - x0=-1, y0=0, x1=1, y1=-4, fillcolor="gray", - opacity=1, layer="below")], - plot_bgcolor="green", - ) - - return fig - - -import plotly.graph_objs as go -from plotly.subplots import make_subplots - - -def get_subplots(arc, alphas, lifts, drags, moms, rolls, velocity): - fig = make_subplots(rows=2, cols=3, specs=[[{}, {}, {}], [{}, {}, {}]], - subplot_titles=("Lift force (N)", "Drag force (N)", "Moment (Nm)", - "Angle of attack (deg)", "Velocities (m/s)", "Roll rate (rad/s)"), - shared_xaxes=True) - - fig.add_trace(go.Scatter(x=arc, y=lifts, name="Lift force (N)"), row=1, col=1) - fig.update_xaxes(title_text="Distance (m)", row=1, col=1) - fig.update_yaxes(title_text="Lift force (N)", row=1, col=1) - - fig.add_trace(go.Scatter(x=arc, y=drags, name="Drag force (N)"), row=1, col=2) - fig.update_xaxes(title_text="Distance (m)", row=1, col=2) - fig.update_yaxes(title_text="Drag force (N)", row=1, col=2) - - fig.add_trace(go.Scatter(x=arc, y=moms, name="Moment (Nm)"), row=1, col=3) - fig.update_xaxes(title_text="Distance (m)", row=1, col=3) - fig.update_yaxes(title_text="Moment (Nm)", row=1, col=3) - - fig.add_trace(go.Scatter(x=arc, y=alphas, name="Angle of attack (deg)"), row=2, col=1) - fig.update_xaxes(title_text="Distance (m)", row=2, col=1) - fig.update_yaxes(title_text="Angle of attack (deg)", row=2, col=1) - - fig.add_trace(go.Scatter(x=arc, y=velocity[0, :], name="u"), row=2, col=2) - fig.add_trace(go.Scatter(x=arc, y=velocity[1, :], name="v"), row=2, col=2) - fig.add_trace(go.Scatter(x=arc, y=velocity[2, :], name="w"), row=2, col=2) - fig.update_xaxes(title_text="Distance (m)", row=2, col=2) - fig.update_yaxes(title_text="Velocities (m/s)", row=2, col=2) - fig.update_traces(mode='lines', row=2, col=2) - - fig.add_trace(go.Scatter(x=arc, y=rolls, name="Roll rate (rad/s)"), row=2, col=3) - fig.update_xaxes(title_text="Distance (m)", row=2, col=3) - fig.update_yaxes(title_text="Roll rate (rad/s)", row=2, col=3) - - fig.update_layout(height=600, width=1000, title_text="Analysis Subplots", hovermode='x') - return fig diff --git a/spaces/diacanFperku/AutoGPT/Change Language In Paragon Partition Manager 12 [VERIFIED].md b/spaces/diacanFperku/AutoGPT/Change Language In Paragon Partition Manager 12 [VERIFIED].md deleted file mode 100644 index 29ec8ffd76be116b3d341f0833d61500fe1e3932..0000000000000000000000000000000000000000 --- a/spaces/diacanFperku/AutoGPT/Change Language In Paragon Partition Manager 12 [VERIFIED].md +++ /dev/null @@ -1,52 +0,0 @@ -

          change language in paragon partition manager 12


          Downloadhttps://gohhs.com/2uFTxM



          - - . . including managing the disk space. - -Learn how to easily move partitions from one hard drive to another.Ferrari 488 - -The Ferrari 488 is a sports car which is produced by the Italian automobile manufacturer Ferrari. The 488 is the replacement for the 488 Spider, which in turn replaced the 458 Spider. It is the successor to the 488 GTB and the Ferrari 488 GTE. - -Development - -The car was first unveiled at the 2017 Frankfurt Motor Show as a replacement to the 458 Spider, the open top version of the 458 Italia. It has a carbon fibre chassis, rear-wheel-drive layout with a revised version of the 675 hp (512 kW) twin-turbocharged V8 from the 458 and the carbon fibre body which weighs less than the 488 GTB. It is fitted with a new-generation Ferrari Dynamic Activation system (FDAC). The 488 is also the first Ferrari sports car to be fitted with the G-Class Transmission. - -Launch - -The 488 was unveiled at the 2017 Frankfurt Motor Show on 7 September 2017 as a replacement for the 458 Spider. It will be available to customers in late 2017 with prices from €222,900 (UK) and €237,900 (US). - -The first customer delivery took place in Monaco on 27 November 2017. The first public launch was in St. Petersburg, Russia on 3 December 2017. - -Performance - -The 488 produces of torque and accelerates from to in 2.8 seconds. Top speed is. - -The 488 GTE race car was entered in the 2018 24 Hours of Le Mans with three drivers: Dries Vanthoor, Maxime Martin and Alessandro Pier Guidi. It finished the race in 4th place. - -Gallery - -Notes - -References - -External links - - - -488 - -Category:Sports cars - -Category:Rear mid-engine, rear-wheel-drive vehicles - -Category:Cars introduced in 2017 - -Category:Coupés - -Category:Grand tourersQ: - -How do I declare an array of ints and manipulate the values in C#? - -The basic task is to get a user input integer and then have a while loop that asks for more integers until user enters -1. I think my code is fairly close, but I'm not really sure about how to declare int[] number = new int 4fefd39f24
          -
          -
          -

          diff --git a/spaces/diacanFperku/AutoGPT/Ecologia Evolutiva Pianka 73.pdf.md b/spaces/diacanFperku/AutoGPT/Ecologia Evolutiva Pianka 73.pdf.md deleted file mode 100644 index ed0420acf545e8971eb4bc7e67fac7f85868ebcb..0000000000000000000000000000000000000000 --- a/spaces/diacanFperku/AutoGPT/Ecologia Evolutiva Pianka 73.pdf.md +++ /dev/null @@ -1,6 +0,0 @@ -

          Ecologia Evolutiva Pianka 73.pdf


          DOWNLOAD 🆓 https://gohhs.com/2uFUnH



          -
          -all efforts from my part to help in the computer lab of the school, and this for our school dont forget to give a piece of chocolate :) give free chocolate to my friend, and don't take one person here a lot is necessary. I tried downloading this for both windows and mac as well as for vista and windows 7, downloaded it to my desktop, started it up, but couldn't do anything with it. There is no concrete definition of "Mac" software. How to Create a Navigation Menu in Microsoft Word. This is a duplicate of the page: html or To manage the certificates, you will need to use your computer's browser to navigate to the website of the company which is issuing the certificate and download the private key of the certificate and the public key. This is a duplicate of the page: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 4fefd39f24
          -
          -
          -

          diff --git a/spaces/diagaiwei/ir_chinese_medqa/utility/evaluate/annotate_EM_helpers.py b/spaces/diagaiwei/ir_chinese_medqa/utility/evaluate/annotate_EM_helpers.py deleted file mode 100644 index b0d357ac4e8b47629604af9b4e6db0a088a3bed1..0000000000000000000000000000000000000000 --- a/spaces/diagaiwei/ir_chinese_medqa/utility/evaluate/annotate_EM_helpers.py +++ /dev/null @@ -1,74 +0,0 @@ -from colbert.utils.utils import print_message -from utility.utils.dpr import DPR_normalize, has_answer - - -def tokenize_all_answers(args): - qid, question, answers = args - return qid, question, [DPR_normalize(ans) for ans in answers] - - -def assign_label_to_passage(args): - idx, (qid, pid, rank, passage, tokenized_answers) = args - - if idx % (1*1000*1000) == 0: - print(idx) - - return qid, pid, rank, has_answer(tokenized_answers, passage) - - -def check_sizes(qid2answers, qid2rankings): - num_judged_queries = len(qid2answers) - num_ranked_queries = len(qid2rankings) - - print_message('num_judged_queries =', num_judged_queries) - print_message('num_ranked_queries =', num_ranked_queries) - - if num_judged_queries != num_ranked_queries: - assert num_ranked_queries <= num_judged_queries - - print('\n\n') - print_message('[WARNING] num_judged_queries != num_ranked_queries') - print('\n\n') - - return num_judged_queries, num_ranked_queries - - -def compute_and_write_labels(output_path, qid2answers, qid2rankings): - cutoffs = [1, 5, 10, 20, 30, 50, 100, 1000, 'all'] - success = {cutoff: 0.0 for cutoff in cutoffs} - counts = {cutoff: 0.0 for cutoff in cutoffs} - - with open(output_path, 'w') as f: - for qid in qid2answers: - if qid not in qid2rankings: - continue - - prev_rank = 0 # ranks should start at one (i.e., and not zero) - labels = [] - - for pid, rank, label in qid2rankings[qid]: - assert rank == prev_rank+1, (qid, pid, (prev_rank, rank)) - prev_rank = rank - - labels.append(label) - line = '\t'.join(map(str, [qid, pid, rank, int(label)])) + '\n' - f.write(line) - - for cutoff in cutoffs: - if cutoff != 'all': - success[cutoff] += sum(labels[:cutoff]) > 0 - counts[cutoff] += sum(labels[:cutoff]) - else: - success[cutoff] += sum(labels) > 0 - counts[cutoff] += sum(labels) - - return success, counts - - -# def dump_metrics(f, nqueries, cutoffs, success, counts): -# for cutoff in cutoffs: -# success_log = "#> P@{} = {}".format(cutoff, success[cutoff] / nqueries) -# counts_log = "#> D@{} = {}".format(cutoff, counts[cutoff] / nqueries) -# print('\n'.join([success_log, counts_log]) + '\n') - -# f.write('\n'.join([success_log, counts_log]) + '\n\n') diff --git a/spaces/digitalxingtong/Bufeiyan-a-Bert-VITS2/README.md b/spaces/digitalxingtong/Bufeiyan-a-Bert-VITS2/README.md deleted file mode 100644 index 87e2ad5f80a408f869d609e8b8a43de8442caf46..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Bufeiyan-a-Bert-VITS2/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 步非烟 Ver.a -emoji: 🌟 -colorFrom: red -colorTo: indigo -sdk: gradio -sdk_version: 3.36.1 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/spaces/digitalxingtong/Jiaohuaji-Bert-Vits2/short_audio_transcribe.py b/spaces/digitalxingtong/Jiaohuaji-Bert-Vits2/short_audio_transcribe.py deleted file mode 100644 index f1e8b30671f2c2f2fa3c93feb1f4edd3fbe2f545..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Jiaohuaji-Bert-Vits2/short_audio_transcribe.py +++ /dev/null @@ -1,122 +0,0 @@ -import whisper -import os -import json -import torchaudio -import argparse -import torch - -lang2token = { - 'zh': "[ZH]", - 'ja': "[JA]", - "en": "[EN]", - } -def transcribe_one(audio_path): - # load audio and pad/trim it to fit 30 seconds - audio = whisper.load_audio(audio_path) - audio = whisper.pad_or_trim(audio) - - # make log-Mel spectrogram and move to the same device as the model - mel = whisper.log_mel_spectrogram(audio).to(model.device) - - # detect the spoken language - _, probs = model.detect_language(mel) - print(f"Detected language: {max(probs, key=probs.get)}") - lang = max(probs, key=probs.get) - # decode the audio - options = whisper.DecodingOptions(beam_size=5) - result = whisper.decode(model, mel, options) - - # print the recognized text - print(result.text) - return lang, result.text -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("--languages", default="CJE") - parser.add_argument("--whisper_size", default="medium") - args = parser.parse_args() - if args.languages == "CJE": - lang2token = { - 'zh': "[ZH]", - 'ja': "[JA]", - "en": "[EN]", - } - elif args.languages == "CJ": - lang2token = { - 'zh': "[ZH]", - 'ja': "[JA]", - } - elif args.languages == "C": - lang2token = { - 'zh': "[ZH]", - } - assert (torch.cuda.is_available()), "Please enable GPU in order to run Whisper!" - model = whisper.load_model(args.whisper_size) - parent_dir = "./custom_character_voice/" - speaker_names = list(os.walk(parent_dir))[0][1] - speaker_annos = [] - total_files = sum([len(files) for r, d, files in os.walk(parent_dir)]) - # resample audios - # 2023/4/21: Get the target sampling rate - with open("./configs/config.json", 'r', encoding='utf-8') as f: - hps = json.load(f) - target_sr = hps['data']['sampling_rate'] - processed_files = 0 - for speaker in speaker_names: - for i, wavfile in enumerate(list(os.walk(parent_dir + speaker))[0][2]): - # try to load file as audio - if wavfile.startswith("processed_"): - continue - try: - wav, sr = torchaudio.load(parent_dir + speaker + "/" + wavfile, frame_offset=0, num_frames=-1, normalize=True, - channels_first=True) - wav = wav.mean(dim=0).unsqueeze(0) - if sr != target_sr: - wav = torchaudio.transforms.Resample(orig_freq=sr, new_freq=target_sr)(wav) - if wav.shape[1] / sr > 20: - print(f"{wavfile} too long, ignoring\n") - save_path = parent_dir + speaker + "/" + f"processed_{i}.wav" - torchaudio.save(save_path, wav, target_sr, channels_first=True) - # transcribe text - lang, text = transcribe_one(save_path) - if lang not in list(lang2token.keys()): - print(f"{lang} not supported, ignoring\n") - continue - text = "ZH|" + text + "\n"# - #text = lang2token[lang] + text + lang2token[lang] + "\n" - speaker_annos.append(save_path + "|" + speaker + "|" + text) - - processed_files += 1 - print(f"Processed: {processed_files}/{total_files}") - except: - continue - - # # clean annotation - # import argparse - # import text - # from utils import load_filepaths_and_text - # for i, line in enumerate(speaker_annos): - # path, sid, txt = line.split("|") - # cleaned_text = text._clean_text(txt, ["cjke_cleaners2"]) - # cleaned_text += "\n" if not cleaned_text.endswith("\n") else "" - # speaker_annos[i] = path + "|" + sid + "|" + cleaned_text - # write into annotation - if len(speaker_annos) == 0: - print("Warning: no short audios found, this IS expected if you have only uploaded long audios, videos or video links.") - print("this IS NOT expected if you have uploaded a zip file of short audios. Please check your file structure or make sure your audio language is supported.") - with open("./filelists/short_character_anno.list", 'w', encoding='utf-8') as f: - for line in speaker_annos: - f.write(line) - - # import json - # # generate new config - # with open("./configs/finetune_speaker.json", 'r', encoding='utf-8') as f: - # hps = json.load(f) - # # modify n_speakers - # hps['data']["n_speakers"] = 1000 + len(speaker2id) - # # add speaker names - # for speaker in speaker_names: - # hps['speakers'][speaker] = speaker2id[speaker] - # # save modified config - # with open("./configs/modified_finetune_speaker.json", 'w', encoding='utf-8') as f: - # json.dump(hps, f, indent=2) - # print("finished") diff --git a/spaces/digitalxingtong/Lixiang-Bert-Vits2/text/english_bert_mock.py b/spaces/digitalxingtong/Lixiang-Bert-Vits2/text/english_bert_mock.py deleted file mode 100644 index 3b894ced5b6d619a18d6bdd7d7606ba9e6532050..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Lixiang-Bert-Vits2/text/english_bert_mock.py +++ /dev/null @@ -1,5 +0,0 @@ -import torch - - -def get_bert_feature(norm_text, word2ph): - return torch.zeros(1024, sum(word2ph)) diff --git a/spaces/digitalxingtong/Nailv-Bert-Vits2/monotonic_align/core.c b/spaces/digitalxingtong/Nailv-Bert-Vits2/monotonic_align/core.c deleted file mode 100644 index 5f8af54d32474f821e9d1f4d2679d78128722596..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Nailv-Bert-Vits2/monotonic_align/core.c +++ /dev/null @@ -1,26530 +0,0 @@ -/* Generated by Cython 3.0.0 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "name": "monotonic_align.core", - "sources": [ - "core.pyx" - ] - }, - "module_name": "monotonic_align.core" -} -END: Cython Metadata */ - -#ifndef PY_SSIZE_T_CLEAN -#define PY_SSIZE_T_CLEAN -#endif /* PY_SSIZE_T_CLEAN */ -#if defined(CYTHON_LIMITED_API) && 0 - #ifndef Py_LIMITED_API - #if CYTHON_LIMITED_API+0 > 0x03030000 - #define Py_LIMITED_API CYTHON_LIMITED_API - #else - #define Py_LIMITED_API 0x03030000 - #endif - #endif -#endif - -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.7+ or Python 3.3+. -#else -#define CYTHON_ABI "3_0_0" -#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI -#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x030000F0 -#define CYTHON_FUTURE_DIVISION 1 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #define HAVE_LONG_LONG -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#if defined(GRAALVM_PYTHON) - /* For very preliminary testing purposes. Most variables are set the same as PyPy. - The existence of this section does not imply that anything works or is even tested */ - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 1 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) - #endif - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(PYPY_VERSION) - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) - #endif - #if PY_VERSION_HEX < 0x03090000 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(CYTHON_LIMITED_API) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 1 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_CLINE_IN_TRACEBACK - #define CYTHON_CLINE_IN_TRACEBACK 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 1 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #endif - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 1 - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(PY_NOGIL) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #ifndef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #ifndef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #ifndef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) - #endif - #ifndef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #endif - #if PY_VERSION_HEX < 0x030400a1 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #elif !defined(CYTHON_USE_TP_FINALIZE) - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #if PY_VERSION_HEX < 0x030600B1 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #elif !defined(CYTHON_USE_DICT_VERSIONS) - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) - #endif - #if PY_VERSION_HEX < 0x030700A3 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK 1 - #endif - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if !defined(CYTHON_VECTORCALL) -#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) -#endif -#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED - #if defined(__cplusplus) - /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 - * but leads to warnings with -pedantic, since it is a C++17 feature */ - #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) - #if __has_cpp_attribute(maybe_unused) - #define CYTHON_UNUSED [[maybe_unused]] - #endif - #endif - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR - #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - #endif - #endif - #if _MSC_VER < 1300 - #ifdef _WIN64 - typedef unsigned long long __pyx_uintptr_t; - #else - typedef unsigned int __pyx_uintptr_t; - #endif - #else - #ifdef _WIN64 - typedef unsigned __int64 __pyx_uintptr_t; - #else - typedef unsigned __int32 __pyx_uintptr_t; - #endif - #endif -#else - #include - typedef uintptr_t __pyx_uintptr_t; -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) - /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 - * but leads to warnings with -pedantic, since it is a C++17 feature */ - #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif -#ifdef __cplusplus - template - struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; - #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) -#else - #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) -#endif -#if CYTHON_COMPILING_IN_PYPY == 1 - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) -#else - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) -#endif -#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_DefaultClassType PyClass_Type - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, - PyObject *code, PyObject *c, PyObject* n, PyObject *v, - PyObject *fv, PyObject *cell, PyObject* fn, - PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject *co=NULL, *result=NULL; - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(p))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; - if (!(empty = PyTuple_New(0))) goto end; - result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); - end: - Py_XDECREF((PyObject*) co); - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(empty); - if (type) { - PyErr_Restore(type, value, traceback); - } - return result; - } -#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif -#endif -#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) - #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) -#else - #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) - #define __Pyx_Py_Is(x, y) Py_Is(x, y) -#else - #define __Pyx_Py_Is(x, y) ((x) == (y)) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) - #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) -#else - #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) - #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) -#else - #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) - #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) -#else - #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) -#endif -#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) -#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) -#else - #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) -#endif -#ifndef CO_COROUTINE - #define CO_COROUTINE 0x80 -#endif -#ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x200 -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef Py_TPFLAGS_SEQUENCE - #define Py_TPFLAGS_SEQUENCE 0 -#endif -#ifndef Py_TPFLAGS_MAPPING - #define Py_TPFLAGS_MAPPING 0 -#endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_METH_FASTCALL - #define __Pyx_METH_FASTCALL METH_FASTCALL - #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast - #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords -#else - #define __Pyx_METH_FASTCALL METH_VARARGS - #define __Pyx_PyCFunction_FastCall PyCFunction - #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords -#endif -#if CYTHON_VECTORCALL - #define __pyx_vectorcallfunc vectorcallfunc - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET - #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) -#elif CYTHON_BACKPORT_VECTORCALL - typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, - size_t nargsf, PyObject *kwnames); - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) -#else - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) -#endif -#if PY_VERSION_HEX < 0x030900B1 - #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) - typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); -#else - #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) - #define __Pyx_PyCMethod PyCMethod -#endif -#ifndef METH_METHOD - #define METH_METHOD 0x200 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyThreadState_Current PyThreadState_Get() -#elif !CYTHON_FAST_THREAD_STATE - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) -{ - void *result; - result = PyModule_GetState(op); - if (!result) - Py_FatalError("Couldn't find the module state"); - return result; -} -#endif -#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) -#else - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if PY_MAJOR_VERSION < 3 - #if CYTHON_COMPILING_IN_PYPY - #if PYPY_VERSION_NUM < 0x07030600 - #if defined(__cplusplus) && __cplusplus >= 201402L - [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] - #elif defined(__GNUC__) || defined(__clang__) - __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) - #elif defined(_MSC_VER) - __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) - #endif - static CYTHON_INLINE int PyGILState_Check(void) { - return 0; - } - #else // PYPY_VERSION_NUM < 0x07030600 - #endif // PYPY_VERSION_NUM < 0x07030600 - #else - static CYTHON_INLINE int PyGILState_Check(void) { - PyThreadState * tstate = _PyThreadState_Current; - return tstate && (tstate == PyGILState_GetThisThreadState()); - } - #endif -#endif -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { - PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); - if (res == NULL) PyErr_Clear(); - return res; -} -#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) -#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError -#define __Pyx_PyDict_GetItemStr PyDict_GetItem -#else -static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { -#if CYTHON_COMPILING_IN_PYPY - return PyDict_GetItem(dict, name); -#else - PyDictEntry *ep; - PyDictObject *mp = (PyDictObject*) dict; - long hash = ((PyStringObject *) name)->ob_shash; - assert(hash != -1); - ep = (mp->ma_lookup)(mp, name, hash); - if (ep == NULL) { - return NULL; - } - return ep->me_value; -#endif -} -#define __Pyx_PyDict_GetItemStr PyDict_GetItem -#endif -#if CYTHON_USE_TYPE_SLOTS - #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) - #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) - #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) -#else - #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) - #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) - #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next -#endif -#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 -#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ - PyTypeObject *type = Py_TYPE(obj);\ - assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ - PyObject_GC_Del(obj);\ - Py_DECREF(type);\ -} -#else -#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) - #define __Pyx_PyUnicode_DATA(u) ((void*)u) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) -#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_READY(op) (0) - #else - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #endif - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) - #else - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif - #endif -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #if !defined(PyUnicode_DecodeUnicodeEscape) - #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) - #endif - #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) - #undef PyUnicode_Contains - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) - #endif - #if !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) - #endif - #if !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) - #endif -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #define __Pyx_PySequence_ListKeepNew(obj)\ - (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) -#else - #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) -#endif -#if PY_VERSION_HEX >= 0x030900A4 - #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) -#else - #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define __Pyx_Py3Int_Check(op) PyLong_Check(op) - #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#else - #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) - #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) - #if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES - #endif -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - -#define __PYX_MARK_ERR_POS(f_index, lineno) \ - { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } -#define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } - -#ifdef CYTHON_EXTERN_C - #undef __PYX_EXTERN_C - #define __PYX_EXTERN_C CYTHON_EXTERN_C -#elif defined(__PYX_EXTERN_C) - #ifdef _MSC_VER - #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") - #else - #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. - #endif -#else - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__monotonic_align__core -#define __PYX_HAVE_API__monotonic_align__core -/* Early includes */ -#include "pythread.h" -#include -#include -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) -{ - const wchar_t *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#endif -#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_VERSION_HEX >= 0x030C00A7 - #ifndef _PyLong_SIGN_MASK - #define _PyLong_SIGN_MASK 3 - #endif - #ifndef _PyLong_NON_SIZE_BITS - #define _PyLong_NON_SIZE_BITS 3 - #endif - #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) - #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) - #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) - #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) - #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) - #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) - #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_SignedDigitCount(x)\ - ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) - #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) - #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) - #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) - #else - #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) - #endif - typedef Py_ssize_t __Pyx_compact_pylong; - typedef size_t __Pyx_compact_upylong; - #else // Py < 3.12 - #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) - #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) - #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) - #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) - #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) - #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) - #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) - #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) - #define __Pyx_PyLong_CompactValue(x)\ - ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) - typedef sdigit __Pyx_compact_pylong; - typedef digit __Pyx_compact_upylong; - #endif - #if PY_VERSION_HEX >= 0x030C00A5 - #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) - #else - #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) - #endif -#endif -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = (char) c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -#if !CYTHON_USE_MODULE_STATE -static PyObject *__pyx_m = NULL; -#endif -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm = __FILE__; -static const char *__pyx_filename; - -/* #### Code section: filename_table ### */ - -static const char *__pyx_f[] = { - "core.pyx", - "", -}; -/* #### Code section: utility_code_proto_before_types ### */ -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* BufferFormatStructs.proto */ -struct __Pyx_StructField_; -#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) -typedef struct { - const char* name; - struct __Pyx_StructField_* fields; - size_t size; - size_t arraysize[8]; - int ndim; - char typegroup; - char is_unsigned; - int flags; -} __Pyx_TypeInfo; -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - size_t struct_alignment; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; - char is_valid_array; -} __Pyx_BufFmt_Context; - -/* Atomics.proto */ -#include -#ifndef CYTHON_ATOMICS - #define CYTHON_ATOMICS 1 -#endif -#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS -#define __pyx_atomic_int_type int -#define __pyx_nonatomic_int_type int -#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ - (__STDC_VERSION__ >= 201112L) &&\ - !defined(__STDC_NO_ATOMICS__)) - #include -#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ - (__cplusplus >= 201103L) ||\ - (defined(_MSC_VER) && _MSC_VER >= 1700))) - #include -#endif -#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ - (__STDC_VERSION__ >= 201112L) &&\ - !defined(__STDC_NO_ATOMICS__) &&\ - ATOMIC_INT_LOCK_FREE == 2) - #undef __pyx_atomic_int_type - #define __pyx_atomic_int_type atomic_int - #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) - #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) - #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) - #pragma message ("Using standard C atomics") - #elif defined(__PYX_DEBUG_ATOMICS) - #warning "Using standard C atomics" - #endif -#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ - (__cplusplus >= 201103L) ||\ -\ - (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ - ATOMIC_INT_LOCK_FREE == 2) - #undef __pyx_atomic_int_type - #define __pyx_atomic_int_type std::atomic_int - #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) - #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) - #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) - #pragma message ("Using standard C++ atomics") - #elif defined(__PYX_DEBUG_ATOMICS) - #warning "Using standard C++ atomics" - #endif -#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ - (__GNUC_MINOR__ > 1 ||\ - (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) - #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) - #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1) - #ifdef __PYX_DEBUG_ATOMICS - #warning "Using GNU atomics" - #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) - #include - #undef __pyx_atomic_int_type - #define __pyx_atomic_int_type long - #define __pyx_nonatomic_int_type long - #pragma intrinsic (_InterlockedExchangeAdd) - #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) - #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) - #ifdef __PYX_DEBUG_ATOMICS - #pragma message ("Using MSVC atomics") - #endif -#else - #undef CYTHON_ATOMICS - #define CYTHON_ATOMICS 0 - #ifdef __PYX_DEBUG_ATOMICS - #warning "Not using atomics" - #endif -#endif -#if CYTHON_ATOMICS - #define __pyx_add_acquisition_count(memview)\ - __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) - #define __pyx_sub_acquisition_count(memview)\ - __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview)) -#else - #define __pyx_add_acquisition_count(memview)\ - __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) - #define __pyx_sub_acquisition_count(memview)\ - __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) -#endif - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - -/* #### Code section: numeric_typedefs ### */ -/* #### Code section: complex_type_declarations ### */ -/* #### Code section: type_declarations ### */ - -/*--- Type declarations ---*/ -struct __pyx_array_obj; -struct __pyx_MemviewEnum_obj; -struct __pyx_memoryview_obj; -struct __pyx_memoryviewslice_obj; -struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each; - -/* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ -struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each { - int __pyx_n; - float max_neg_val; -}; - -/* "View.MemoryView":114 - * @cython.collection_type("sequence") - * @cname("__pyx_array") - * cdef class array: # <<<<<<<<<<<<<< - * - * cdef: - */ -struct __pyx_array_obj { - PyObject_HEAD - struct __pyx_vtabstruct_array *__pyx_vtab; - char *data; - Py_ssize_t len; - char *format; - int ndim; - Py_ssize_t *_shape; - Py_ssize_t *_strides; - Py_ssize_t itemsize; - PyObject *mode; - PyObject *_format; - void (*callback_free_data)(void *); - int free_data; - int dtype_is_object; -}; - - -/* "View.MemoryView":302 - * - * @cname('__pyx_MemviewEnum') - * cdef class Enum(object): # <<<<<<<<<<<<<< - * cdef object name - * def __init__(self, name): - */ -struct __pyx_MemviewEnum_obj { - PyObject_HEAD - PyObject *name; -}; - - -/* "View.MemoryView":337 - * - * @cname('__pyx_memoryview') - * cdef class memoryview: # <<<<<<<<<<<<<< - * - * cdef object obj - */ -struct __pyx_memoryview_obj { - PyObject_HEAD - struct __pyx_vtabstruct_memoryview *__pyx_vtab; - PyObject *obj; - PyObject *_size; - PyObject *_array_interface; - PyThread_type_lock lock; - __pyx_atomic_int_type acquisition_count; - Py_buffer view; - int flags; - int dtype_is_object; - __Pyx_TypeInfo *typeinfo; -}; - - -/* "View.MemoryView":952 - * @cython.collection_type("sequence") - * @cname('__pyx_memoryviewslice') - * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< - * "Internal class for passing memoryview slices to Python" - * - */ -struct __pyx_memoryviewslice_obj { - struct __pyx_memoryview_obj __pyx_base; - __Pyx_memviewslice from_slice; - PyObject *from_object; - PyObject *(*to_object_func)(char *); - int (*to_dtype_func)(char *, PyObject *); -}; - - - -/* "View.MemoryView":114 - * @cython.collection_type("sequence") - * @cname("__pyx_array") - * cdef class array: # <<<<<<<<<<<<<< - * - * cdef: - */ - -struct __pyx_vtabstruct_array { - PyObject *(*get_memview)(struct __pyx_array_obj *); -}; -static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; - - -/* "View.MemoryView":337 - * - * @cname('__pyx_memoryview') - * cdef class memoryview: # <<<<<<<<<<<<<< - * - * cdef object obj - */ - -struct __pyx_vtabstruct_memoryview { - char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); - PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); - PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); - PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); - PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); - PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); - PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); - PyObject *(*_get_base)(struct __pyx_memoryview_obj *); -}; -static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; - - -/* "View.MemoryView":952 - * @cython.collection_type("sequence") - * @cname('__pyx_memoryviewslice') - * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< - * "Internal class for passing memoryview slices to Python" - * - */ - -struct __pyx_vtabstruct__memoryviewslice { - struct __pyx_vtabstruct_memoryview __pyx_base; -}; -static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; -/* #### Code section: utility_code_proto ### */ - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, Py_ssize_t); - void (*DECREF)(void*, PyObject*, Py_ssize_t); - void (*GOTREF)(void*, PyObject*, Py_ssize_t); - void (*GIVEREF)(void*, PyObject*, Py_ssize_t); - void* (*SetupContext)(const char*, Py_ssize_t, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - } - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) - #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() -#endif - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContextNogil() - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_Py_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; Py_XDECREF(tmp);\ - } while (0) -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#if PY_VERSION_HEX >= 0x030C00A6 -#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) -#else -#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) -#endif -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) -#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* TupleAndListFromArray.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); -static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); -#endif - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* fastcall.proto */ -#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) -#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) -#define __Pyx_KwValues_VARARGS(args, nargs) NULL -#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) -#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) -#if CYTHON_METH_FASTCALL - #define __Pyx_Arg_FASTCALL(args, i) args[i] - #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) - #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) - static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); - #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) -#else - #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS - #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS - #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS - #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS - #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS -#endif -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) -#else -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) -#endif - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, - const char* function_name); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#if !CYTHON_VECTORCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif -#if !CYTHON_VECTORCALL -#if PY_VERSION_HEX >= 0x03080000 - #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif - #define __Pxy_PyFrame_Initialize_Offsets() - #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) -#else - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif -#endif -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectFastCall.proto */ -#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); - -/* RaiseUnexpectedTypeError.proto */ -static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); - -/* GCCDiagnostics.proto */ -#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - -/* BuildPyUnicode.proto */ -static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, - int prepend_sign, char padding_char); - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); - -/* JoinPyUnicode.proto */ -static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, - Py_UCS4 max_char); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* PyObjectFormatSimple.proto */ -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - PyObject_Format(s, f)) -#elif PY_MAJOR_VERSION < 3 - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ - PyObject_Format(s, f)) -#elif CYTHON_USE_TYPE_SLOTS - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ - likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ - PyObject_Format(s, f)) -#else - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - PyObject_Format(s, f)) -#endif - -CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* KeywordStringCheck.proto */ -static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); - -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -/* UnaryNegOverflows.proto */ -#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) do {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* AssertionsEnabled.proto */ -#define __Pyx_init_assertions_enabled() -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define __pyx_assertions_enabled() (1) -#elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API) - #define __pyx_assertions_enabled() (!Py_OptimizeFlag) -#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6 - static int __pyx_assertions_enabled_flag; - #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) - #undef __Pyx_init_assertions_enabled - static void __Pyx_init_assertions_enabled(void) { - __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level; - } -#else - #define __pyx_assertions_enabled() (!Py_OptimizeFlag) -#endif - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportDottedModule.proto */ -static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); -#endif - -/* ssize_strlen.proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* PySequenceMultiply.proto */ -#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) -static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); - -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* RaiseUnboundLocalError.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* DivInt[long].proto */ -static CYTHON_INLINE long __Pyx_div_long(long, long); - -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* HasAttr.proto */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); - -/* ErrOccurredWithGIL.proto */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); - -/* PyObject_GenericGetAttrNoDict.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr -#endif - -/* PyObject_GenericGetAttr.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr -#endif - -/* IncludeStructmemberH.proto */ -#include - -/* FixUpExtensionType.proto */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); -#endif - -/* PyObjectCallNoArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); - -/* PyObjectGetMethod.proto */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); - -/* PyObjectCallMethod0.proto */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); - -/* ValidateBasesTuple.proto */ -#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS -static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); -#endif - -/* PyType_Ready.proto */ -CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyTypeObject *type); - -/* MergeVTables.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_MergeVtables(PyTypeObject *type); -#endif - -/* SetupReduce.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_setup_reduce(PyObject* type_obj); -#endif - -/* FetchSharedCythonModule.proto */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void); - -/* FetchCommonType.proto */ -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -#else -static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); -#endif - -/* PyMethodNew.proto */ -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { - CYTHON_UNUSED_VAR(typ); - if (!self) - return __Pyx_NewRef(func); - return PyMethod_New(func, self); -} -#else - #define __Pyx_PyMethod_New PyMethod_New -#endif - -/* PyVectorcallFastCallDict.proto */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); -#endif - -/* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CYFUNCTION_COROUTINE 0x08 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#if PY_VERSION_HEX < 0x030900B1 - #define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#else - #define __Pyx_CyFunction_GetClassObj(f)\ - ((PyObject*) ((PyCMethodObject *) (f))->mm_class) -#endif -#define __Pyx_CyFunction_SetClassObj(f, classobj)\ - __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { -#if PY_VERSION_HEX < 0x030900B1 - PyCFunctionObject func; -#else - PyCMethodObject func; -#endif -#if CYTHON_BACKPORT_VECTORCALL - __pyx_vectorcallfunc func_vectorcall; -#endif -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; -#if PY_VERSION_HEX < 0x030900B1 - PyObject *func_classobj; -#endif - void *defaults; - int defaults_pyobjects; - size_t defaults_size; // used by FusedFunction for copying defaults - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; - PyObject *func_is_coroutine; -} __pyx_CyFunctionObject; -#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) -#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) -#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(PyObject *module); -#if CYTHON_METH_FASTCALL -static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -#if CYTHON_BACKPORT_VECTORCALL -#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) -#else -#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) -#endif -#endif - -/* CythonFunction.proto */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); -#endif - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -#if PY_MAJOR_VERSION < 3 - static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); - static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else - #define __Pyx_GetBuffer PyObject_GetBuffer - #define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - - -/* BufferStructDeclare.proto */ -typedef struct { - Py_ssize_t shape, strides, suboffsets; -} __Pyx_Buf_DimInfo; -typedef struct { - size_t refcount; - Py_buffer pybuffer; -} __Pyx_Buffer; -typedef struct { - __Pyx_Buffer *rcbuffer; - char *data; - __Pyx_Buf_DimInfo diminfo[8]; -} __Pyx_LocalBuf_ND; - -/* MemviewSliceIsContig.proto */ -static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); - -/* OverlappingSlices.proto */ -static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, - __Pyx_memviewslice *slice2, - int ndim, size_t itemsize); - -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); - -/* TypeInfoCompare.proto */ -static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); - -/* MemviewSliceValidateAndInit.proto */ -static int __Pyx_ValidateAndInit_memviewslice( - int *axes_specs, - int c_or_f_flag, - int buf_flags, - int ndim, - __Pyx_TypeInfo *dtype, - __Pyx_BufFmt_StackElem stack[], - __Pyx_memviewslice *memviewslice, - PyObject *original_obj); - -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_int(PyObject *, int writable_flag); - -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float(PyObject *, int writable_flag); - -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *, int writable_flag); - -/* MemviewSliceCopyTemplate.proto */ -static __Pyx_memviewslice -__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, - const char *mode, int ndim, - size_t sizeof_dtype, int contig_flag, - int dtype_is_object); - -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); - -/* FormatTypeName.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -typedef PyObject *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%U" -static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); -#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) -#else -typedef const char *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%.200s" -#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) -#define __Pyx_DECREF_TypeName(obj) -#endif - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -/* #### Code section: module_declarations ### */ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ - -/* Module declarations from "cython.view" */ - -/* Module declarations from "cython.dataclasses" */ - -/* Module declarations from "cython" */ - -/* Module declarations from "monotonic_align.core" */ -static PyObject *__pyx_collections_abc_Sequence = 0; -static PyObject *generic = 0; -static PyObject *strided = 0; -static PyObject *indirect = 0; -static PyObject *contiguous = 0; -static PyObject *indirect_contiguous = 0; -static int __pyx_memoryview_thread_locks_used; -static PyThread_type_lock __pyx_memoryview_thread_locks[8]; -static void __pyx_f_15monotonic_align_4core_maximum_path_each(__Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each *__pyx_optional_args); /*proto*/ -static void __pyx_f_15monotonic_align_4core_maximum_path_c(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ -static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ -static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ -static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ -static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ -static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ -static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ -static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ -static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ -static int __pyx_memoryview_err_no_memory(void); /*proto*/ -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ -static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ -static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ -/* #### Code section: typeinfo ### */ -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 }; -/* #### Code section: before_global_var ### */ -#define __Pyx_MODULE_NAME "monotonic_align.core" -extern int __pyx_module_is_main_monotonic_align__core; -int __pyx_module_is_main_monotonic_align__core = 0; - -/* Implementation of "monotonic_align.core" */ -/* #### Code section: global_var ### */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin___import__; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_MemoryError; -static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_TypeError; -static PyObject *__pyx_builtin_AssertionError; -static PyObject *__pyx_builtin_Ellipsis; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_IndexError; -/* #### Code section: string_decls ### */ -static const char __pyx_k_[] = ": "; -static const char __pyx_k_O[] = "O"; -static const char __pyx_k_c[] = "c"; -static const char __pyx_k__2[] = "."; -static const char __pyx_k__3[] = "*"; -static const char __pyx_k__6[] = "'"; -static const char __pyx_k__7[] = ")"; -static const char __pyx_k_gc[] = "gc"; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k__23[] = "?"; -static const char __pyx_k_abc[] = "abc"; -static const char __pyx_k_and[] = " and "; -static const char __pyx_k_got[] = " (got "; -static const char __pyx_k_new[] = "__new__"; -static const char __pyx_k_obj[] = "obj"; -static const char __pyx_k_sys[] = "sys"; -static const char __pyx_k_base[] = "base"; -static const char __pyx_k_dict[] = "__dict__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_mode[] = "mode"; -static const char __pyx_k_name[] = "name"; -static const char __pyx_k_ndim[] = "ndim"; -static const char __pyx_k_pack[] = "pack"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_spec[] = "__spec__"; -static const char __pyx_k_step[] = "step"; -static const char __pyx_k_stop[] = "stop"; -static const char __pyx_k_t_xs[] = "t_xs"; -static const char __pyx_k_t_ys[] = "t_ys"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_ASCII[] = "ASCII"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_count[] = "count"; -static const char __pyx_k_error[] = "error"; -static const char __pyx_k_flags[] = "flags"; -static const char __pyx_k_index[] = "index"; -static const char __pyx_k_paths[] = "paths"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_shape[] = "shape"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_enable[] = "enable"; -static const char __pyx_k_encode[] = "encode"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_name_2[] = "__name__"; -static const char __pyx_k_pickle[] = "pickle"; -static const char __pyx_k_reduce[] = "__reduce__"; -static const char __pyx_k_struct[] = "struct"; -static const char __pyx_k_unpack[] = "unpack"; -static const char __pyx_k_update[] = "update"; -static const char __pyx_k_values[] = "values"; -static const char __pyx_k_disable[] = "disable"; -static const char __pyx_k_fortran[] = "fortran"; -static const char __pyx_k_memview[] = "memview"; -static const char __pyx_k_Ellipsis[] = "Ellipsis"; -static const char __pyx_k_Sequence[] = "Sequence"; -static const char __pyx_k_core_pyx[] = "core.pyx"; -static const char __pyx_k_getstate[] = "__getstate__"; -static const char __pyx_k_itemsize[] = "itemsize"; -static const char __pyx_k_pyx_type[] = "__pyx_type"; -static const char __pyx_k_register[] = "register"; -static const char __pyx_k_setstate[] = "__setstate__"; -static const char __pyx_k_TypeError[] = "TypeError"; -static const char __pyx_k_enumerate[] = "enumerate"; -static const char __pyx_k_isenabled[] = "isenabled"; -static const char __pyx_k_pyx_state[] = "__pyx_state"; -static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; -static const char __pyx_k_IndexError[] = "IndexError"; -static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_pyx_result[] = "__pyx_result"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_MemoryError[] = "MemoryError"; -static const char __pyx_k_PickleError[] = "PickleError"; -static const char __pyx_k_collections[] = "collections"; -static const char __pyx_k_initializing[] = "_initializing"; -static const char __pyx_k_is_coroutine[] = "_is_coroutine"; -static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = ""; -static const char __pyx_k_version_info[] = "version_info"; -static const char __pyx_k_class_getitem[] = "__class_getitem__"; -static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; -static const char __pyx_k_AssertionError[] = "AssertionError"; -static const char __pyx_k_maximum_path_c[] = "maximum_path_c"; -static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; -static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; -static const char __pyx_k_collections_abc[] = "collections.abc"; -static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; -static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; -static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; -static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; -static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_strided_and_direct[] = ""; -static const char __pyx_k_monotonic_align_core[] = "monotonic_align.core"; -static const char __pyx_k_strided_and_indirect[] = ""; -static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; -static const char __pyx_k_contiguous_and_direct[] = ""; -static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; -static const char __pyx_k_MemoryView_of_r_object[] = ""; -static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; -static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; -static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; -static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; -static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; -static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; -static const char __pyx_k_strided_and_direct_or_indirect[] = ""; -static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; -static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; -static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; -static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; -static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; -static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; -static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; -static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; -static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; -static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; -static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; -/* #### Code section: decls ### */ -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_15monotonic_align_4core_maximum_path_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs); /* proto */ -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -/* #### Code section: late_includes ### */ -/* #### Code section: module_state ### */ -typedef struct { - PyObject *__pyx_d; - PyObject *__pyx_b; - PyObject *__pyx_cython_runtime; - PyObject *__pyx_empty_tuple; - PyObject *__pyx_empty_bytes; - PyObject *__pyx_empty_unicode; - #ifdef __Pyx_CyFunction_USED - PyTypeObject *__pyx_CyFunctionType; - #endif - #ifdef __Pyx_FusedFunction_USED - PyTypeObject *__pyx_FusedFunctionType; - #endif - #ifdef __Pyx_Generator_USED - PyTypeObject *__pyx_GeneratorType; - #endif - #ifdef __Pyx_IterableCoroutine_USED - PyTypeObject *__pyx_IterableCoroutineType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineAwaitType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineType; - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - PyObject *__pyx_type___pyx_array; - PyObject *__pyx_type___pyx_MemviewEnum; - PyObject *__pyx_type___pyx_memoryview; - PyObject *__pyx_type___pyx_memoryviewslice; - #endif - PyTypeObject *__pyx_array_type; - PyTypeObject *__pyx_MemviewEnum_type; - PyTypeObject *__pyx_memoryview_type; - PyTypeObject *__pyx_memoryviewslice_type; - PyObject *__pyx_kp_u_; - PyObject *__pyx_n_s_ASCII; - PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; - PyObject *__pyx_n_s_AssertionError; - PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; - PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; - PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; - PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; - PyObject *__pyx_kp_u_Cannot_index_with_type; - PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; - PyObject *__pyx_kp_s_Dimension_d_is_not_direct; - PyObject *__pyx_n_s_Ellipsis; - PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; - PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; - PyObject *__pyx_n_s_IndexError; - PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; - PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; - PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; - PyObject *__pyx_kp_u_Invalid_shape_in_axis; - PyObject *__pyx_n_s_MemoryError; - PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; - PyObject *__pyx_kp_s_MemoryView_of_r_object; - PyObject *__pyx_n_b_O; - PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; - PyObject *__pyx_n_s_PickleError; - PyObject *__pyx_n_s_Sequence; - PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; - PyObject *__pyx_n_s_TypeError; - PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; - PyObject *__pyx_n_s_ValueError; - PyObject *__pyx_n_s_View_MemoryView; - PyObject *__pyx_kp_u__2; - PyObject *__pyx_n_s__23; - PyObject *__pyx_n_s__3; - PyObject *__pyx_kp_u__6; - PyObject *__pyx_kp_u__7; - PyObject *__pyx_n_s_abc; - PyObject *__pyx_n_s_allocate_buffer; - PyObject *__pyx_kp_u_and; - PyObject *__pyx_n_s_asyncio_coroutines; - PyObject *__pyx_n_s_base; - PyObject *__pyx_n_s_c; - PyObject *__pyx_n_u_c; - PyObject *__pyx_n_s_class; - PyObject *__pyx_n_s_class_getitem; - PyObject *__pyx_n_s_cline_in_traceback; - PyObject *__pyx_n_s_collections; - PyObject *__pyx_kp_s_collections_abc; - PyObject *__pyx_kp_s_contiguous_and_direct; - PyObject *__pyx_kp_s_contiguous_and_indirect; - PyObject *__pyx_kp_s_core_pyx; - PyObject *__pyx_n_s_count; - PyObject *__pyx_n_s_dict; - PyObject *__pyx_kp_u_disable; - PyObject *__pyx_n_s_dtype_is_object; - PyObject *__pyx_kp_u_enable; - PyObject *__pyx_n_s_encode; - PyObject *__pyx_n_s_enumerate; - PyObject *__pyx_n_s_error; - PyObject *__pyx_n_s_flags; - PyObject *__pyx_n_s_format; - PyObject *__pyx_n_s_fortran; - PyObject *__pyx_n_u_fortran; - PyObject *__pyx_kp_u_gc; - PyObject *__pyx_n_s_getstate; - PyObject *__pyx_kp_u_got; - PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; - PyObject *__pyx_n_s_id; - PyObject *__pyx_n_s_import; - PyObject *__pyx_n_s_index; - PyObject *__pyx_n_s_initializing; - PyObject *__pyx_n_s_is_coroutine; - PyObject *__pyx_kp_u_isenabled; - PyObject *__pyx_n_s_itemsize; - PyObject *__pyx_kp_s_itemsize_0_for_cython_array; - PyObject *__pyx_n_s_main; - PyObject *__pyx_n_s_maximum_path_c; - PyObject *__pyx_n_s_memview; - PyObject *__pyx_n_s_mode; - PyObject *__pyx_n_s_monotonic_align_core; - PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_name_2; - PyObject *__pyx_n_s_ndim; - PyObject *__pyx_n_s_new; - PyObject *__pyx_kp_s_no_default___reduce___due_to_non; - PyObject *__pyx_n_s_obj; - PyObject *__pyx_n_s_pack; - PyObject *__pyx_n_s_paths; - PyObject *__pyx_n_s_pickle; - PyObject *__pyx_n_s_pyx_PickleError; - PyObject *__pyx_n_s_pyx_checksum; - PyObject *__pyx_n_s_pyx_result; - PyObject *__pyx_n_s_pyx_state; - PyObject *__pyx_n_s_pyx_type; - PyObject *__pyx_n_s_pyx_unpickle_Enum; - PyObject *__pyx_n_s_pyx_vtable; - PyObject *__pyx_n_s_range; - PyObject *__pyx_n_s_reduce; - PyObject *__pyx_n_s_reduce_cython; - PyObject *__pyx_n_s_reduce_ex; - PyObject *__pyx_n_s_register; - PyObject *__pyx_n_s_setstate; - PyObject *__pyx_n_s_setstate_cython; - PyObject *__pyx_n_s_shape; - PyObject *__pyx_n_s_size; - PyObject *__pyx_n_s_spec; - PyObject *__pyx_n_s_start; - PyObject *__pyx_n_s_step; - PyObject *__pyx_n_s_stop; - PyObject *__pyx_kp_s_strided_and_direct; - PyObject *__pyx_kp_s_strided_and_direct_or_indirect; - PyObject *__pyx_kp_s_strided_and_indirect; - PyObject *__pyx_kp_s_stringsource; - PyObject *__pyx_n_s_struct; - PyObject *__pyx_n_s_sys; - PyObject *__pyx_n_s_t_xs; - PyObject *__pyx_n_s_t_ys; - PyObject *__pyx_n_s_test; - PyObject *__pyx_kp_s_unable_to_allocate_array_data; - PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; - PyObject *__pyx_n_s_unpack; - PyObject *__pyx_n_s_update; - PyObject *__pyx_n_s_values; - PyObject *__pyx_n_s_version_info; - PyObject *__pyx_int_0; - PyObject *__pyx_int_1; - PyObject *__pyx_int_3; - PyObject *__pyx_int_112105877; - PyObject *__pyx_int_136983863; - PyObject *__pyx_int_184977713; - PyObject *__pyx_int_neg_1; - float __pyx_k__9; - PyObject *__pyx_slice__5; - PyObject *__pyx_tuple__4; - PyObject *__pyx_tuple__8; - PyObject *__pyx_tuple__10; - PyObject *__pyx_tuple__11; - PyObject *__pyx_tuple__12; - PyObject *__pyx_tuple__13; - PyObject *__pyx_tuple__14; - PyObject *__pyx_tuple__15; - PyObject *__pyx_tuple__16; - PyObject *__pyx_tuple__17; - PyObject *__pyx_tuple__18; - PyObject *__pyx_tuple__19; - PyObject *__pyx_tuple__21; - PyObject *__pyx_codeobj__20; - PyObject *__pyx_codeobj__22; -} __pyx_mstate; - -#if CYTHON_USE_MODULE_STATE -#ifdef __cplusplus -namespace { - extern struct PyModuleDef __pyx_moduledef; -} /* anonymous namespace */ -#else -static struct PyModuleDef __pyx_moduledef; -#endif - -#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - -#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - -#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) -#else -static __pyx_mstate __pyx_mstate_global_static = -#ifdef __cplusplus - {}; -#else - {0}; -#endif -static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; -#endif -/* #### Code section: module_state_clear ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_clear(PyObject *m) { - __pyx_mstate *clear_module_state = __pyx_mstate(m); - if (!clear_module_state) return 0; - Py_CLEAR(clear_module_state->__pyx_d); - Py_CLEAR(clear_module_state->__pyx_b); - Py_CLEAR(clear_module_state->__pyx_cython_runtime); - Py_CLEAR(clear_module_state->__pyx_empty_tuple); - Py_CLEAR(clear_module_state->__pyx_empty_bytes); - Py_CLEAR(clear_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_CLEAR(clear_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); - #endif - Py_CLEAR(clear_module_state->__pyx_array_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_array); - Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); - Py_CLEAR(clear_module_state->__pyx_memoryview_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); - Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); - Py_CLEAR(clear_module_state->__pyx_kp_u_); - Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); - Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); - Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); - Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); - Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); - Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); - Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); - Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); - Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); - Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); - Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); - Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); - Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); - Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); - Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); - Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); - Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); - Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); - Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); - Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); - Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); - Py_CLEAR(clear_module_state->__pyx_n_b_O); - Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); - Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); - Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); - Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); - Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); - Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); - Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); - Py_CLEAR(clear_module_state->__pyx_kp_u__2); - Py_CLEAR(clear_module_state->__pyx_n_s__23); - Py_CLEAR(clear_module_state->__pyx_n_s__3); - Py_CLEAR(clear_module_state->__pyx_kp_u__6); - Py_CLEAR(clear_module_state->__pyx_kp_u__7); - Py_CLEAR(clear_module_state->__pyx_n_s_abc); - Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); - Py_CLEAR(clear_module_state->__pyx_kp_u_and); - Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); - Py_CLEAR(clear_module_state->__pyx_n_s_base); - Py_CLEAR(clear_module_state->__pyx_n_s_c); - Py_CLEAR(clear_module_state->__pyx_n_u_c); - Py_CLEAR(clear_module_state->__pyx_n_s_class); - Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); - Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); - Py_CLEAR(clear_module_state->__pyx_n_s_collections); - Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); - Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); - Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); - Py_CLEAR(clear_module_state->__pyx_kp_s_core_pyx); - Py_CLEAR(clear_module_state->__pyx_n_s_count); - Py_CLEAR(clear_module_state->__pyx_n_s_dict); - Py_CLEAR(clear_module_state->__pyx_kp_u_disable); - Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); - Py_CLEAR(clear_module_state->__pyx_kp_u_enable); - Py_CLEAR(clear_module_state->__pyx_n_s_encode); - Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); - Py_CLEAR(clear_module_state->__pyx_n_s_error); - Py_CLEAR(clear_module_state->__pyx_n_s_flags); - Py_CLEAR(clear_module_state->__pyx_n_s_format); - Py_CLEAR(clear_module_state->__pyx_n_s_fortran); - Py_CLEAR(clear_module_state->__pyx_n_u_fortran); - Py_CLEAR(clear_module_state->__pyx_kp_u_gc); - Py_CLEAR(clear_module_state->__pyx_n_s_getstate); - Py_CLEAR(clear_module_state->__pyx_kp_u_got); - Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); - Py_CLEAR(clear_module_state->__pyx_n_s_id); - Py_CLEAR(clear_module_state->__pyx_n_s_import); - Py_CLEAR(clear_module_state->__pyx_n_s_index); - Py_CLEAR(clear_module_state->__pyx_n_s_initializing); - Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); - Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); - Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); - Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); - Py_CLEAR(clear_module_state->__pyx_n_s_main); - Py_CLEAR(clear_module_state->__pyx_n_s_maximum_path_c); - Py_CLEAR(clear_module_state->__pyx_n_s_memview); - Py_CLEAR(clear_module_state->__pyx_n_s_mode); - Py_CLEAR(clear_module_state->__pyx_n_s_monotonic_align_core); - Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_name_2); - Py_CLEAR(clear_module_state->__pyx_n_s_ndim); - Py_CLEAR(clear_module_state->__pyx_n_s_new); - Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); - Py_CLEAR(clear_module_state->__pyx_n_s_obj); - Py_CLEAR(clear_module_state->__pyx_n_s_pack); - Py_CLEAR(clear_module_state->__pyx_n_s_paths); - Py_CLEAR(clear_module_state->__pyx_n_s_pickle); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); - Py_CLEAR(clear_module_state->__pyx_n_s_range); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); - Py_CLEAR(clear_module_state->__pyx_n_s_register); - Py_CLEAR(clear_module_state->__pyx_n_s_setstate); - Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_shape); - Py_CLEAR(clear_module_state->__pyx_n_s_size); - Py_CLEAR(clear_module_state->__pyx_n_s_spec); - Py_CLEAR(clear_module_state->__pyx_n_s_start); - Py_CLEAR(clear_module_state->__pyx_n_s_step); - Py_CLEAR(clear_module_state->__pyx_n_s_stop); - Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); - Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); - Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); - Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); - Py_CLEAR(clear_module_state->__pyx_n_s_struct); - Py_CLEAR(clear_module_state->__pyx_n_s_sys); - Py_CLEAR(clear_module_state->__pyx_n_s_t_xs); - Py_CLEAR(clear_module_state->__pyx_n_s_t_ys); - Py_CLEAR(clear_module_state->__pyx_n_s_test); - Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); - Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); - Py_CLEAR(clear_module_state->__pyx_n_s_unpack); - Py_CLEAR(clear_module_state->__pyx_n_s_update); - Py_CLEAR(clear_module_state->__pyx_n_s_values); - Py_CLEAR(clear_module_state->__pyx_n_s_version_info); - Py_CLEAR(clear_module_state->__pyx_int_0); - Py_CLEAR(clear_module_state->__pyx_int_1); - Py_CLEAR(clear_module_state->__pyx_int_3); - Py_CLEAR(clear_module_state->__pyx_int_112105877); - Py_CLEAR(clear_module_state->__pyx_int_136983863); - Py_CLEAR(clear_module_state->__pyx_int_184977713); - Py_CLEAR(clear_module_state->__pyx_int_neg_1); - Py_CLEAR(clear_module_state->__pyx_slice__5); - Py_CLEAR(clear_module_state->__pyx_tuple__4); - Py_CLEAR(clear_module_state->__pyx_tuple__8); - Py_CLEAR(clear_module_state->__pyx_tuple__10); - Py_CLEAR(clear_module_state->__pyx_tuple__11); - Py_CLEAR(clear_module_state->__pyx_tuple__12); - Py_CLEAR(clear_module_state->__pyx_tuple__13); - Py_CLEAR(clear_module_state->__pyx_tuple__14); - Py_CLEAR(clear_module_state->__pyx_tuple__15); - Py_CLEAR(clear_module_state->__pyx_tuple__16); - Py_CLEAR(clear_module_state->__pyx_tuple__17); - Py_CLEAR(clear_module_state->__pyx_tuple__18); - Py_CLEAR(clear_module_state->__pyx_tuple__19); - Py_CLEAR(clear_module_state->__pyx_tuple__21); - Py_CLEAR(clear_module_state->__pyx_codeobj__20); - Py_CLEAR(clear_module_state->__pyx_codeobj__22); - return 0; -} -#endif -/* #### Code section: module_state_traverse ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { - __pyx_mstate *traverse_module_state = __pyx_mstate(m); - if (!traverse_module_state) return 0; - Py_VISIT(traverse_module_state->__pyx_d); - Py_VISIT(traverse_module_state->__pyx_b); - Py_VISIT(traverse_module_state->__pyx_cython_runtime); - Py_VISIT(traverse_module_state->__pyx_empty_tuple); - Py_VISIT(traverse_module_state->__pyx_empty_bytes); - Py_VISIT(traverse_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_VISIT(traverse_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); - #endif - Py_VISIT(traverse_module_state->__pyx_array_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_array); - Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); - Py_VISIT(traverse_module_state->__pyx_memoryview_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); - Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); - Py_VISIT(traverse_module_state->__pyx_kp_u_); - Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); - Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); - Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); - Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); - Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); - Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); - Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); - Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); - Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); - Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); - Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); - Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); - Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); - Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); - Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); - Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); - Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); - Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); - Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); - Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); - Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); - Py_VISIT(traverse_module_state->__pyx_n_b_O); - Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); - Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); - Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); - Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); - Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); - Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); - Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); - Py_VISIT(traverse_module_state->__pyx_kp_u__2); - Py_VISIT(traverse_module_state->__pyx_n_s__23); - Py_VISIT(traverse_module_state->__pyx_n_s__3); - Py_VISIT(traverse_module_state->__pyx_kp_u__6); - Py_VISIT(traverse_module_state->__pyx_kp_u__7); - Py_VISIT(traverse_module_state->__pyx_n_s_abc); - Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); - Py_VISIT(traverse_module_state->__pyx_kp_u_and); - Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); - Py_VISIT(traverse_module_state->__pyx_n_s_base); - Py_VISIT(traverse_module_state->__pyx_n_s_c); - Py_VISIT(traverse_module_state->__pyx_n_u_c); - Py_VISIT(traverse_module_state->__pyx_n_s_class); - Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); - Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); - Py_VISIT(traverse_module_state->__pyx_n_s_collections); - Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); - Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); - Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); - Py_VISIT(traverse_module_state->__pyx_kp_s_core_pyx); - Py_VISIT(traverse_module_state->__pyx_n_s_count); - Py_VISIT(traverse_module_state->__pyx_n_s_dict); - Py_VISIT(traverse_module_state->__pyx_kp_u_disable); - Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); - Py_VISIT(traverse_module_state->__pyx_kp_u_enable); - Py_VISIT(traverse_module_state->__pyx_n_s_encode); - Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); - Py_VISIT(traverse_module_state->__pyx_n_s_error); - Py_VISIT(traverse_module_state->__pyx_n_s_flags); - Py_VISIT(traverse_module_state->__pyx_n_s_format); - Py_VISIT(traverse_module_state->__pyx_n_s_fortran); - Py_VISIT(traverse_module_state->__pyx_n_u_fortran); - Py_VISIT(traverse_module_state->__pyx_kp_u_gc); - Py_VISIT(traverse_module_state->__pyx_n_s_getstate); - Py_VISIT(traverse_module_state->__pyx_kp_u_got); - Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); - Py_VISIT(traverse_module_state->__pyx_n_s_id); - Py_VISIT(traverse_module_state->__pyx_n_s_import); - Py_VISIT(traverse_module_state->__pyx_n_s_index); - Py_VISIT(traverse_module_state->__pyx_n_s_initializing); - Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); - Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); - Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); - Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); - Py_VISIT(traverse_module_state->__pyx_n_s_main); - Py_VISIT(traverse_module_state->__pyx_n_s_maximum_path_c); - Py_VISIT(traverse_module_state->__pyx_n_s_memview); - Py_VISIT(traverse_module_state->__pyx_n_s_mode); - Py_VISIT(traverse_module_state->__pyx_n_s_monotonic_align_core); - Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_name_2); - Py_VISIT(traverse_module_state->__pyx_n_s_ndim); - Py_VISIT(traverse_module_state->__pyx_n_s_new); - Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); - Py_VISIT(traverse_module_state->__pyx_n_s_obj); - Py_VISIT(traverse_module_state->__pyx_n_s_pack); - Py_VISIT(traverse_module_state->__pyx_n_s_paths); - Py_VISIT(traverse_module_state->__pyx_n_s_pickle); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); - Py_VISIT(traverse_module_state->__pyx_n_s_range); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); - Py_VISIT(traverse_module_state->__pyx_n_s_register); - Py_VISIT(traverse_module_state->__pyx_n_s_setstate); - Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_shape); - Py_VISIT(traverse_module_state->__pyx_n_s_size); - Py_VISIT(traverse_module_state->__pyx_n_s_spec); - Py_VISIT(traverse_module_state->__pyx_n_s_start); - Py_VISIT(traverse_module_state->__pyx_n_s_step); - Py_VISIT(traverse_module_state->__pyx_n_s_stop); - Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); - Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); - Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); - Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); - Py_VISIT(traverse_module_state->__pyx_n_s_struct); - Py_VISIT(traverse_module_state->__pyx_n_s_sys); - Py_VISIT(traverse_module_state->__pyx_n_s_t_xs); - Py_VISIT(traverse_module_state->__pyx_n_s_t_ys); - Py_VISIT(traverse_module_state->__pyx_n_s_test); - Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); - Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); - Py_VISIT(traverse_module_state->__pyx_n_s_unpack); - Py_VISIT(traverse_module_state->__pyx_n_s_update); - Py_VISIT(traverse_module_state->__pyx_n_s_values); - Py_VISIT(traverse_module_state->__pyx_n_s_version_info); - Py_VISIT(traverse_module_state->__pyx_int_0); - Py_VISIT(traverse_module_state->__pyx_int_1); - Py_VISIT(traverse_module_state->__pyx_int_3); - Py_VISIT(traverse_module_state->__pyx_int_112105877); - Py_VISIT(traverse_module_state->__pyx_int_136983863); - Py_VISIT(traverse_module_state->__pyx_int_184977713); - Py_VISIT(traverse_module_state->__pyx_int_neg_1); - Py_VISIT(traverse_module_state->__pyx_slice__5); - Py_VISIT(traverse_module_state->__pyx_tuple__4); - Py_VISIT(traverse_module_state->__pyx_tuple__8); - Py_VISIT(traverse_module_state->__pyx_tuple__10); - Py_VISIT(traverse_module_state->__pyx_tuple__11); - Py_VISIT(traverse_module_state->__pyx_tuple__12); - Py_VISIT(traverse_module_state->__pyx_tuple__13); - Py_VISIT(traverse_module_state->__pyx_tuple__14); - Py_VISIT(traverse_module_state->__pyx_tuple__15); - Py_VISIT(traverse_module_state->__pyx_tuple__16); - Py_VISIT(traverse_module_state->__pyx_tuple__17); - Py_VISIT(traverse_module_state->__pyx_tuple__18); - Py_VISIT(traverse_module_state->__pyx_tuple__19); - Py_VISIT(traverse_module_state->__pyx_tuple__21); - Py_VISIT(traverse_module_state->__pyx_codeobj__20); - Py_VISIT(traverse_module_state->__pyx_codeobj__22); - return 0; -} -#endif -/* #### Code section: module_state_defines ### */ -#define __pyx_d __pyx_mstate_global->__pyx_d -#define __pyx_b __pyx_mstate_global->__pyx_b -#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime -#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple -#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes -#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode -#ifdef __Pyx_CyFunction_USED -#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType -#endif -#ifdef __Pyx_FusedFunction_USED -#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType -#endif -#ifdef __Pyx_Generator_USED -#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType -#endif -#ifdef __Pyx_IterableCoroutine_USED -#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array -#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum -#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview -#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice -#endif -#define __pyx_array_type __pyx_mstate_global->__pyx_array_type -#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type -#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type -#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type -#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ -#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII -#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi -#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError -#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri -#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is -#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor -#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi -#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type -#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with -#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct -#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis -#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr -#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 -#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError -#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d -#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte -#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr -#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis -#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError -#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x -#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object -#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O -#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a -#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError -#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence -#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d -#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError -#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object -#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError -#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView -#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 -#define __pyx_n_s__23 __pyx_mstate_global->__pyx_n_s__23 -#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 -#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 -#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 -#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc -#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer -#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and -#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines -#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base -#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c -#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c -#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class -#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem -#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback -#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections -#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc -#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct -#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect -#define __pyx_kp_s_core_pyx __pyx_mstate_global->__pyx_kp_s_core_pyx -#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count -#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict -#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable -#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object -#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable -#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode -#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate -#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error -#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags -#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format -#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran -#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran -#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc -#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate -#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got -#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi -#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id -#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import -#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index -#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing -#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine -#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled -#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize -#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array -#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main -#define __pyx_n_s_maximum_path_c __pyx_mstate_global->__pyx_n_s_maximum_path_c -#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview -#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode -#define __pyx_n_s_monotonic_align_core __pyx_mstate_global->__pyx_n_s_monotonic_align_core -#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 -#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim -#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new -#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non -#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj -#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack -#define __pyx_n_s_paths __pyx_mstate_global->__pyx_n_s_paths -#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle -#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError -#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum -#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result -#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state -#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type -#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum -#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable -#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range -#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce -#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython -#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex -#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register -#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate -#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython -#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape -#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size -#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec -#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start -#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step -#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop -#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct -#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect -#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect -#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource -#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct -#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys -#define __pyx_n_s_t_xs __pyx_mstate_global->__pyx_n_s_t_xs -#define __pyx_n_s_t_ys __pyx_mstate_global->__pyx_n_s_t_ys -#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test -#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data -#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str -#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack -#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update -#define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values -#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info -#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 -#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 -#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 -#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 -#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 -#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 -#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 -#define __pyx_k__9 __pyx_mstate_global->__pyx_k__9 -#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 -#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 -#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 -#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 -#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 -#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 -#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 -#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 -#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 -#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 -#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 -#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 -#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 -#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 -#define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 -#define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22 -/* #### Code section: module_code ### */ - -/* "View.MemoryView":131 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ - -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) - } - } else { - switch (__pyx_nargs) { - case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) - } else { - - /* "View.MemoryView":132 - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< - * - * cdef int idx - */ - __pyx_v_allocate_buffer = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - - /* "View.MemoryView":131 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_dim; - char __pyx_v_order; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - char *__pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_UCS4 __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); - - /* "View.MemoryView":137 - * cdef Py_ssize_t dim - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize - * - */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 137, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); - - /* "View.MemoryView":138 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< - * - * if not self.ndim: - */ - __pyx_v_self->itemsize = __pyx_v_itemsize; - - /* "View.MemoryView":140 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError, "Empty shape tuple for cython.array" - * - */ - __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":141 - * - * if not self.ndim: - * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); - __PYX_ERR(1, 141, __pyx_L1_error) - - /* "View.MemoryView":140 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError, "Empty shape tuple for cython.array" - * - */ - } - - /* "View.MemoryView":143 - * raise ValueError, "Empty shape tuple for cython.array" - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError, "itemsize <= 0 for cython.array" - * - */ - __pyx_t_2 = (__pyx_v_itemsize <= 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":144 - * - * if itemsize <= 0: - * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); - __PYX_ERR(1, 144, __pyx_L1_error) - - /* "View.MemoryView":143 - * raise ValueError, "Empty shape tuple for cython.array" - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError, "itemsize <= 0 for cython.array" - * - */ - } - - /* "View.MemoryView":146 - * raise ValueError, "itemsize <= 0 for cython.array" - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { - - /* "View.MemoryView":147 - * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_7 = 1; - } - } - { - PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":146 - * raise ValueError, "itemsize <= 0 for cython.array" - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - } - - /* "View.MemoryView":148 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format - * - */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) - __pyx_t_4 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":149 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * - * - */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(1, 149, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_8; - - /* "View.MemoryView":152 - * - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim - * - */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - - /* "View.MemoryView":153 - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< - * - * if not self._shape: - */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - - /* "View.MemoryView":155 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate shape and strides." - * - */ - __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); - if (unlikely(__pyx_t_3)) { - - /* "View.MemoryView":156 - * - * if not self._shape: - * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< - * - * - */ - __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); - __PYX_ERR(1, 156, __pyx_L1_error) - - /* "View.MemoryView":155 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate shape and strides." - * - */ - } - - /* "View.MemoryView":159 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - */ - __pyx_t_7 = 0; - __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_7; - __pyx_t_7 = (__pyx_t_7 + 1); - - /* "View.MemoryView":160 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - * self._shape[idx] = dim - */ - __pyx_t_3 = (__pyx_v_dim <= 0); - if (unlikely(__pyx_t_3)) { - - /* "View.MemoryView":161 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< - * self._shape[idx] = dim - * - */ - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); - __pyx_t_9 += 22; - __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); - __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u_); - __pyx_t_9 += 2; - __Pyx_GIVEREF(__pyx_kp_u_); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); - __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u__2); - __pyx_t_9 += 1; - __Pyx_GIVEREF(__pyx_kp_u__2); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 161, __pyx_L1_error) - - /* "View.MemoryView":160 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - * self._shape[idx] = dim - */ - } - - /* "View.MemoryView":162 - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - * self._shape[idx] = dim # <<<<<<<<<<<<<< - * - * cdef char order - */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - - /* "View.MemoryView":159 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":165 - * - * cdef char order - * if mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) - if (__pyx_t_3) { - - /* "View.MemoryView":166 - * cdef char order - * if mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * elif mode == 'fortran': - */ - __pyx_v_order = 'C'; - - /* "View.MemoryView":167 - * if mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * elif mode == 'fortran': - * order = b'F' - */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - - /* "View.MemoryView":165 - * - * cdef char order - * if mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L11; - } - - /* "View.MemoryView":168 - * order = b'C' - * self.mode = u'c' - * elif mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) - if (likely(__pyx_t_3)) { - - /* "View.MemoryView":169 - * self.mode = u'c' - * elif mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * else: - */ - __pyx_v_order = 'F'; - - /* "View.MemoryView":170 - * elif mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * else: - * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" - */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; - - /* "View.MemoryView":168 - * order = b'C' - * self.mode = u'c' - * elif mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L11; - } - - /* "View.MemoryView":172 - * self.mode = u'fortran' - * else: - * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< - * - * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 172, __pyx_L1_error) - } - __pyx_L11:; - - /* "View.MemoryView":174 - * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" - * - * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< - * - * self.free_data = allocate_buffer - */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - - /* "View.MemoryView":176 - * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * - */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; - - /* "View.MemoryView":177 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * - * if allocate_buffer: - */ - __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_3; - - /* "View.MemoryView":179 - * self.dtype_is_object = format == b'O' - * - * if allocate_buffer: # <<<<<<<<<<<<<< - * _allocate_buffer(self) - * - */ - if (__pyx_v_allocate_buffer) { - - /* "View.MemoryView":180 - * - * if allocate_buffer: - * _allocate_buffer(self) # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) - - /* "View.MemoryView":179 - * self.dtype_is_object = format == b'O' - * - * if allocate_buffer: # <<<<<<<<<<<<<< - * _allocate_buffer(self) - * - */ - } - - /* "View.MemoryView":131 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":182 - * _allocate_buffer(self) - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - */ - -/* Python wrapper */ -CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - char *__pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - Py_ssize_t *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (unlikely(__pyx_v_info == NULL)) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":184 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":185 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":186 - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":187 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":186 - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - goto __pyx_L4; - } - - /* "View.MemoryView":188 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":189 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError, "Can only create a buffer that is contiguous in memory." - */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":188 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - } - __pyx_L4:; - - /* "View.MemoryView":190 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data - */ - __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":191 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); - __PYX_ERR(1, 191, __pyx_L1_error) - - /* "View.MemoryView":190 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data - */ - } - - /* "View.MemoryView":185 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - } - - /* "View.MemoryView":192 - * if not (flags & bufmode): - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * - */ - __pyx_t_2 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_2; - - /* "View.MemoryView":193 - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * - * if flags & PyBUF_STRIDES: - */ - __pyx_t_3 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_3; - - /* "View.MemoryView":195 - * info.len = self.len - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":196 - * - * if flags & PyBUF_STRIDES: - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides - */ - __pyx_t_4 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_4; - - /* "View.MemoryView":197 - * if flags & PyBUF_STRIDES: - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * else: - */ - __pyx_t_5 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_5; - - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * else: - * info.ndim = 1 - */ - __pyx_t_5 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_5; - - /* "View.MemoryView":195 - * info.len = self.len - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape - */ - goto __pyx_L6; - } - - /* "View.MemoryView":200 - * info.strides = self._strides - * else: - * info.ndim = 1 # <<<<<<<<<<<<<< - * info.shape = &self.len if flags & PyBUF_ND else NULL - * info.strides = NULL - */ - /*else*/ { - __pyx_v_info->ndim = 1; - - /* "View.MemoryView":201 - * else: - * info.ndim = 1 - * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< - * info.strides = NULL - * - */ - if (((__pyx_v_flags & PyBUF_ND) != 0)) { - __pyx_t_5 = (&__pyx_v_self->len); - } else { - __pyx_t_5 = NULL; - } - __pyx_v_info->shape = __pyx_t_5; - - /* "View.MemoryView":202 - * info.ndim = 1 - * info.shape = &self.len if flags & PyBUF_ND else NULL - * info.strides = NULL # <<<<<<<<<<<<<< - * - * info.suboffsets = NULL - */ - __pyx_v_info->strides = NULL; - } - __pyx_L6:; - - /* "View.MemoryView":204 - * info.strides = NULL - * - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 - */ - __pyx_v_info->suboffsets = NULL; - - /* "View.MemoryView":205 - * - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 - * info.format = self.format if flags & PyBUF_FORMAT else NULL - */ - __pyx_t_3 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_3; - - /* "View.MemoryView":206 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< - * info.format = self.format if flags & PyBUF_FORMAT else NULL - * info.obj = self - */ - __pyx_v_info->readonly = 0; - - /* "View.MemoryView":207 - * info.itemsize = self.itemsize - * info.readonly = 0 - * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< - * info.obj = self - * - */ - if (((__pyx_v_flags & PyBUF_FORMAT) != 0)) { - __pyx_t_2 = __pyx_v_self->format; - } else { - __pyx_t_2 = NULL; - } - __pyx_v_info->format = __pyx_t_2; - - /* "View.MemoryView":208 - * info.readonly = 0 - * info.format = self.format if flags & PyBUF_FORMAT else NULL - * info.obj = self # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): - */ - __Pyx_INCREF((PyObject *)__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_v_self); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "View.MemoryView":182 - * _allocate_buffer(self) - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":210 - * info.obj = self - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - */ - -/* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":211 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - */ - __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":212 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: - */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); - - /* "View.MemoryView":211 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":213 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - */ - if (__pyx_v_self->free_data) { - } else { - __pyx_t_1 = __pyx_v_self->free_data; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->data != NULL); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "View.MemoryView":214 - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) - */ - if (__pyx_v_self->dtype_is_object) { - - /* "View.MemoryView":215 - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< - * free(self.data) - * PyObject_Free(self._shape) - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - - /* "View.MemoryView":214 - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) - */ - } - - /* "View.MemoryView":216 - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) - * - */ - free(__pyx_v_self->data); - - /* "View.MemoryView":213 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - */ - } - __pyx_L3:; - - /* "View.MemoryView":217 - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< - * - * @property - */ - PyObject_Free(__pyx_v_self->_shape); - - /* "View.MemoryView":210 - * info.obj = self - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":219 - * PyObject_Free(self._shape) - * - * @property # <<<<<<<<<<<<<< - * def memview(self): - * return self.get_memview() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":221 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< - * - * @cname('get_memview') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":219 - * PyObject_Free(self._shape) - * - * @property # <<<<<<<<<<<<<< - * def memview(self): - * return self.get_memview() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":224 - * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) - */ - -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); - - /* "View.MemoryView":225 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) - * - */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - - /* "View.MemoryView":226 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF((PyObject *)__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":224 - * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":228 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] - * - */ - -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "View.MemoryView":229 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< - * - * def __getattr__(self, attr): - */ - __pyx_r = (__pyx_v_self->_shape[0]); - goto __pyx_L0; - - /* "View.MemoryView":228 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":231 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); - - /* "View.MemoryView":232 - * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< - * - * def __getitem__(self, item): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":231 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":234 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - -/* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":235 - * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< - * - * def __setitem__(self, item, value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":234 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":237 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - -/* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - - /* "View.MemoryView":238 - * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "View.MemoryView":237 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":248 - * - * @cname("__pyx_array_allocate_buffer") - * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< - * - * - */ - -static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_i; - PyObject **__pyx_v_p; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_allocate_buffer", 0); - - /* "View.MemoryView":254 - * cdef PyObject **p - * - * self.free_data = True # <<<<<<<<<<<<<< - * self.data = malloc(self.len) - * if not self.data: - */ - __pyx_v_self->free_data = 1; - - /* "View.MemoryView":255 - * - * self.free_data = True - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError, "unable to allocate array data." - */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - - /* "View.MemoryView":256 - * self.free_data = True - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate array data." - * - */ - __pyx_t_1 = (!(__pyx_v_self->data != 0)); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":257 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: - */ - __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); - __PYX_ERR(1, 257, __pyx_L1_error) - - /* "View.MemoryView":256 - * self.free_data = True - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate array data." - * - */ - } - - /* "View.MemoryView":259 - * raise MemoryError, "unable to allocate array data." - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len // self.itemsize): - */ - if (__pyx_v_self->dtype_is_object) { - - /* "View.MemoryView":260 - * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len // self.itemsize): - * p[i] = Py_None - */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - - /* "View.MemoryView":261 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_self->itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(1, 261, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(1, 261, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":262 - * p = self.data - * for i in range(self.len // self.itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * return 0 - */ - (__pyx_v_p[__pyx_v_i]) = Py_None; - - /* "View.MemoryView":263 - * for i in range(self.len // self.itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * return 0 - * - */ - Py_INCREF(Py_None); - } - - /* "View.MemoryView":259 - * raise MemoryError, "unable to allocate array data." - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len // self.itemsize): - */ - } - - /* "View.MemoryView":264 - * p[i] = Py_None - * Py_INCREF(Py_None) - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":248 - * - * @cname("__pyx_array_allocate_buffer") - * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< - * - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":268 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< - * cdef array result - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - */ - -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - PyObject *__pyx_v_mode = 0; - struct __pyx_array_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); - - /* "View.MemoryView":270 - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): - * cdef array result - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< - * - * if buf is NULL: - */ - if (((__pyx_v_c_mode[0]) == 'f')) { - __Pyx_INCREF(__pyx_n_s_fortran); - __pyx_t_1 = __pyx_n_s_fortran; - } else { - __Pyx_INCREF(__pyx_n_s_c); - __pyx_t_1 = __pyx_n_s_c; - } - __pyx_v_mode = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":272 - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - * - * if buf is NULL: # <<<<<<<<<<<<<< - * result = array.__new__(array, shape, itemsize, format, mode) - * else: - */ - __pyx_t_2 = (__pyx_v_buf == NULL); - if (__pyx_t_2) { - - /* "View.MemoryView":273 - * - * if buf is NULL: - * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< - * else: - * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) - */ - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_INCREF(__pyx_v_mode); - __Pyx_GIVEREF(__pyx_v_mode); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":272 - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - * - * if buf is NULL: # <<<<<<<<<<<<<< - * result = array.__new__(array, shape, itemsize, format, mode) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":275 - * result = array.__new__(array, shape, itemsize, format, mode) - * else: - * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf - * - */ - /*else*/ { - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); - __Pyx_INCREF(__pyx_v_mode); - __Pyx_GIVEREF(__pyx_v_mode); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":276 - * else: - * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result->data = __pyx_v_buf; - } - __pyx_L3:; - - /* "View.MemoryView":278 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF((PyObject *)__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "View.MemoryView":268 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< - * cdef array result - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_mode); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":304 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - -/* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); - - /* "View.MemoryView":305 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name - */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; - - /* "View.MemoryView":304 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":306 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":307 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< - * - * cdef generic = Enum("") - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; - - /* "View.MemoryView":306 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) - */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - if (__pyx_t_2) { - - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None - */ - __pyx_v_use_setstate = 1; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } - - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_2; - } - __pyx_L3:; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - * else: - */ - if (__pyx_v_use_setstate) { - - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_136983863); - __Pyx_GIVEREF(__pyx_int_136983863); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - * else: - */ - } - - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_136983863); - __Pyx_GIVEREF(__pyx_int_136983863); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":349 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags - */ - -/* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) - } - } else { - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - } else { - __pyx_v_dtype_is_object = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_intptr_t __pyx_t_4; - size_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "View.MemoryView":350 - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: - */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; - - /* "View.MemoryView":351 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - */ - __pyx_v_self->flags = __pyx_v_flags; - - /* "View.MemoryView":352 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_obj != Py_None); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "View.MemoryView":353 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - */ - __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - - /* "View.MemoryView":354 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":355 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - - /* "View.MemoryView":356 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - */ - Py_INCREF(Py_None); - - /* "View.MemoryView":354 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - } - - /* "View.MemoryView":352 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - } - - /* "View.MemoryView":358 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: - */ - __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); - if (__pyx_t_1) { - - /* "View.MemoryView":360 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); - if (__pyx_t_1) { - - /* "View.MemoryView":361 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - - /* "View.MemoryView":362 - * if __pyx_memoryview_thread_locks_used < 8: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - - /* "View.MemoryView":360 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } - - /* "View.MemoryView":363 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - __pyx_t_1 = (__pyx_v_self->lock == NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":364 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError - */ - __pyx_v_self->lock = PyThread_allocate_lock(); - - /* "View.MemoryView":365 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - __pyx_t_1 = (__pyx_v_self->lock == NULL); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":366 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: - */ - PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) - - /* "View.MemoryView":365 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - } - - /* "View.MemoryView":363 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - } - - /* "View.MemoryView":358 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: - */ - } - - /* "View.MemoryView":368 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":369 - * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object - */ - __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - - /* "View.MemoryView":368 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - goto __pyx_L11; - } - - /* "View.MemoryView":371 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< - * - * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 - */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; - - /* "View.MemoryView":373 - * self.dtype_is_object = dtype_is_object - * - * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< - * self.typeinfo = NULL - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(__pyx_assertions_enabled())) { - __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); - __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); - if (unlikely(__pyx_t_5 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(1, 373, __pyx_L1_error) - } - __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); - if (unlikely(!__pyx_t_1)) { - __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); - __PYX_ERR(1, 373, __pyx_L1_error) - } - } - #else - if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) - #endif - - /* "View.MemoryView":374 - * - * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 - * self.typeinfo = NULL # <<<<<<<<<<<<<< - * - * def __dealloc__(memoryview self): - */ - __pyx_v_self->typeinfo = NULL; - - /* "View.MemoryView":349 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":376 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyThread_type_lock __pyx_t_5; - PyThread_type_lock __pyx_t_6; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":377 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":378 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - - /* "View.MemoryView":377 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":379 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":381 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - - /* "View.MemoryView":382 - * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< - * - * cdef int i - */ - Py_DECREF(Py_None); - - /* "View.MemoryView":379 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - } - __pyx_L3:; - - /* "View.MemoryView":386 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_1 = (__pyx_v_self->lock != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":387 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - */ - __pyx_t_2 = __pyx_memoryview_thread_locks_used; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":388 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); - if (__pyx_t_1) { - - /* "View.MemoryView":389 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - - /* "View.MemoryView":390 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); - if (__pyx_t_1) { - - /* "View.MemoryView":392 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break - */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; - - /* "View.MemoryView":390 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - } - - /* "View.MemoryView":393 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) - */ - goto __pyx_L6_break; - - /* "View.MemoryView":388 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - } - } - /*else*/ { - - /* "View.MemoryView":395 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; - - /* "View.MemoryView":386 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - } - - /* "View.MemoryView":376 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":397 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ - -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); - - /* "View.MemoryView":399 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< - * - * for dim, idx in enumerate(index): - */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - - /* "View.MemoryView":401 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 401, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); - - /* "View.MemoryView":402 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< - * - * return itemp - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; - - /* "View.MemoryView":401 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":404 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_itemp; - goto __pyx_L0; - - /* "View.MemoryView":397 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":407 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":408 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - if (__pyx_t_1) { - - /* "View.MemoryView":409 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< - * - * have_slices, indices = _unellipsify(index, self.view.ndim) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_self); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "View.MemoryView":408 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * - */ - } - - /* "View.MemoryView":411 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * cdef char *itemp - */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 411, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_v_indices = __pyx_t_4; - __pyx_t_4 = 0; - - /* "View.MemoryView":414 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":415 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":414 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - } - - /* "View.MemoryView":417 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) - * - */ - /*else*/ { - __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_5; - - /* "View.MemoryView":418 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< - * - * def __setitem__(memoryview self, object index, object value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "View.MemoryView":407 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":420 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError, "Cannot assign to read-only memoryview" - */ - -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "View.MemoryView":421 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError, "Cannot assign to read-only memoryview" - * - */ - if (unlikely(__pyx_v_self->view.readonly)) { - - /* "View.MemoryView":422 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); - __PYX_ERR(1, 422, __pyx_L1_error) - - /* "View.MemoryView":421 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError, "Cannot assign to read-only memoryview" - * - */ - } - - /* "View.MemoryView":424 - * raise TypeError, "Cannot assign to read-only memoryview" - * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * if have_slices: - */ - __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(__pyx_t_1 != Py_None)) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 424, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":426 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":427 - * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_obj = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":428 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":429 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) - */ - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":428 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":431 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L5:; - - /* "View.MemoryView":426 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: - */ - goto __pyx_L4; - } - - /* "View.MemoryView":433 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< - * - * cdef is_slice(self, obj): - */ - /*else*/ { - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L4:; - - /* "View.MemoryView":420 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError, "Cannot assign to read-only memoryview" - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":435 - * self.setitem_indexed(index, value) - * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: - */ - -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); - - /* "View.MemoryView":436 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = (!__pyx_t_1); - if (__pyx_t_2) { - - /* "View.MemoryView":437 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { - - /* "View.MemoryView":438 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "View.MemoryView":439 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None - */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - - /* "View.MemoryView":438 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":437 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "View.MemoryView":440 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - - /* "View.MemoryView":441 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< - * - * return obj - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - - /* "View.MemoryView":437 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - __pyx_L6_except_error:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } - - /* "View.MemoryView":436 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - } - - /* "View.MemoryView":443 - * return None - * - * return obj # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assignment(self, dst, src): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - - /* "View.MemoryView":435 - * self.setitem_indexed(index, value) - * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":445 - * return obj - * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - */ - -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - __Pyx_memviewslice __pyx_v_msrc; - __Pyx_memviewslice __pyx_v_mdst; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - - /* "View.MemoryView":448 - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] - * - */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) - __pyx_v_msrc = (__pyx_t_1[0]); - - /* "View.MemoryView":449 - * cdef __Pyx_memviewslice src_slice - * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] - * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< - * - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) - */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) - __pyx_v_mdst = (__pyx_t_1[0]); - - /* "View.MemoryView":451 - * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] - * - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) - - /* "View.MemoryView":445 - * return obj - * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":453 - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL - */ - -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - - /* "View.MemoryView":455 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item - * - */ - __pyx_v_tmp = NULL; - - /* "View.MemoryView":460 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< - * - * if self.view.itemsize > sizeof(array): - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; - - /* "View.MemoryView":462 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); - if (__pyx_t_2) { - - /* "View.MemoryView":463 - * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError - */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - - /* "View.MemoryView":464 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - __pyx_t_2 = (__pyx_v_tmp == NULL); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":465 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: - */ - PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) - - /* "View.MemoryView":464 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - } - - /* "View.MemoryView":466 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array - */ - __pyx_v_item = __pyx_v_tmp; - - /* "View.MemoryView":462 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":468 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< - * - * try: - */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); - } - __pyx_L3:; - - /* "View.MemoryView":470 - * item = array - * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value - */ - /*try:*/ { - - /* "View.MemoryView":471 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - if (__pyx_v_self->dtype_is_object) { - - /* "View.MemoryView":472 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) - */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - - /* "View.MemoryView":471 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":474 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L8:; - - /* "View.MemoryView":478 - * - * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); - if (__pyx_t_2) { - - /* "View.MemoryView":479 - * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) - */ - __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - - /* "View.MemoryView":478 - * - * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - } - - /* "View.MemoryView":480 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: - */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); - } - - /* "View.MemoryView":483 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< - * - * cdef setitem_indexed(self, index, value): - */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; - } - - /* "View.MemoryView":453 - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":485 - * PyMem_Free(tmp) - * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) - */ - -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); - - /* "View.MemoryView":486 - * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; - - /* "View.MemoryView":487 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":485 - * PyMem_Free(tmp) - * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":489 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":492 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem - * - */ - __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":495 - * cdef bytes bytesitem - * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) - */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":496 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { - - /* "View.MemoryView":497 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError, "Unable to convert item to object" - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - { - PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":496 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - } - - /* "View.MemoryView":501 - * raise ValueError, "Unable to convert item to object" - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - /*else:*/ { - __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) - __pyx_t_10 = (__pyx_t_9 == 1); - if (__pyx_t_10) { - - /* "View.MemoryView":502 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; - - /* "View.MemoryView":501 - * raise ValueError, "Unable to convert item to object" - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - } - - /* "View.MemoryView":503 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":498 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError, "Unable to convert item to object" - * else: - */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_1); - - /* "View.MemoryView":499 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); - __PYX_ERR(1, 499, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - - /* "View.MemoryView":496 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - __pyx_L5_except_error:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; - } - - /* "View.MemoryView":489 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":505 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - char *__pyx_t_9; - char *__pyx_t_10; - char *__pyx_t_11; - char *__pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":508 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue - */ - __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":513 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - if (__pyx_t_2) { - - /* "View.MemoryView":514 - * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":513 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): - */ - /*else*/ { - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_6 = 1; - } - } - { - PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - } - __pyx_L3:; - - /* "View.MemoryView":518 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_7 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(1, 518, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_8 = __pyx_v_bytesvalue; - __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); - __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); - for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { - __pyx_t_9 = __pyx_t_12; - __pyx_v_c = (__pyx_t_9[0]); - - /* "View.MemoryView":519 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - __pyx_v_i = __pyx_t_7; - - /* "View.MemoryView":518 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_7 = (__pyx_t_7 + 1); - - /* "View.MemoryView":519 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "View.MemoryView":505 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":521 - * itemp[i] = c - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - */ - -/* Python wrapper */ -CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - char *__pyx_t_4; - void *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (unlikely(__pyx_v_info == NULL)) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":523 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":524 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); - __PYX_ERR(1, 524, __pyx_L1_error) - - /* "View.MemoryView":523 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - */ - } - - /* "View.MemoryView":526 - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":527 - * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL - */ - __pyx_t_3 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_3; - - /* "View.MemoryView":526 - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":529 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_STRIDES: - */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; - - /* "View.MemoryView":531 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":532 - * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL - */ - __pyx_t_3 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_3; - - /* "View.MemoryView":531 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - goto __pyx_L7; - } - - /* "View.MemoryView":534 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_INDIRECT: - */ - /*else*/ { - __pyx_v_info->strides = NULL; - } - __pyx_L7:; - - /* "View.MemoryView":536 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":537 - * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL - */ - __pyx_t_3 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_3; - - /* "View.MemoryView":536 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":539 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: - */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; - - /* "View.MemoryView":541 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":542 - * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL - */ - __pyx_t_4 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_4; - - /* "View.MemoryView":541 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":544 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< - * - * info.buf = self.view.buf - */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; - - /* "View.MemoryView":546 - * info.format = NULL - * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - */ - __pyx_t_5 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_5; - - /* "View.MemoryView":547 - * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len - */ - __pyx_t_6 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_6; - - /* "View.MemoryView":548 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly - */ - __pyx_t_7 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_7; - - /* "View.MemoryView":549 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self - */ - __pyx_t_7 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_7; - - /* "View.MemoryView":550 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self - * - */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; - - /* "View.MemoryView":551 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF((PyObject *)__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_v_self); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "View.MemoryView":521 - * itemp[i] = c - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":554 - * - * - * @property # <<<<<<<<<<<<<< - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result - */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":554 - * - * - * @property # <<<<<<<<<<<<<< - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":560 - * return result - * - * @property # <<<<<<<<<<<<<< - * def base(self): - * return self._get_base() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":562 - * @property - * def base(self): - * return self._get_base() # <<<<<<<<<<<<<< - * - * cdef _get_base(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":560 - * return result - * - * @property # <<<<<<<<<<<<<< - * def base(self): - * return self._get_base() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":564 - * return self._get_base() - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - -static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_base", 0); - - /* "View.MemoryView":565 - * - * cdef _get_base(self): - * return self.obj # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; - - /* "View.MemoryView":564 - * return self._get_base() - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":567 - * return self.obj - * - * @property # <<<<<<<<<<<<<< - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_7genexpr__pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":569 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } /* exit inner scope */ - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "View.MemoryView":567 - * return self.obj - * - * @property # <<<<<<<<<<<<<< - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":571 - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def strides(self): - * if self.view.strides == NULL: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_8genexpr1__pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":573 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError, "Buffer view does not expose strides" - */ - __pyx_t_1 = (__pyx_v_self->view.strides == NULL); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":575 - * if self.view.strides == NULL: - * - * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); - __PYX_ERR(1, 575, __pyx_L1_error) - - /* "View.MemoryView":573 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError, "Buffer view does not expose strides" - */ - } - - /* "View.MemoryView":577 - * raise ValueError, "Buffer view does not expose strides" - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } /* exit inner scope */ - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "View.MemoryView":571 - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def strides(self): - * if self.view.strides == NULL: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":579 - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def suboffsets(self): - * if self.view.suboffsets == NULL: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":581 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * - */ - __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":582 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":581 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * - */ - } - - /* "View.MemoryView":584 - * return (-1,) * self.view.ndim - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } /* exit inner scope */ - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "View.MemoryView":579 - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def suboffsets(self): - * if self.view.suboffsets == NULL: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":586 - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def ndim(self): - * return self.view.ndim - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":588 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":586 - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def ndim(self): - * return self.view.ndim - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":590 - * return self.view.ndim - * - * @property # <<<<<<<<<<<<<< - * def itemsize(self): - * return self.view.itemsize - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":592 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":590 - * return self.view.ndim - * - * @property # <<<<<<<<<<<<<< - * def itemsize(self): - * return self.view.itemsize - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":594 - * return self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def nbytes(self): - * return self.size * self.view.itemsize - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":596 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":594 - * return self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def nbytes(self): - * return self.size * self.view.itemsize - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":598 - * return self.size * self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def size(self): - * if self._size is None: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":600 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * - */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":601 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< - * - * for length in self.view.shape[:self.view.ndim]: - */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; - - /* "View.MemoryView":603 - * result = 1 - * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length - * - */ - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); - __pyx_t_5 = 0; - - /* "View.MemoryView":604 - * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< - * - * self._size = result - */ - __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); - __pyx_t_5 = 0; - } - - /* "View.MemoryView":606 - * result *= length - * - * self._size = result # <<<<<<<<<<<<<< - * - * return self._size - */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; - - /* "View.MemoryView":600 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * - */ - } - - /* "View.MemoryView":608 - * self._size = result - * - * return self._size # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; - goto __pyx_L0; - - /* "View.MemoryView":598 - * return self.size * self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def size(self): - * if self._size is None: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":610 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ - -/* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); - - /* "View.MemoryView":611 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * - */ - __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); - if (__pyx_t_1) { - - /* "View.MemoryView":612 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< - * - * return 0 - */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; - - /* "View.MemoryView":611 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * - */ - } - - /* "View.MemoryView":614 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":610 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":616 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":617 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":618 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "View.MemoryView":617 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) - * - */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":616 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":620 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "View.MemoryView":621 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":620 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":624 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); - - /* "View.MemoryView":627 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":628 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< - * - * def is_f_contig(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":624 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":630 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); - - /* "View.MemoryView":633 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":634 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< - * - * def copy(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":630 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":636 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); - - /* "View.MemoryView":638 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< - * - * slice_copy(self, &mslice) - */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - - /* "View.MemoryView":640 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, - */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - - /* "View.MemoryView":641 - * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, - */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":646 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< - * - * def copy_fortran(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":636 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":648 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); - - /* "View.MemoryView":650 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< - * - * slice_copy(self, &src) - */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - - /* "View.MemoryView":652 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, - */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - - /* "View.MemoryView":653 - * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, - */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; - - /* "View.MemoryView":658 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":648 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":662 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - - /* "View.MemoryView":663 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":664 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; - - /* "View.MemoryView":665 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_check') - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":662 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":668 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":669 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o) noexcept: - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":668 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":671 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_idx; - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_UCS4 __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); - - /* "View.MemoryView":677 - * """ - * cdef Py_ssize_t idx - * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< - * - * result = [slice(None)] * ndim - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_index); - if (__pyx_t_2) { - __Pyx_INCREF(((PyObject*)__pyx_v_index)); - __pyx_t_1 = __pyx_v_index; - } else { - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - } - __pyx_v_tup = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":679 - * tup = index if isinstance(index, tuple) else (index,) - * - * result = [slice(None)] * ndim # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__5); - __Pyx_GIVEREF(__pyx_slice__5); - PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5); - } - } - __pyx_v_result = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":680 - * - * result = [slice(None)] * ndim - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * idx = 0 - */ - __pyx_v_have_slices = 0; - - /* "View.MemoryView":681 - * result = [slice(None)] * ndim - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * idx = 0 - * for item in tup: - */ - __pyx_v_seen_ellipsis = 0; - - /* "View.MemoryView":682 - * have_slices = False - * seen_ellipsis = False - * idx = 0 # <<<<<<<<<<<<<< - * for item in tup: - * if item is Ellipsis: - */ - __pyx_v_idx = 0; - - /* "View.MemoryView":683 - * seen_ellipsis = False - * idx = 0 - * for item in tup: # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ - if (unlikely(__pyx_v_tup == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 683, __pyx_L1_error) - } - __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - for (;;) { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":684 - * idx = 0 - * for item in tup: - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * idx += ndim - len(tup) - */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - if (__pyx_t_2) { - - /* "View.MemoryView":685 - * for item in tup: - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * idx += ndim - len(tup) - * seen_ellipsis = True - */ - __pyx_t_2 = (!__pyx_v_seen_ellipsis); - if (__pyx_t_2) { - - /* "View.MemoryView":686 - * if item is Ellipsis: - * if not seen_ellipsis: - * idx += ndim - len(tup) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * have_slices = True - */ - if (unlikely(__pyx_v_tup == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 686, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) - __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); - - /* "View.MemoryView":687 - * if not seen_ellipsis: - * idx += ndim - len(tup) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * have_slices = True - * else: - */ - __pyx_v_seen_ellipsis = 1; - - /* "View.MemoryView":685 - * for item in tup: - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * idx += ndim - len(tup) - * seen_ellipsis = True - */ - } - - /* "View.MemoryView":688 - * idx += ndim - len(tup) - * seen_ellipsis = True - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if isinstance(item, slice): - */ - __pyx_v_have_slices = 1; - - /* "View.MemoryView":684 - * idx = 0 - * for item in tup: - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * idx += ndim - len(tup) - */ - goto __pyx_L5; - } - - /* "View.MemoryView":690 - * have_slices = True - * else: - * if isinstance(item, slice): # <<<<<<<<<<<<<< - * have_slices = True - * elif not PyIndex_Check(item): - */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - if (__pyx_t_2) { - - /* "View.MemoryView":691 - * else: - * if isinstance(item, slice): - * have_slices = True # <<<<<<<<<<<<<< - * elif not PyIndex_Check(item): - * raise TypeError, f"Cannot index with type '{type(item)}'" - */ - __pyx_v_have_slices = 1; - - /* "View.MemoryView":690 - * have_slices = True - * else: - * if isinstance(item, slice): # <<<<<<<<<<<<<< - * have_slices = True - * elif not PyIndex_Check(item): - */ - goto __pyx_L7; - } - - /* "View.MemoryView":692 - * if isinstance(item, slice): - * have_slices = True - * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item - */ - __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":693 - * have_slices = True - * elif not PyIndex_Check(item): - * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< - * result[idx] = item - * idx += 1 - */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = 0; - __pyx_t_6 = 127; - __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); - __pyx_t_5 += 24; - __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_5 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(1, 693, __pyx_L1_error) - - /* "View.MemoryView":692 - * if isinstance(item, slice): - * have_slices = True - * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item - */ - } - __pyx_L7:; - - /* "View.MemoryView":694 - * elif not PyIndex_Check(item): - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item # <<<<<<<<<<<<<< - * idx += 1 - * - */ - if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) - } - __pyx_L5:; - - /* "View.MemoryView":695 - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item - * idx += 1 # <<<<<<<<<<<<<< - * - * nslices = ndim - idx - */ - __pyx_v_idx = (__pyx_v_idx + 1); - - /* "View.MemoryView":683 - * seen_ellipsis = False - * idx = 0 - * for item in tup: # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "View.MemoryView":697 - * idx += 1 - * - * nslices = ndim - idx # <<<<<<<<<<<<<< - * return have_slices or nslices, tuple(result) - * - */ - __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - - /* "View.MemoryView":698 - * - * nslices = ndim - idx - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __pyx_t_7; - __pyx_t_7 = 0; - __pyx_L9_bool_binop_done:; - __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); - __pyx_t_1 = 0; - __pyx_t_7 = 0; - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":671 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":700 - * return have_slices or nslices, tuple(result) - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - */ - -static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - - /* "View.MemoryView":701 - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError, "Indirect dimensions not supported" - */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); - - /* "View.MemoryView":702 - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError, "Indirect dimensions not supported" - * return 0 # return type just used as an error flag - */ - __pyx_t_4 = (__pyx_v_suboffset >= 0); - if (unlikely(__pyx_t_4)) { - - /* "View.MemoryView":703 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< - * return 0 # return type just used as an error flag - * - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); - __PYX_ERR(1, 703, __pyx_L1_error) - - /* "View.MemoryView":702 - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError, "Indirect dimensions not supported" - * return 0 # return type just used as an error flag - */ - } - } - - /* "View.MemoryView":704 - * if suboffset >= 0: - * raise ValueError, "Indirect dimensions not supported" - * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":700 - * return have_slices or nslices, tuple(result) - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":711 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step - */ - -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - Py_ssize_t __pyx_v_cindex; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - struct __pyx_memoryview_obj *__pyx_t_3; - char *__pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":712 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst - */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; - - /* "View.MemoryView":719 - * - * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< - * - * cdef _memoryviewslice memviewsliceobj - */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - - /* "View.MemoryView":723 - * cdef _memoryviewslice memviewsliceobj - * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(__pyx_assertions_enabled())) { - __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); - if (unlikely(!__pyx_t_1)) { - __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); - __PYX_ERR(1, 723, __pyx_L1_error) - } - } - #else - if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) - #endif - - /* "View.MemoryView":725 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":726 - * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: - */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) - __pyx_t_2 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":727 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) - */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - - /* "View.MemoryView":725 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice - */ - goto __pyx_L3; - } - - /* "View.MemoryView":729 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src - * - */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - - /* "View.MemoryView":730 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; - - /* "View.MemoryView":736 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data - * - */ - __pyx_t_3 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_3; - - /* "View.MemoryView":737 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_4; - - /* "View.MemoryView":742 - * - * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step, cindex - */ - __pyx_v_p_dst = (&__pyx_v_dst); - - /* "View.MemoryView":743 - * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step, cindex - * cdef bint have_start, have_stop, have_step - */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - - /* "View.MemoryView":747 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * cindex = index - */ - __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } - } else { - __pyx_t_8 = __pyx_t_7(__pyx_t_2); - if (unlikely(!__pyx_t_8)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 747, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_v_dim = __pyx_t_5; - __pyx_t_5 = (__pyx_t_5 + 1); - - /* "View.MemoryView":748 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * cindex = index - * slice_memviewslice( - */ - __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":749 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * cindex = index # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - */ - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) - __pyx_v_cindex = __pyx_t_9; - - /* "View.MemoryView":750 - * if PyIndex_Check(index): - * cindex = index - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - */ - __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) - - /* "View.MemoryView":748 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * cindex = index - * slice_memviewslice( - */ - goto __pyx_L6; - } - - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - */ - __pyx_t_1 = (__pyx_v_index == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 - */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: - */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - */ - goto __pyx_L6; - } - - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 - */ - /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) - __pyx_t_9 = __pyx_t_11; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_9 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_9; - - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 - * - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) - __pyx_t_9 = __pyx_t_11; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_9 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_9; - - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< - * - * have_start = index.start is not None - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) - __pyx_t_9 = __pyx_t_11; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_9 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_9; - - /* "View.MemoryView":766 - * step = index.step or 0 - * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = (__pyx_t_8 != Py_None); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_have_start = __pyx_t_1; - - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None - * - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = (__pyx_t_8 != Py_None); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_have_stop = __pyx_t_1; - - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< - * - * slice_memviewslice( - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = (__pyx_t_8 != Py_None); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_have_step = __pyx_t_1; - - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - */ - __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) - - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; - - /* "View.MemoryView":747 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * cindex = index - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __Pyx_XDECREF((PyObject *)__pyx_r); - - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } - - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - } - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - /*else*/ { - __Pyx_XDECREF((PyObject *)__pyx_r); - - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "View.MemoryView":711 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":793 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":813 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: - */ - __pyx_t_1 = (!__pyx_v_is_slice); - if (__pyx_t_1) { - - /* "View.MemoryView":815 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - __pyx_t_1 = (__pyx_v_start < 0); - if (__pyx_t_1) { - - /* "View.MemoryView":816 - * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - - /* "View.MemoryView":815 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - } - - /* "View.MemoryView":817 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) - * else: - */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = (!__pyx_t_1); - if (__pyx_t_2) { - - /* "View.MemoryView":818 - * start += shape - * if not 0 <= start < shape: - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * - */ - __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) - - /* "View.MemoryView":817 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) - * else: - */ - } - - /* "View.MemoryView":813 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":821 - * else: - * - * if have_step: # <<<<<<<<<<<<<< - * negative_step = step < 0 - * if step == 0: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_have_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":822 - * - * if have_step: - * negative_step = step < 0 # <<<<<<<<<<<<<< - * if step == 0: - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - */ - __pyx_v_negative_step = (__pyx_v_step < 0); - - /* "View.MemoryView":823 - * if have_step: - * negative_step = step < 0 - * if step == 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - * else: - */ - __pyx_t_2 = (__pyx_v_step == 0); - if (__pyx_t_2) { - - /* "View.MemoryView":824 - * negative_step = step < 0 - * if step == 0: - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * negative_step = False - */ - __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - - /* "View.MemoryView":823 - * if have_step: - * negative_step = step < 0 - * if step == 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - * else: - */ - } - - /* "View.MemoryView":821 - * else: - * - * if have_step: # <<<<<<<<<<<<<< - * negative_step = step < 0 - * if step == 0: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":826 - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - * else: - * negative_step = False # <<<<<<<<<<<<<< - * step = 1 - * - */ - /*else*/ { - __pyx_v_negative_step = 0; - - /* "View.MemoryView":827 - * else: - * negative_step = False - * step = 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_step = 1; - } - __pyx_L6:; - - /* "View.MemoryView":830 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":831 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: - */ - __pyx_t_2 = (__pyx_v_start < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":832 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: - */ - __pyx_t_2 = (__pyx_v_start < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":834 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: - */ - __pyx_v_start = 0; - - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: - */ - } - - /* "View.MemoryView":831 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":835 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ - __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); - if (__pyx_t_2) { - - /* "View.MemoryView":836 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - if (__pyx_v_negative_step) { - - /* "View.MemoryView":837 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":836 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - goto __pyx_L11; - } - - /* "View.MemoryView":839 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L11:; - - /* "View.MemoryView":835 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ - } - __pyx_L9:; - - /* "View.MemoryView":830 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - goto __pyx_L8; - } - - /* "View.MemoryView":841 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - /*else*/ { - if (__pyx_v_negative_step) { - - /* "View.MemoryView":842 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":841 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - goto __pyx_L12; - } - - /* "View.MemoryView":844 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< - * - * if have_stop: - */ - /*else*/ { - __pyx_v_start = 0; - } - __pyx_L12:; - } - __pyx_L8:; - - /* "View.MemoryView":846 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":847 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - __pyx_t_2 = (__pyx_v_stop < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":848 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 - */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - - /* "View.MemoryView":849 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - __pyx_t_2 = (__pyx_v_stop < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":850 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape - */ - __pyx_v_stop = 0; - - /* "View.MemoryView":849 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - } - - /* "View.MemoryView":847 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - goto __pyx_L14; - } - - /* "View.MemoryView":851 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); - if (__pyx_t_2) { - - /* "View.MemoryView":852 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - __pyx_v_stop = __pyx_v_shape; - - /* "View.MemoryView":851 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - } - __pyx_L14:; - - /* "View.MemoryView":846 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - goto __pyx_L13; - } - - /* "View.MemoryView":854 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - if (__pyx_v_negative_step) { - - /* "View.MemoryView":855 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape - */ - __pyx_v_stop = -1L; - - /* "View.MemoryView":854 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - goto __pyx_L16; - } - - /* "View.MemoryView":857 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; - } - __pyx_L16:; - } - __pyx_L13:; - - /* "View.MemoryView":861 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< - * - * if (stop - start) - step * new_shape: - */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - - /* "View.MemoryView":863 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":864 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< - * - * if new_shape < 0: - */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); - - /* "View.MemoryView":863 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - } - - /* "View.MemoryView":866 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * - */ - __pyx_t_2 = (__pyx_v_new_shape < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":867 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_new_shape = 0; - - /* "View.MemoryView":866 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * - */ - } - - /* "View.MemoryView":870 - * - * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset - */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - - /* "View.MemoryView":871 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset - * - */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - - /* "View.MemoryView":872 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; - } - __pyx_L3:; - - /* "View.MemoryView":875 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":876 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride - */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - - /* "View.MemoryView":875 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - goto __pyx_L19; - } - - /* "View.MemoryView":878 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< - * - * if suboffset >= 0: - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L19:; - - /* "View.MemoryView":880 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: - */ - __pyx_t_2 = (__pyx_v_suboffset >= 0); - if (__pyx_t_2) { - - /* "View.MemoryView":881 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - __pyx_t_2 = (!__pyx_v_is_slice); - if (__pyx_t_2) { - - /* "View.MemoryView":882 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - __pyx_t_2 = (__pyx_v_new_ndim == 0); - if (__pyx_t_2) { - - /* "View.MemoryView":883 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " - */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":882 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - goto __pyx_L22; - } - - /* "View.MemoryView":885 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: - */ - /*else*/ { - - /* "View.MemoryView":886 - * else: - * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim - */ - __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) - } - __pyx_L22:; - - /* "View.MemoryView":881 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - goto __pyx_L21; - } - - /* "View.MemoryView":888 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< - * - * return 0 - */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L21:; - - /* "View.MemoryView":880 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: - */ - } - - /* "View.MemoryView":890 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":793 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":896 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_UCS4 __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); - - /* "View.MemoryView":898 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp - */ - __pyx_v_suboffset = -1L; - - /* "View.MemoryView":899 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp - * - */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":902 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len // itemsize - * stride = itemsize - */ - __pyx_t_2 = (__pyx_v_view->ndim == 0); - if (__pyx_t_2) { - - /* "View.MemoryView":903 - * - * if view.ndim == 0: - * shape = view.len // itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(1, 903, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(1, 903, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - - /* "View.MemoryView":904 - * if view.ndim == 0: - * shape = view.len // itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] - */ - __pyx_v_stride = __pyx_v_itemsize; - - /* "View.MemoryView":902 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len // itemsize - * stride = itemsize - */ - goto __pyx_L3; - } - - /* "View.MemoryView":906 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: - */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - - /* "View.MemoryView":907 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] - */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - - /* "View.MemoryView":908 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * - */ - __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); - if (__pyx_t_2) { - - /* "View.MemoryView":909 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: - */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - - /* "View.MemoryView":908 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * - */ - } - } - __pyx_L3:; - - /* "View.MemoryView":911 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - __pyx_t_2 = (__pyx_v_index < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":912 - * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - - /* "View.MemoryView":913 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - __pyx_t_2 = (__pyx_v_index < 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":914 - * index += view.shape[dim] - * if index < 0: - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< - * - * if index >= shape: - */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_4 = 127; - __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_1 += 37; - __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_kp_u__7); - __pyx_t_1 += 1; - __Pyx_GIVEREF(__pyx_kp_u__7); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(1, 914, __pyx_L1_error) - - /* "View.MemoryView":913 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - } - - /* "View.MemoryView":911 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - } - - /* "View.MemoryView":916 - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":917 - * - * if index >= shape: - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride - */ - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = 0; - __pyx_t_4 = 127; - __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_1 += 37; - __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_kp_u__7); - __pyx_t_1 += 1; - __Pyx_GIVEREF(__pyx_kp_u__7); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 917, __pyx_L1_error) - - /* "View.MemoryView":916 - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - } - - /* "View.MemoryView":919 - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset - */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - - /* "View.MemoryView":920 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * - */ - __pyx_t_2 = (__pyx_v_suboffset >= 0); - if (__pyx_t_2) { - - /* "View.MemoryView":921 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< - * - * return resultp - */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":920 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * - */ - } - - /* "View.MemoryView":923 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; - - /* "View.MemoryView":896 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":929 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * - */ - -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":930 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< - * - * cdef Py_ssize_t *shape = memslice.shape - */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; - - /* "View.MemoryView":932 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides - * - */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; - - /* "View.MemoryView":933 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; - - /* "View.MemoryView":937 - * - * cdef int i, j - * for i in range(ndim // 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":938 - * cdef int i, j - * for i in range(ndim // 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] - */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - - /* "View.MemoryView":939 - * for i in range(ndim // 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] - * - */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - - /* "View.MemoryView":940 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - - /* "View.MemoryView":942 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") - * - */ - __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { - - /* "View.MemoryView":943 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< - * - * return 0 - */ - __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - - /* "View.MemoryView":942 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") - * - */ - } - } - - /* "View.MemoryView":945 - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":929 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":963 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - */ - -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":964 - * - * def __dealloc__(self): - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - - /* "View.MemoryView":963 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":966 - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ - -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":967 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":968 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":967 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - } - - /* "View.MemoryView":970 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "View.MemoryView":966 - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":972 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) - */ - -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":973 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: - */ - __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":974 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) - */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) - - /* "View.MemoryView":973 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":976 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< - * - * cdef _get_base(self): - */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; - - /* "View.MemoryView":972 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":978 - * memoryview.assign_item_from_object(self, itemp, value) - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.from_object - * - */ - -static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_base", 0); - - /* "View.MemoryView":979 - * - * cdef _get_base(self): - * return self.from_object # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; - - /* "View.MemoryView":978 - * memoryview.assign_item_from_object(self, itemp, value) - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.from_object - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":999 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - - /* "View.MemoryView":1007 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":1008 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "View.MemoryView":1007 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ - } - - /* "View.MemoryView":1013 - * - * - * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1015 - * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; - - /* "View.MemoryView":1016 - * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< - * - * result.from_object = ( memviewslice.memview)._get_base() - */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - - /* "View.MemoryView":1018 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo - * - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; - - /* "View.MemoryView":1019 - * - * result.from_object = ( memviewslice.memview)._get_base() - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< - * - * result.view = memviewslice.memview.view - */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - - /* "View.MemoryView":1021 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; - - /* "View.MemoryView":1022 - * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - - /* "View.MemoryView":1023 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - - /* "View.MemoryView":1024 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - - /* "View.MemoryView":1025 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - */ - Py_INCREF(Py_None); - - /* "View.MemoryView":1027 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: - */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1028 - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO - */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - - /* "View.MemoryView":1027 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: - */ - goto __pyx_L4; - } - - /* "View.MemoryView":1030 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< - * - * result.view.shape = result.from_slice.shape - */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; - } - __pyx_L4:; - - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * - */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - - /* "View.MemoryView":1033 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - - /* "View.MemoryView":1036 - * - * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; - - /* "View.MemoryView":1037 - * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); - - /* "View.MemoryView":1038 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ - __pyx_t_1 = (__pyx_v_suboffset >= 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1039 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - - /* "View.MemoryView":1040 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< - * - * result.view.len = result.view.itemsize - */ - goto __pyx_L6_break; - - /* "View.MemoryView":1038 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ - } - } - __pyx_L6_break:; - - /* "View.MemoryView":1042 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length - */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - - /* "View.MemoryView":1043 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * - */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1044 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func - */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - } - - /* "View.MemoryView":1046 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func - * - */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; - - /* "View.MemoryView":1047 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - - /* "View.MemoryView":1049 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":999 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1052 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - */ - -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - - /* "View.MemoryView":1055 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":1056 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: - */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) - __pyx_t_2 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1057 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) - */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; - - /* "View.MemoryView":1055 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice - */ - } - - /* "View.MemoryView":1059 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice - * - */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - - /* "View.MemoryView":1060 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_slice_copy') - */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; - } - - /* "View.MemoryView":1052 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1063 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ - -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); - - /* "View.MemoryView":1067 - * cdef (Py_ssize_t*) shape, strides, suboffsets - * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets - */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; - - /* "View.MemoryView":1068 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets - * - */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; - - /* "View.MemoryView":1069 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview - */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; - - /* "View.MemoryView":1071 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf - * - */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - - /* "View.MemoryView":1072 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): - */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - - /* "View.MemoryView":1074 - * dst.data = memview.view.buf - * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; - - /* "View.MemoryView":1075 - * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - - /* "View.MemoryView":1076 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - * - */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - - /* "View.MemoryView":1077 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_object') - */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; - } - - /* "View.MemoryView":1063 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1080 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - */ - -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); - - /* "View.MemoryView":1083 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) - * - */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - - /* "View.MemoryView":1084 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_object_from_slice') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1080 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1087 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ - -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *(*__pyx_t_2)(char *); - int (*__pyx_t_3)(char *, PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - - /* "View.MemoryView":1094 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":1095 - * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - */ - __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_2; - - /* "View.MemoryView":1096 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL - */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_3; - - /* "View.MemoryView":1094 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1098 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL - * - */ - /*else*/ { - __pyx_v_to_object_func = NULL; - - /* "View.MemoryView":1099 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; - - /* "View.MemoryView":1101 - * to_dtype_func = NULL - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) - */ - __Pyx_XDECREF(__pyx_r); - - /* "View.MemoryView":1103 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1087 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1109 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< - * return -arg if arg < 0 else arg - * - */ - -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - - /* "View.MemoryView":1110 - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: - * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< - * - * @cname('__pyx_get_best_slice_order') - */ - if ((__pyx_v_arg < 0)) { - __pyx_t_1 = (-__pyx_v_arg); - } else { - __pyx_t_1 = __pyx_v_arg; - } - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":1109 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< - * return -arg if arg < 0 else arg - * - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1113 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1118 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * - */ - __pyx_v_c_stride = 0; - - /* "View.MemoryView":1119 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_f_stride = 0; - - /* "View.MemoryView":1121 - * cdef Py_ssize_t f_stride = 0 - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1122 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1123 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1124 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - goto __pyx_L4_break; - - /* "View.MemoryView":1122 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break - */ - } - } - __pyx_L4_break:; - - /* "View.MemoryView":1126 - * break - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1127 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1128 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - */ - goto __pyx_L7_break; - - /* "View.MemoryView":1127 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - } - } - __pyx_L7_break:; - - /* "View.MemoryView":1131 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); - if (__pyx_t_2) { - - /* "View.MemoryView":1132 - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' - */ - __pyx_r = 'C'; - goto __pyx_L0; - - /* "View.MemoryView":1131 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - } - - /* "View.MemoryView":1134 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) - */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; - } - - /* "View.MemoryView":1113 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1137 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, - */ - -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - - /* "View.MemoryView":1144 - * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); - - /* "View.MemoryView":1145 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] - */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - - /* "View.MemoryView":1146 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); - - /* "View.MemoryView":1147 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - - /* "View.MemoryView":1149 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - __pyx_t_1 = (__pyx_v_ndim == 1); - if (__pyx_t_1) { - - /* "View.MemoryView":1150 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - __pyx_t_2 = (__pyx_v_src_stride > 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_dst_stride > 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - - /* "View.MemoryView":1151 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_1 = __pyx_t_2; - __pyx_L5_bool_binop_done:; - - /* "View.MemoryView":1150 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - if (__pyx_t_1) { - - /* "View.MemoryView":1152 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): - */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - - /* "View.MemoryView":1150 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - goto __pyx_L4; - } - - /* "View.MemoryView":1154 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - */ - /*else*/ { - __pyx_t_3 = __pyx_v_dst_extent; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "View.MemoryView":1155 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride - */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - - /* "View.MemoryView":1156 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - - /* "View.MemoryView":1157 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): - */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; - - /* "View.MemoryView":1149 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1159 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, - */ - /*else*/ { - __pyx_t_3 = __pyx_v_dst_extent; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, - */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - - /* "View.MemoryView":1164 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - - /* "View.MemoryView":1165 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, - */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1137 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, - */ - - /* function exit code */ -} - -/* "View.MemoryView":1167 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) noexcept nogil: - */ - -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1170 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) noexcept nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) - * - */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1167 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) noexcept nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1174 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - */ - -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1176 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< - * - * for shape in src.shape[:ndim]: - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; - - /* "View.MemoryView":1178 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape - * - */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); - - /* "View.MemoryView":1179 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< - * - * return size - */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } - - /* "View.MemoryView":1181 - * size *= shape - * - * return size # <<<<<<<<<<<<<< - * - * @cname('__pyx_fill_contig_strides_array') - */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; - - /* "View.MemoryView":1174 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1184 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) noexcept nogil: - */ - -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1193 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - __pyx_t_1 = (__pyx_v_order == 'F'); - if (__pyx_t_1) { - - /* "View.MemoryView":1194 - * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; - - /* "View.MemoryView":1195 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: - */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - - /* "View.MemoryView":1196 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): - */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - - /* "View.MemoryView":1193 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1198 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; - - /* "View.MemoryView":1199 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * - */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - - /* "View.MemoryView":1200 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * - * return stride - */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; - - /* "View.MemoryView":1202 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_data_to_temp') - */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; - - /* "View.MemoryView":1184 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) noexcept nogil: - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1205 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, - */ - -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":1216 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1217 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< - * - * result = malloc(size) - */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - - /* "View.MemoryView":1219 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err_no_memory() - */ - __pyx_v_result = malloc(__pyx_v_size); - - /* "View.MemoryView":1220 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err_no_memory() - * - */ - __pyx_t_2 = (!(__pyx_v_result != 0)); - if (__pyx_t_2) { - - /* "View.MemoryView":1221 - * result = malloc(size) - * if not result: - * _err_no_memory() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - - /* "View.MemoryView":1220 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err_no_memory() - * - */ - } - - /* "View.MemoryView":1224 - * - * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): - */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - - /* "View.MemoryView":1225 - * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - - /* "View.MemoryView":1226 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1227 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 - * - */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - - /* "View.MemoryView":1228 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) - */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } - - /* "View.MemoryView":1230 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< - * - * - */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - - /* "View.MemoryView":1233 - * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1234 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * - */ - __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1235 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): - */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - - /* "View.MemoryView":1234 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * - */ - } - } - - /* "View.MemoryView":1237 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1238 - * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - - /* "View.MemoryView":1237 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":1240 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< - * - * return result - */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); - } - __pyx_L9:; - - /* "View.MemoryView":1242 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "View.MemoryView":1205 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1247 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" - */ - -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - Py_UCS4 __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); - - /* "View.MemoryView":1249 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_dim') - */ - __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = 0; - __pyx_t_3 = 127; - __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); - __pyx_t_2 += 35; - __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); - __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u_got); - __pyx_t_2 += 6; - __Pyx_GIVEREF(__pyx_kp_u_got); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); - __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u_and); - __pyx_t_2 += 5; - __Pyx_GIVEREF(__pyx_kp_u_and); - PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); - __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u__7); - __pyx_t_2 += 1; - __Pyx_GIVEREF(__pyx_kp_u__7); - PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 1249, __pyx_L1_error) - - /* "View.MemoryView":1247 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1252 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg % dim - * - */ - -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_msg); - - /* "View.MemoryView":1253 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: - * raise error, msg % dim # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 1253, __pyx_L1_error) - - /* "View.MemoryView":1252 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg % dim - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_msg); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1256 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg - * - */ - -static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_msg); - - /* "View.MemoryView":1257 - * @cname('__pyx_memoryview_err') - * cdef int _err(PyObject *error, str msg) except -1 with gil: - * raise error, msg # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_no_memory') - */ - __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); - __PYX_ERR(1, 1257, __pyx_L1_error) - - /* "View.MemoryView":1256 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_msg); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1260 - * - * @cname('__pyx_memoryview_err_no_memory') - * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - -static int __pyx_memoryview_err_no_memory(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_no_memory", 0); - - /* "View.MemoryView":1261 - * @cname('__pyx_memoryview_err_no_memory') - * cdef int _err_no_memory() except -1 with gil: - * raise MemoryError # <<<<<<<<<<<<<< - * - * - */ - PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - - /* "View.MemoryView":1260 - * - * @cname('__pyx_memoryview_err_no_memory') - * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1265 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; - int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":1273 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; - - /* "View.MemoryView":1274 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1276 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False - */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - - /* "View.MemoryView":1277 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp - */ - __pyx_v_broadcasting = 0; - - /* "View.MemoryView":1278 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp - * - */ - __pyx_v_direct_copy = 0; - - /* "View.MemoryView":1281 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1282 - * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - - /* "View.MemoryView":1281 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1283 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1284 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< - * - * cdef int ndim = max(src_ndim, dst_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - - /* "View.MemoryView":1283 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - } - __pyx_L3:; - - /* "View.MemoryView":1286 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if ((__pyx_t_3 > __pyx_t_4)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_ndim = __pyx_t_5; - - /* "View.MemoryView":1288 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1289 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True - */ - __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); - if (__pyx_t_2) { - - /* "View.MemoryView":1290 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 - */ - __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1291 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: - */ - __pyx_v_broadcasting = 1; - - /* "View.MemoryView":1292 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) - */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; - - /* "View.MemoryView":1290 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 - */ - goto __pyx_L7; - } - - /* "View.MemoryView":1294 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: - */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) - } - __pyx_L7:; - - /* "View.MemoryView":1289 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True - */ - } - - /* "View.MemoryView":1296 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - */ - __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1297 - * - * if src.suboffsets[i] >= 0: - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< - * - * if slices_overlap(&src, &dst, ndim, itemsize): - */ - __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - - /* "View.MemoryView":1296 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - */ - } - } - - /* "View.MemoryView":1299 - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - if (__pyx_t_2) { - - /* "View.MemoryView":1301 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ - __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); - if (__pyx_t_2) { - - /* "View.MemoryView":1302 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - - /* "View.MemoryView":1301 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ - } - - /* "View.MemoryView":1304 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * - */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; - - /* "View.MemoryView":1305 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< - * - * if not broadcasting: - */ - __pyx_v_src = __pyx_v_tmp; - - /* "View.MemoryView":1299 - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - } - - /* "View.MemoryView":1307 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = (!__pyx_v_broadcasting); - if (__pyx_t_2) { - - /* "View.MemoryView":1310 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - */ - __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1311 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) - */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - - /* "View.MemoryView":1310 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - */ - goto __pyx_L12; - } - - /* "View.MemoryView":1312 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - */ - __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1313 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< - * - * if direct_copy: - */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - - /* "View.MemoryView":1312 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - */ - } - __pyx_L12:; - - /* "View.MemoryView":1315 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - */ - if (__pyx_v_direct_copy) { - - /* "View.MemoryView":1317 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1318 - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * free(tmpdata) - */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - - /* "View.MemoryView":1319 - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1320 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1321 - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * if order == 'F' == get_best_order(&dst, ndim): - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":1315 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - */ - } - - /* "View.MemoryView":1307 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":1323 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); - } - if (__pyx_t_2) { - - /* "View.MemoryView":1326 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - - /* "View.MemoryView":1327 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - - /* "View.MemoryView":1323 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":1329 - * transpose_memslice(&dst) - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1330 - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * - */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1331 - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< - * - * free(tmpdata) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1333 - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1334 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_broadcast_leading') - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":1265 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1337 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) noexcept nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - - /* "View.MemoryView":1341 - * int ndim_other) noexcept nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - - /* "View.MemoryView":1343 - * cdef int offset = ndim_other - ndim - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1344 - * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - - /* "View.MemoryView":1345 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1346 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): - */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } - - /* "View.MemoryView":1348 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1349 - * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 - */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - - /* "View.MemoryView":1350 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 - * - */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - - /* "View.MemoryView":1351 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; - } - - /* "View.MemoryView":1337 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) noexcept nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1359 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< - * - * if dtype_is_object: - */ - -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - - /* "View.MemoryView":1361 - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) - * - */ - if (__pyx_v_dtype_is_object) { - - /* "View.MemoryView":1362 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1361 - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) - * - */ - } - - /* "View.MemoryView":1359 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< - * - * if dtype_is_object: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1365 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) noexcept with gil: - */ - -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1368 - * Py_ssize_t *strides, int ndim, - * bint inc) noexcept with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1365 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) noexcept with gil: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif -} - -/* "View.MemoryView":1371 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc) noexcept: - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - - /* "View.MemoryView":1374 - * Py_ssize_t *strides, int ndim, bint inc) noexcept: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * - * for i in range(shape[0]): - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1376 - * cdef Py_ssize_t stride = strides[0] - * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: - */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1377 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - __pyx_t_4 = (__pyx_v_ndim == 1); - if (__pyx_t_4) { - - /* "View.MemoryView":1378 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - if (__pyx_v_inc) { - - /* "View.MemoryView":1379 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) - */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); - - /* "View.MemoryView":1378 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":1381 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) - */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; - - /* "View.MemoryView":1377 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - goto __pyx_L5; - } - - /* "View.MemoryView":1383 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< - * - * data += stride - */ - /*else*/ { - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; - - /* "View.MemoryView":1385 - * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) - * - * data += stride # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - - /* "View.MemoryView":1371 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc) noexcept: - * cdef Py_ssize_t i - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) noexcept nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1394 - * size_t itemsize, void *item, - * bint dtype_is_object) noexcept nogil: - * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, inc=True) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1395 - * bint dtype_is_object) noexcept nogil: - * refcount_copying(dst, dtype_is_object, ndim, inc=False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< - * refcount_copying(dst, dtype_is_object, ndim, inc=True) - * - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1396 - * refcount_copying(dst, dtype_is_object, ndim, inc=False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< - * - * - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) noexcept nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1400 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) noexcept nogil: - */ - -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1404 - * size_t itemsize, void *item) noexcept nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] - * - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1405 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_extent = (__pyx_v_shape[0]); - - /* "View.MemoryView":1407 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - __pyx_t_1 = (__pyx_v_ndim == 1); - if (__pyx_t_1) { - - /* "View.MemoryView":1408 - * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1409 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - - /* "View.MemoryView":1410 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - - /* "View.MemoryView":1407 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1412 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) - * data += stride - */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1413 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< - * data += stride - * - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1414 - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1400 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) noexcept nogil: - */ - - /* function exit code */ -} - -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 3)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "(tree fragment)":6 - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - */ - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - */ - } - - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_v___pyx_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - __pyx_t_2 = (__pyx_v___pyx_state != Py_None); - if (__pyx_t_2) { - - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - } - - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 > 1); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_2 = __pyx_t_4; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; - } - } - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - } - - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ - -static void __pyx_f_15monotonic_align_4core_maximum_path_each(__Pyx_memviewslice __pyx_v_path, __Pyx_memviewslice __pyx_v_value, int __pyx_v_t_y, int __pyx_v_t_x, struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each *__pyx_optional_args) { - float __pyx_v_max_neg_val = __pyx_k__9; - int __pyx_v_x; - int __pyx_v_y; - float __pyx_v_v_prev; - float __pyx_v_v_cur; - int __pyx_v_index; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - long __pyx_t_4; - int __pyx_t_5; - long __pyx_t_6; - long __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - float __pyx_t_11; - float __pyx_t_12; - float __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_max_neg_val = __pyx_optional_args->max_neg_val; - } - } - - /* "monotonic_align/core.pyx":13 - * cdef float v_cur - * cdef float tmp - * cdef int index = t_x - 1 # <<<<<<<<<<<<<< - * - * for y in range(t_y): - */ - __pyx_v_index = (__pyx_v_t_x - 1); - - /* "monotonic_align/core.pyx":15 - * cdef int index = t_x - 1 - * - * for y in range(t_y): # <<<<<<<<<<<<<< - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: - */ - __pyx_t_1 = __pyx_v_t_y; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_y = __pyx_t_3; - - /* "monotonic_align/core.pyx":16 - * - * for y in range(t_y): - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): # <<<<<<<<<<<<<< - * if x == y: - * v_cur = max_neg_val - */ - __pyx_t_4 = (__pyx_v_y + 1); - __pyx_t_5 = __pyx_v_t_x; - if ((__pyx_t_4 < __pyx_t_5)) { - __pyx_t_6 = __pyx_t_4; - } else { - __pyx_t_6 = __pyx_t_5; - } - __pyx_t_4 = __pyx_t_6; - __pyx_t_5 = ((__pyx_v_t_x + __pyx_v_y) - __pyx_v_t_y); - __pyx_t_6 = 0; - if ((__pyx_t_5 > __pyx_t_6)) { - __pyx_t_7 = __pyx_t_5; - } else { - __pyx_t_7 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_4; - for (__pyx_t_5 = __pyx_t_7; __pyx_t_5 < __pyx_t_6; __pyx_t_5+=1) { - __pyx_v_x = __pyx_t_5; - - /* "monotonic_align/core.pyx":17 - * for y in range(t_y): - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: # <<<<<<<<<<<<<< - * v_cur = max_neg_val - * else: - */ - __pyx_t_8 = (__pyx_v_x == __pyx_v_y); - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":18 - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: - * v_cur = max_neg_val # <<<<<<<<<<<<<< - * else: - * v_cur = value[y-1, x] - */ - __pyx_v_v_cur = __pyx_v_max_neg_val; - - /* "monotonic_align/core.pyx":17 - * for y in range(t_y): - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: # <<<<<<<<<<<<<< - * v_cur = max_neg_val - * else: - */ - goto __pyx_L7; - } - - /* "monotonic_align/core.pyx":20 - * v_cur = max_neg_val - * else: - * v_cur = value[y-1, x] # <<<<<<<<<<<<<< - * if x == 0: - * if y == 0: - */ - /*else*/ { - __pyx_t_9 = (__pyx_v_y - 1); - __pyx_t_10 = __pyx_v_x; - __pyx_v_v_cur = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_9 * __pyx_v_value.strides[0]) )) + __pyx_t_10)) ))); - } - __pyx_L7:; - - /* "monotonic_align/core.pyx":21 - * else: - * v_cur = value[y-1, x] - * if x == 0: # <<<<<<<<<<<<<< - * if y == 0: - * v_prev = 0. - */ - __pyx_t_8 = (__pyx_v_x == 0); - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":22 - * v_cur = value[y-1, x] - * if x == 0: - * if y == 0: # <<<<<<<<<<<<<< - * v_prev = 0. - * else: - */ - __pyx_t_8 = (__pyx_v_y == 0); - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":23 - * if x == 0: - * if y == 0: - * v_prev = 0. # <<<<<<<<<<<<<< - * else: - * v_prev = max_neg_val - */ - __pyx_v_v_prev = 0.; - - /* "monotonic_align/core.pyx":22 - * v_cur = value[y-1, x] - * if x == 0: - * if y == 0: # <<<<<<<<<<<<<< - * v_prev = 0. - * else: - */ - goto __pyx_L9; - } - - /* "monotonic_align/core.pyx":25 - * v_prev = 0. - * else: - * v_prev = max_neg_val # <<<<<<<<<<<<<< - * else: - * v_prev = value[y-1, x-1] - */ - /*else*/ { - __pyx_v_v_prev = __pyx_v_max_neg_val; - } - __pyx_L9:; - - /* "monotonic_align/core.pyx":21 - * else: - * v_cur = value[y-1, x] - * if x == 0: # <<<<<<<<<<<<<< - * if y == 0: - * v_prev = 0. - */ - goto __pyx_L8; - } - - /* "monotonic_align/core.pyx":27 - * v_prev = max_neg_val - * else: - * v_prev = value[y-1, x-1] # <<<<<<<<<<<<<< - * value[y, x] += max(v_prev, v_cur) - * - */ - /*else*/ { - __pyx_t_10 = (__pyx_v_y - 1); - __pyx_t_9 = (__pyx_v_x - 1); - __pyx_v_v_prev = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_10 * __pyx_v_value.strides[0]) )) + __pyx_t_9)) ))); - } - __pyx_L8:; - - /* "monotonic_align/core.pyx":28 - * else: - * v_prev = value[y-1, x-1] - * value[y, x] += max(v_prev, v_cur) # <<<<<<<<<<<<<< - * - * for y in range(t_y - 1, -1, -1): - */ - __pyx_t_11 = __pyx_v_v_cur; - __pyx_t_12 = __pyx_v_v_prev; - if ((__pyx_t_11 > __pyx_t_12)) { - __pyx_t_13 = __pyx_t_11; - } else { - __pyx_t_13 = __pyx_t_12; - } - __pyx_t_9 = __pyx_v_y; - __pyx_t_10 = __pyx_v_x; - *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_9 * __pyx_v_value.strides[0]) )) + __pyx_t_10)) )) += __pyx_t_13; - } - } - - /* "monotonic_align/core.pyx":30 - * value[y, x] += max(v_prev, v_cur) - * - * for y in range(t_y - 1, -1, -1): # <<<<<<<<<<<<<< - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): - */ - for (__pyx_t_1 = (__pyx_v_t_y - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_y = __pyx_t_1; - - /* "monotonic_align/core.pyx":31 - * - * for y in range(t_y - 1, -1, -1): - * path[y, index] = 1 # <<<<<<<<<<<<<< - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): - * index = index - 1 - */ - __pyx_t_10 = __pyx_v_y; - __pyx_t_9 = __pyx_v_index; - *((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_path.data + __pyx_t_10 * __pyx_v_path.strides[0]) )) + __pyx_t_9)) )) = 1; - - /* "monotonic_align/core.pyx":32 - * for y in range(t_y - 1, -1, -1): - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): # <<<<<<<<<<<<<< - * index = index - 1 - * - */ - __pyx_t_14 = (__pyx_v_index != 0); - if (__pyx_t_14) { - } else { - __pyx_t_8 = __pyx_t_14; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_14 = (__pyx_v_index == __pyx_v_y); - if (!__pyx_t_14) { - } else { - __pyx_t_8 = __pyx_t_14; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_9 = (__pyx_v_y - 1); - __pyx_t_10 = __pyx_v_index; - __pyx_t_15 = (__pyx_v_y - 1); - __pyx_t_16 = (__pyx_v_index - 1); - __pyx_t_14 = ((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_9 * __pyx_v_value.strides[0]) )) + __pyx_t_10)) ))) < (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_15 * __pyx_v_value.strides[0]) )) + __pyx_t_16)) )))); - __pyx_t_8 = __pyx_t_14; - __pyx_L13_bool_binop_done:; - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":33 - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): - * index = index - 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_index = (__pyx_v_index - 1); - - /* "monotonic_align/core.pyx":32 - * for y in range(t_y - 1, -1, -1): - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): # <<<<<<<<<<<<<< - * index = index - 1 - * - */ - } - } - - /* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ - - /* function exit code */ -} - -/* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - -static PyObject *__pyx_pw_15monotonic_align_4core_1maximum_path_c(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static void __pyx_f_15monotonic_align_4core_maximum_path_c(__Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs, CYTHON_UNUSED int __pyx_skip_dispatch) { - CYTHON_UNUSED int __pyx_v_b; - int __pyx_v_i; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "monotonic_align/core.pyx":39 - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: - * cdef int b = paths.shape[0] # <<<<<<<<<<<<<< - * cdef int i - * for i in prange(b, nogil=True): - */ - __pyx_v_b = (__pyx_v_paths.shape[0]); - - /* "monotonic_align/core.pyx":41 - * cdef int b = paths.shape[0] - * cdef int i - * for i in prange(b, nogil=True): # <<<<<<<<<<<<<< - * maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i]) - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - _save = NULL; - if (PyGILState_Check()) { - Py_UNBLOCK_THREADS - } - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_b; - { - int __pyx_parallel_temp0 = ((int)0xbad0bad0); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_6, __pyx_t_7) firstprivate(__pyx_t_4, __pyx_t_5) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - - /* "monotonic_align/core.pyx":42 - * cdef int i - * for i in prange(b, nogil=True): - * maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i]) # <<<<<<<<<<<<<< - */ - __pyx_t_4.data = __pyx_v_paths.data; - __pyx_t_4.memview = __pyx_v_paths.memview; - __PYX_INC_MEMVIEW(&__pyx_t_4, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_stride = __pyx_v_paths.strides[0]; - __pyx_t_4.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_4.shape[0] = __pyx_v_paths.shape[1]; -__pyx_t_4.strides[0] = __pyx_v_paths.strides[1]; - __pyx_t_4.suboffsets[0] = -1; - -__pyx_t_4.shape[1] = __pyx_v_paths.shape[2]; -__pyx_t_4.strides[1] = __pyx_v_paths.strides[2]; - __pyx_t_4.suboffsets[1] = -1; - -__pyx_t_5.data = __pyx_v_values.data; - __pyx_t_5.memview = __pyx_v_values.memview; - __PYX_INC_MEMVIEW(&__pyx_t_5, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_stride = __pyx_v_values.strides[0]; - __pyx_t_5.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_5.shape[0] = __pyx_v_values.shape[1]; -__pyx_t_5.strides[0] = __pyx_v_values.strides[1]; - __pyx_t_5.suboffsets[0] = -1; - -__pyx_t_5.shape[1] = __pyx_v_values.shape[2]; -__pyx_t_5.strides[1] = __pyx_v_values.strides[2]; - __pyx_t_5.suboffsets[1] = -1; - -__pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_i; - __pyx_f_15monotonic_align_4core_maximum_path_each(__pyx_t_4, __pyx_t_5, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_t_ys.data) + __pyx_t_6)) ))), (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_t_xs.data) + __pyx_t_7)) ))), NULL); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 42, __pyx_L8_error) - __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 0); - __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL; - __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 0); - __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - goto __pyx_L11; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L10; - __pyx_L10:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates0) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_i; - } - __pyx_L11:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 0); - __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL; - __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 0); - __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_i = __pyx_parallel_temp0; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "monotonic_align/core.pyx":41 - * cdef int b = paths.shape[0] - * cdef int i - * for i in prange(b, nogil=True): # <<<<<<<<<<<<<< - * maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i]) - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - if (_save) { - Py_BLOCK_THREADS - } - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - if (_save) { - Py_BLOCK_THREADS - } - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } - - /* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("monotonic_align.core.maximum_path_c", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_15monotonic_align_4core_1maximum_path_c(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_15monotonic_align_4core_1maximum_path_c = {"maximum_path_c", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15monotonic_align_4core_1maximum_path_c, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15monotonic_align_4core_1maximum_path_c(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - __Pyx_memviewslice __pyx_v_paths = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_values = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_t_ys = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_t_xs = { 0, 0, { 0 }, { 0 }, { 0 } }; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("maximum_path_c (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paths,&__pyx_n_s_values,&__pyx_n_s_t_ys,&__pyx_n_s_t_xs,0}; - PyObject* values[4] = {0,0,0,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_paths)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_values)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, 1); __PYX_ERR(0, 38, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t_ys)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, 2); __PYX_ERR(0, 38, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t_xs)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, 3); __PYX_ERR(0, 38, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "maximum_path_c") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 4)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - } - __pyx_v_paths = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_paths.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_v_values = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_values.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_v_t_ys = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_t_ys.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_v_t_xs = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_t_xs.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_L3_error:; - __PYX_XCLEAR_MEMVIEW(&__pyx_v_paths, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_values, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_ys, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_xs, 1); - __Pyx_AddTraceback("monotonic_align.core.maximum_path_c", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15monotonic_align_4core_maximum_path_c(__pyx_self, __pyx_v_paths, __pyx_v_values, __pyx_v_t_ys, __pyx_v_t_xs); - - /* function exit code */ - __PYX_XCLEAR_MEMVIEW(&__pyx_v_paths, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_values, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_ys, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_xs, 1); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15monotonic_align_4core_maximum_path_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("maximum_path_c", 0); - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_paths.memview)) { __Pyx_RaiseUnboundLocalError("paths"); __PYX_ERR(0, 38, __pyx_L1_error) } - if (unlikely(!__pyx_v_values.memview)) { __Pyx_RaiseUnboundLocalError("values"); __PYX_ERR(0, 38, __pyx_L1_error) } - if (unlikely(!__pyx_v_t_ys.memview)) { __Pyx_RaiseUnboundLocalError("t_ys"); __PYX_ERR(0, 38, __pyx_L1_error) } - if (unlikely(!__pyx_v_t_xs.memview)) { __Pyx_RaiseUnboundLocalError("t_xs"); __PYX_ERR(0, 38, __pyx_L1_error) } - __pyx_f_15monotonic_align_4core_maximum_path_c(__pyx_v_paths, __pyx_v_values, __pyx_v_t_ys, __pyx_v_t_xs, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("monotonic_align.core.maximum_path_c", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_array __pyx_vtable_array; - -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_array___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); - } - else { - __Pyx_TypeName o_type_name; - o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); - __Pyx_DECREF_TypeName(o_type_name); - return -1; - } -} - -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); - } - return v; -} - -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); -} - -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -#if !CYTHON_COMPILING_IN_LIMITED_API - -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; -#endif -static PyType_Slot __pyx_type___pyx_array_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, - {Py_sq_length, (void *)__pyx_array___len__}, - {Py_sq_item, (void *)__pyx_sq_item_array}, - {Py_mp_length, (void *)__pyx_array___len__}, - {Py_mp_subscript, (void *)__pyx_array___getitem__}, - {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, - {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, - #if defined(Py_bf_getbuffer) - {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, - #endif - {Py_tp_methods, (void *)__pyx_methods_array}, - {Py_tp_getset, (void *)__pyx_getsets_array}, - {Py_tp_new, (void *)__pyx_tp_new_array}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_array_spec = { - "monotonic_align.core.array", - sizeof(struct __pyx_array_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, - __pyx_type___pyx_array_slots, -}; -#else - -static PySequenceMethods __pyx_tp_as_sequence_array = { - __pyx_array___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_array = { - __pyx_array___len__, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; - -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""array", /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - __pyx_tp_getattro_array, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_array, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_array, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_array, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif - -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_MemviewEnum_obj *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_MemviewEnum_obj *)o); - p->name = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - if (p->name) { - e = (*v)(p->name, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_Enum(PyObject *o) { - PyObject* tmp; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - tmp = ((PyObject*)p->name); - p->name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { - return __pyx_MemviewEnum___repr__(self); -} - -static PyMethodDef __pyx_methods_Enum[] = { - {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, - {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, - {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, - {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, - {Py_tp_methods, (void *)__pyx_methods_Enum}, - {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, - {Py_tp_new, (void *)__pyx_tp_new_Enum}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { - "monotonic_align.core.Enum", - sizeof(struct __pyx_MemviewEnum_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, - __pyx_type___pyx_MemviewEnum_slots, -}; -#else - -static PyTypeObject __pyx_type___pyx_MemviewEnum = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""Enum", /*tp_name*/ - sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_Enum, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_MemviewEnum___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_Enum, /*tp_traverse*/ - __pyx_tp_clear_Enum, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_Enum, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - __pyx_MemviewEnum___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_Enum, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif -static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; - -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryview_obj *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_memoryview_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_memoryview; - p->obj = Py_None; Py_INCREF(Py_None); - p->_size = Py_None; Py_INCREF(Py_None); - p->_array_interface = Py_None; Py_INCREF(Py_None); - p->view.obj = NULL; - if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryview___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->obj); - Py_CLEAR(p->_size); - Py_CLEAR(p->_array_interface); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - if (p->obj) { - e = (*v)(p->obj, a); if (e) return e; - } - if (p->_size) { - e = (*v)(p->_size, a); if (e) return e; - } - if (p->_array_interface) { - e = (*v)(p->_array_interface, a); if (e) return e; - } - if (p->view.obj) { - e = (*v)(p->view.obj, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_memoryview(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - tmp = ((PyObject*)p->obj); - p->obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_size); - p->_size = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_array_interface); - p->_array_interface = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - Py_CLEAR(p->view.obj); - return 0; -} -static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_memoryview___setitem__(o, i, v); - } - else { - __Pyx_TypeName o_type_name; - o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); - __Pyx_DECREF_TypeName(o_type_name); - return -1; - } -} - -static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); -} - -static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { - return __pyx_memoryview___repr__(self); -} - -static PyMethodDef __pyx_methods_memoryview[] = { - {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, - {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_memoryview[] = { - {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, - {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, - {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, - {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, - {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, - {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, - {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, - {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, - {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -#if !CYTHON_COMPILING_IN_LIMITED_API - -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; -#endif -static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, - {Py_tp_repr, (void *)__pyx_memoryview___repr__}, - {Py_sq_length, (void *)__pyx_memoryview___len__}, - {Py_sq_item, (void *)__pyx_sq_item_memoryview}, - {Py_mp_length, (void *)__pyx_memoryview___len__}, - {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, - {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, - {Py_tp_str, (void *)__pyx_memoryview___str__}, - #if defined(Py_bf_getbuffer) - {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, - #endif - {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, - {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, - {Py_tp_methods, (void *)__pyx_methods_memoryview}, - {Py_tp_getset, (void *)__pyx_getsets_memoryview}, - {Py_tp_new, (void *)__pyx_tp_new_memoryview}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_memoryview_spec = { - "monotonic_align.core.memoryview", - sizeof(struct __pyx_memoryview_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, - __pyx_type___pyx_memoryview_slots, -}; -#else - -static PySequenceMethods __pyx_tp_as_sequence_memoryview = { - __pyx_memoryview___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_memoryview, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_memoryview = { - __pyx_memoryview___len__, /*mp_length*/ - __pyx_memoryview___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; - -static PyTypeObject __pyx_type___pyx_memoryview = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""memoryview", /*tp_name*/ - sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_memoryview___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_memoryview___str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_memoryview, /*tp_traverse*/ - __pyx_tp_clear_memoryview, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_memoryview, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_memoryview, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_memoryview, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif -static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; - -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryviewslice_obj *p; - PyObject *o = __pyx_tp_new_memoryview(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryviewslice_obj *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; - p->from_object = Py_None; Py_INCREF(Py_None); - p->from_slice.memview = NULL; - return o; -} - -static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryviewslice___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->from_object); - PyObject_GC_Track(o); - __pyx_tp_dealloc_memoryview(o); -} - -static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; - if (p->from_object) { - e = (*v)(p->from_object, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - __pyx_tp_clear_memoryview(o); - tmp = ((PyObject*)p->from_object); - p->from_object = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); - return 0; -} - -static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, - {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, - {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, - {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, - {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, - {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { - "monotonic_align.core._memoryviewslice", - sizeof(struct __pyx_memoryviewslice_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, - __pyx_type___pyx_memoryviewslice_slots, -}; -#else - -static PyTypeObject __pyx_type___pyx_memoryviewslice = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""_memoryviewslice", /*tp_name*/ - sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - #if CYTHON_COMPILING_IN_PYPY || 0 - __pyx_memoryview___repr__, /*tp_repr*/ - #else - 0, /*tp_repr*/ - #endif - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY || 0 - __pyx_memoryview___str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ - PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ - __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ - __pyx_tp_clear__memoryviewslice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods__memoryviewslice, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new__memoryviewslice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif -/* #### Code section: pystring_table ### */ - -static int __Pyx_CreateStringTabAndInitStrings(void) { - __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, - {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, - {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, - {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, - {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, - {&__pyx_n_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 1}, - {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, - {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, - {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, - {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, - {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, - {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_core_pyx, __pyx_k_core_pyx, sizeof(__pyx_k_core_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, - {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, - {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, - {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maximum_path_c, __pyx_k_maximum_path_c, sizeof(__pyx_k_maximum_path_c), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_monotonic_align_core, __pyx_k_monotonic_align_core, sizeof(__pyx_k_monotonic_align_core), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_paths, __pyx_k_paths, sizeof(__pyx_k_paths), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_t_xs, __pyx_k_t_xs, sizeof(__pyx_k_t_xs), 0, 0, 1, 1}, - {&__pyx_n_s_t_ys, __pyx_k_t_ys, sizeof(__pyx_k_t_ys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, - {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} - }; - return __Pyx_InitStrings(__pyx_string_tab); -} -/* #### Code section: cached_builtins ### */ -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 15, __pyx_L1_error) - __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) - __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: cached_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "View.MemoryView":582 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "View.MemoryView":679 - * tup = index if isinstance(index, tuple) else (index,) - * - * result = [slice(None)] * ndim # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__5); - __Pyx_GIVEREF(__pyx_slice__5); - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - */ - __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "View.MemoryView":100 - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: - * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "View.MemoryView":101 - * try: - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "View.MemoryView":103 - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< - * except: - * - */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "View.MemoryView":309 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "View.MemoryView":310 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "View.MemoryView":311 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "View.MemoryView":314 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "View.MemoryView":315 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__19 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(1, 1, __pyx_L1_error) - - /* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - __pyx_tuple__21 = PyTuple_Pack(4, __pyx_n_s_paths, __pyx_n_s_values, __pyx_n_s_t_ys, __pyx_n_s_t_xs); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_core_pyx, __pyx_n_s_maximum_path_c, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -/* #### Code section: init_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { - if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_globals ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* AssertionsEnabled.init */ - __Pyx_init_assertions_enabled(); - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_module ### */ - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); - generic = Py_None; Py_INCREF(Py_None); - strided = Py_None; Py_INCREF(Py_None); - indirect = Py_None; Py_INCREF(Py_None); - contiguous = Py_None; Py_INCREF(Py_None); - indirect_contiguous = Py_None; Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_array = &__pyx_vtable_array; - __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - #if CYTHON_USE_TYPE_SPECS - __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; - if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { - __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; - } - #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) - /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ - #elif defined(_MSC_VER) - #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") - #else - #warning "The buffer protocol is not supported in the Limited C-API < 3.11." - #endif - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #else - __pyx_array_type = &__pyx_type___pyx_array; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_array_type->tp_print = 0; - #endif - if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #endif - #if CYTHON_USE_TYPE_SPECS - __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) - #else - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_MemviewEnum_type->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) - #endif - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; - #if CYTHON_USE_TYPE_SPECS - __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; - if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { - __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; - } - #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) - /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ - #elif defined(_MSC_VER) - #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") - #else - #warning "The buffer protocol is not supported in the Limited C-API < 3.11." - #endif - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #else - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_memoryview_type->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #endif - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; - #if CYTHON_USE_TYPE_SPECS - __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #else - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_memoryviewslice_type->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #endif - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_core(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_core}, - {0, NULL} -}; -#endif - -#ifdef __cplusplus -namespace { - struct PyModuleDef __pyx_moduledef = - #else - static struct PyModuleDef __pyx_moduledef = - #endif - { - PyModuleDef_HEAD_INIT, - "core", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #elif CYTHON_USE_MODULE_STATE - sizeof(__pyx_mstate), /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - #if CYTHON_USE_MODULE_STATE - __pyx_m_traverse, /* m_traverse */ - __pyx_m_clear, /* m_clear */ - NULL /* m_free */ - #else - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ - #endif - }; - #ifdef __cplusplus -} /* anonymous namespace */ -#endif -#endif - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initcore(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initcore(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_core(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_core(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) -#else -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) -#endif -{ - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { -#if CYTHON_COMPILING_IN_LIMITED_API - result = PyModule_AddObject(module, to_name, value); -#else - result = PyDict_SetItemString(moddict, to_name, value); -#endif - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - CYTHON_UNUSED_VAR(def); - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - moddict = module; -#else - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; -#endif - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_core(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - int stringtab_initialized = 0; - #if CYTHON_USE_MODULE_STATE - int pystate_addmodule_run = 0; - #endif - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - static PyThread_type_lock __pyx_t_8[8]; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'core' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("core", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #elif CYTHON_USE_MODULE_STATE - __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - { - int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to core pseudovariable */ - if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - pystate_addmodule_run = 1; - } - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #endif - CYTHON_UNUSED_VAR(__pyx_t_1); - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_core(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_monotonic_align__core) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "monotonic_align.core")) { - if (unlikely((PyDict_SetItemString(modules, "monotonic_align.core", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "View.MemoryView":99 - * - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: # <<<<<<<<<<<<<< - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "View.MemoryView":100 - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: - * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__11, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - - /* "View.MemoryView":101 - * try: - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_collections_abc_Sequence); - __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":100 - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: - * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":103 - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< - * except: - * - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_collections_abc_Sequence); - __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - } - __pyx_L8:; - - /* "View.MemoryView":99 - * - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: # <<<<<<<<<<<<<< - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7_try_end; - __pyx_L2_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "View.MemoryView":104 - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence - * except: # <<<<<<<<<<<<<< - * - * __pyx_collections_abc_Sequence = None - */ - /*except:*/ { - __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_7); - - /* "View.MemoryView":106 - * except: - * - * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF(Py_None); - __Pyx_XGOTREF(__pyx_collections_abc_Sequence); - __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L3_exception_handled; - } - - /* "View.MemoryView":99 - * - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: # <<<<<<<<<<<<<< - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - */ - __pyx_L4_except_error:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L3_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_L7_try_end:; - } - - /* "View.MemoryView":241 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_1); - /*try:*/ { - - /* "View.MemoryView":242 - * - * try: - * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< - * index = __pyx_collections_abc_Sequence.index - * except: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_array_type); - - /* "View.MemoryView":243 - * try: - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< - * except: - * pass - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_array_type); - - /* "View.MemoryView":241 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L16_try_end; - __pyx_L11_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":244 - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - * except: # <<<<<<<<<<<<<< - * pass - * - */ - /*except:*/ { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L12_exception_handled; - } - __pyx_L12_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); - __pyx_L16_try_end:; - } - - /* "View.MemoryView":309 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":310 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":311 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":314 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":315 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":323 - * - * - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; - - /* "View.MemoryView":324 - * - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), - */ - __pyx_t_8[0] = PyThread_allocate_lock(); - __pyx_t_8[1] = PyThread_allocate_lock(); - __pyx_t_8[2] = PyThread_allocate_lock(); - __pyx_t_8[3] = PyThread_allocate_lock(); - __pyx_t_8[4] = PyThread_allocate_lock(); - __pyx_t_8[5] = PyThread_allocate_lock(); - __pyx_t_8[6] = PyThread_allocate_lock(); - __pyx_t_8[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - - /* "View.MemoryView":982 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "View.MemoryView":983 - * - * try: - * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< - * index = __pyx_collections_abc_Sequence.index - * except: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "View.MemoryView":984 - * try: - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< - * except: - * pass - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "View.MemoryView":982 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L22_try_end; - __pyx_L17_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":985 - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - * except: # <<<<<<<<<<<<<< - * pass - * - */ - /*except:*/ { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L18_exception_handled; - } - __pyx_L18_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_L22_try_end:; - } - - /* "View.MemoryView":988 - * pass - * - * try: # <<<<<<<<<<<<<< - * if __pyx_collections_abc_Sequence: - * - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_1); - /*try:*/ { - - /* "View.MemoryView":989 - * - * try: - * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) - if (__pyx_t_6) { - - /* "View.MemoryView":993 - * - * - * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence.register(array) - * except: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":994 - * - * __pyx_collections_abc_Sequence.register(_memoryviewslice) - * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< - * except: - * pass # ignore failure, it's a minor issue - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":989 - * - * try: - * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":988 - * pass - * - * try: # <<<<<<<<<<<<<< - * if __pyx_collections_abc_Sequence: - * - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L28_try_end; - __pyx_L23_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":995 - * __pyx_collections_abc_Sequence.register(_memoryviewslice) - * __pyx_collections_abc_Sequence.register(array) - * except: # <<<<<<<<<<<<<< - * pass # ignore failure, it's a minor issue - * - */ - /*except:*/ { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L24_exception_handled; - } - __pyx_L24_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); - __pyx_L28_try_end:; - } - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ - __pyx_k__9 = (-1e9); - - /* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_15monotonic_align_4core_1maximum_path_c, 0, __pyx_n_s_maximum_path_c, NULL, __pyx_n_s_monotonic_align_core, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_maximum_path_c, __pyx_t_7) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "monotonic_align/core.pyx":1 - * cimport cython # <<<<<<<<<<<<<< - * from cython.parallel import prange - * - */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init monotonic_align.core", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - #if !CYTHON_USE_MODULE_STATE - Py_CLEAR(__pyx_m); - #else - Py_DECREF(__pyx_m); - if (pystate_addmodule_run) { - PyObject *tp, *value, *tb; - PyErr_Fetch(&tp, &value, &tb); - PyState_RemoveModule(&__pyx_moduledef); - PyErr_Restore(tp, value, tb); - } - #endif - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init monotonic_align.core"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} -/* #### Code section: cleanup_globals ### */ -/* #### Code section: cleanup_module ### */ -/* #### Code section: main_method ### */ -/* #### Code section: utility_code_pragmas ### */ -#ifdef _MSC_VER -#pragma warning( push ) -/* Warning 4127: conditional expression is constant - * Cython uses constant conditional expressions to allow in inline functions to be optimized at - * compile-time, so this warning is not useful - */ -#pragma warning( disable : 4127 ) -#endif - - - -/* #### Code section: utility_code_def ### */ - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); - } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif - } -#else - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#endif -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -} - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* TupleAndListFromArray */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { - PyObject *v; - Py_ssize_t i; - for (i = 0; i < length; i++) { - v = dest[i] = src[i]; - Py_INCREF(v); - } -} -static CYTHON_INLINE PyObject * -__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - Py_INCREF(__pyx_empty_tuple); - return __pyx_empty_tuple; - } - res = PyTuple_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); - return res; -} -static CYTHON_INLINE PyObject * -__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - return PyList_New(0); - } - res = PyList_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); - return res; -} -#endif - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* fastcall */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) -{ - Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); - for (i = 0; i < n; i++) - { - if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; - } - for (i = 0; i < n; i++) - { - int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); - if (unlikely(eq != 0)) { - if (unlikely(eq < 0)) return NULL; // error - return kwvalues[i]; - } - } - return NULL; // not found (no exception set) -} -#endif - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); - while (1) { - if (kwds_is_tuple) { - if (pos >= PyTuple_GET_SIZE(kwds)) break; - key = PyTuple_GET_ITEM(kwds, pos); - value = kwvalues[pos]; - pos++; - } - else - { - if (!PyDict_Next(kwds, &pos, &key, &value)) break; - } - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = ( - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key) - ); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - __Pyx_TypeName type_name; - __Pyx_TypeName obj_type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - type_name = __Pyx_PyType_GetName(type); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME - ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); - __Pyx_DECREF_TypeName(type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - __Pyx_PyThreadState_declare - CYTHON_UNUSED_VAR(cause); - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { - #if PY_VERSION_HEX >= 0x030C00A6 - PyException_SetTraceback(value, tb); - #elif CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectFastCall */ -static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { - PyObject *argstuple; - PyObject *result; - size_t i; - argstuple = PyTuple_New((Py_ssize_t)nargs); - if (unlikely(!argstuple)) return NULL; - for (i = 0; i < nargs; i++) { - Py_INCREF(args[i]); - PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); - } - result = __Pyx_PyObject_Call(func, argstuple, kwargs); - Py_DECREF(argstuple); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { - Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); -#if CYTHON_COMPILING_IN_CPYTHON - if (nargs == 0 && kwargs == NULL) { -#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) - if (__Pyx_IsCyOrPyCFunction(func)) -#else - if (PyCFunction_Check(func)) -#endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - } - else if (nargs == 1 && kwargs == NULL) { - if (PyCFunction_Check(func)) - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, args[0]); - } - } - } -#endif - #if PY_VERSION_HEX < 0x030800B1 - #if CYTHON_FAST_PYCCALL - if (PyCFunction_Check(func)) { - if (kwargs) { - return _PyCFunction_FastCallDict(func, args, nargs, kwargs); - } else { - return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); - } - } - #if PY_VERSION_HEX >= 0x030700A1 - if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { - return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); - } - #endif - #endif - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); - } - #endif - #endif - #if CYTHON_VECTORCALL - vectorcallfunc f = _PyVectorcall_Function(func); - if (f) { - return f(func, args, (size_t)nargs, kwargs); - } - #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL - if (__Pyx_CyFunction_CheckExact(func)) { - __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); - if (f) return f(func, args, (size_t)nargs, kwargs); - } - #endif - if (nargs == 0) { - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); - } - return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); -} - -/* RaiseUnexpectedTypeError */ -static int -__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) -{ - __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, - expected, obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* CIntToDigits */ -static const char DIGIT_PAIRS_10[2*10*10+1] = { - "00010203040506070809" - "10111213141516171819" - "20212223242526272829" - "30313233343536373839" - "40414243444546474849" - "50515253545556575859" - "60616263646566676869" - "70717273747576777879" - "80818283848586878889" - "90919293949596979899" -}; -static const char DIGIT_PAIRS_8[2*8*8+1] = { - "0001020304050607" - "1011121314151617" - "2021222324252627" - "3031323334353637" - "4041424344454647" - "5051525354555657" - "6061626364656667" - "7071727374757677" -}; -static const char DIGITS_HEX[2*16+1] = { - "0123456789abcdef" - "0123456789ABCDEF" -}; - -/* BuildPyUnicode */ -static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, - int prepend_sign, char padding_char) { - PyObject *uval; - Py_ssize_t uoffset = ulength - clength; -#if CYTHON_USE_UNICODE_INTERNALS - Py_ssize_t i; -#if CYTHON_PEP393_ENABLED - void *udata; - uval = PyUnicode_New(ulength, 127); - if (unlikely(!uval)) return NULL; - udata = PyUnicode_DATA(uval); -#else - Py_UNICODE *udata; - uval = PyUnicode_FromUnicode(NULL, ulength); - if (unlikely(!uval)) return NULL; - udata = PyUnicode_AS_UNICODE(uval); -#endif - if (uoffset > 0) { - i = 0; - if (prepend_sign) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); - i++; - } - for (; i < uoffset; i++) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); - } - } - for (i=0; i < clength; i++) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); - } -#else - { - PyObject *sign = NULL, *padding = NULL; - uval = NULL; - if (uoffset > 0) { - prepend_sign = !!prepend_sign; - if (uoffset > prepend_sign) { - padding = PyUnicode_FromOrdinal(padding_char); - if (likely(padding) && uoffset > prepend_sign + 1) { - PyObject *tmp; - PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); - if (unlikely(!repeat)) goto done_or_error; - tmp = PyNumber_Multiply(padding, repeat); - Py_DECREF(repeat); - Py_DECREF(padding); - padding = tmp; - } - if (unlikely(!padding)) goto done_or_error; - } - if (prepend_sign) { - sign = PyUnicode_FromOrdinal('-'); - if (unlikely(!sign)) goto done_or_error; - } - } - uval = PyUnicode_DecodeASCII(chars, clength, NULL); - if (likely(uval) && padding) { - PyObject *tmp = PyNumber_Add(padding, uval); - Py_DECREF(uval); - uval = tmp; - } - if (likely(uval) && sign) { - PyObject *tmp = PyNumber_Add(sign, uval); - Py_DECREF(uval); - uval = tmp; - } -done_or_error: - Py_XDECREF(padding); - Py_XDECREF(sign); - } -#endif - return uval; -} - -/* CIntToPyUnicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { - char digits[sizeof(int)*3+2]; - char *dpos, *end = digits + sizeof(int)*3+2; - const char *hex_digits = DIGITS_HEX; - Py_ssize_t length, ulength; - int prepend_sign, last_one_off; - int remaining; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (format_char == 'X') { - hex_digits += 16; - format_char = 'x'; - } - remaining = value; - last_one_off = 0; - dpos = end; - do { - int digit_pos; - switch (format_char) { - case 'o': - digit_pos = abs((int)(remaining % (8*8))); - remaining = (int) (remaining / (8*8)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); - last_one_off = (digit_pos < 8); - break; - case 'd': - digit_pos = abs((int)(remaining % (10*10))); - remaining = (int) (remaining / (10*10)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); - last_one_off = (digit_pos < 10); - break; - case 'x': - *(--dpos) = hex_digits[abs((int)(remaining % 16))]; - remaining = (int) (remaining / 16); - break; - default: - assert(0); - break; - } - } while (unlikely(remaining != 0)); - assert(!last_one_off || *dpos == '0'); - dpos += last_one_off; - length = end - dpos; - ulength = length; - prepend_sign = 0; - if (!is_unsigned && value <= neg_one) { - if (padding_char == ' ' || width <= length + 1) { - *(--dpos) = '-'; - ++length; - } else { - prepend_sign = 1; - } - ++ulength; - } - if (width > ulength) { - ulength = width; - } - if (ulength == 1) { - return PyUnicode_FromOrdinal(*dpos); - } - return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); -} - -/* CIntToPyUnicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { - char digits[sizeof(Py_ssize_t)*3+2]; - char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; - const char *hex_digits = DIGITS_HEX; - Py_ssize_t length, ulength; - int prepend_sign, last_one_off; - Py_ssize_t remaining; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (format_char == 'X') { - hex_digits += 16; - format_char = 'x'; - } - remaining = value; - last_one_off = 0; - dpos = end; - do { - int digit_pos; - switch (format_char) { - case 'o': - digit_pos = abs((int)(remaining % (8*8))); - remaining = (Py_ssize_t) (remaining / (8*8)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); - last_one_off = (digit_pos < 8); - break; - case 'd': - digit_pos = abs((int)(remaining % (10*10))); - remaining = (Py_ssize_t) (remaining / (10*10)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); - last_one_off = (digit_pos < 10); - break; - case 'x': - *(--dpos) = hex_digits[abs((int)(remaining % 16))]; - remaining = (Py_ssize_t) (remaining / 16); - break; - default: - assert(0); - break; - } - } while (unlikely(remaining != 0)); - assert(!last_one_off || *dpos == '0'); - dpos += last_one_off; - length = end - dpos; - ulength = length; - prepend_sign = 0; - if (!is_unsigned && value <= neg_one) { - if (padding_char == ' ' || width <= length + 1) { - *(--dpos) = '-'; - ++length; - } else { - prepend_sign = 1; - } - ++ulength; - } - if (width > ulength) { - ulength = width; - } - if (ulength == 1) { - return PyUnicode_FromOrdinal(*dpos); - } - return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); -} - -/* JoinPyUnicode */ -static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, - Py_UCS4 max_char) { -#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - PyObject *result_uval; - int result_ukind, kind_shift; - Py_ssize_t i, char_pos; - void *result_udata; - CYTHON_MAYBE_UNUSED_VAR(max_char); -#if CYTHON_PEP393_ENABLED - result_uval = PyUnicode_New(result_ulength, max_char); - if (unlikely(!result_uval)) return NULL; - result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; - kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; - result_udata = PyUnicode_DATA(result_uval); -#else - result_uval = PyUnicode_FromUnicode(NULL, result_ulength); - if (unlikely(!result_uval)) return NULL; - result_ukind = sizeof(Py_UNICODE); - kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; - result_udata = PyUnicode_AS_UNICODE(result_uval); -#endif - assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); - char_pos = 0; - for (i=0; i < value_count; i++) { - int ukind; - Py_ssize_t ulength; - void *udata; - PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); - if (unlikely(__Pyx_PyUnicode_READY(uval))) - goto bad; - ulength = __Pyx_PyUnicode_GET_LENGTH(uval); - if (unlikely(!ulength)) - continue; - if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) - goto overflow; - ukind = __Pyx_PyUnicode_KIND(uval); - udata = __Pyx_PyUnicode_DATA(uval); - if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { - memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); - } else { - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) - _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); - #else - Py_ssize_t j; - for (j=0; j < ulength; j++) { - Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); - __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); - } - #endif - } - char_pos += ulength; - } - return result_uval; -overflow: - PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); -bad: - Py_DECREF(result_uval); - return NULL; -#else - CYTHON_UNUSED_VAR(max_char); - CYTHON_UNUSED_VAR(result_ulength); - CYTHON_UNUSED_VAR(value_count); - return PyUnicode_Join(__pyx_empty_unicode, value_tuple); -#endif -} - -/* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); -} - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (unlikely(!j)) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; - PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; - if (mm && mm->mp_subscript) { - PyObject *r, *key = PyInt_FromSsize_t(i); - if (unlikely(!key)) return NULL; - r = mm->mp_subscript(o, key); - Py_DECREF(key); - return r; - } - if (likely(sm && sm->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { - Py_ssize_t l = sm->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return sm->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* PyObjectCallOneArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *args[2] = {NULL, arg}; - return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, - "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); - __Pyx_DECREF_TypeName(index_type_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { - __Pyx_TypeName obj_type_name; - if (likely(PyType_Check(obj))) { - PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); - if (meth) { - PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); - Py_DECREF(meth); - return result; - } - } - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { - PyTypeObject *tp = Py_TYPE(obj); - PyMappingMethods *mm = tp->tp_as_mapping; - PySequenceMethods *sm = tp->tp_as_sequence; - if (likely(mm && mm->mp_subscript)) { - return mm->mp_subscript(obj, key); - } - if (likely(sm && sm->sq_item)) { - return __Pyx_PyObject_GetIndex(obj, key); - } - return __Pyx_PyObject_GetItem_Slow(obj, key); -} -#endif - -/* KeywordStringCheck */ -static int __Pyx_CheckKeywordStrings( - PyObject *kw, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { - if (unlikely(PyTuple_GET_SIZE(kw) == 0)) - return 1; - if (!kw_allowed) { - key = PyTuple_GET_ITEM(kw, 0); - goto invalid_keyword; - } -#if PY_VERSION_HEX < 0x03090000 - for (pos = 0; pos < PyTuple_GET_SIZE(kw); pos++) { - key = PyTuple_GET_ITEM(kw, pos); - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } -#endif - return 1; - } - while (PyDict_Next(kw, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if (!kw_allowed && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* DivInt[Py_ssize_t] */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* GetAttr3 */ -static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r; -#if CYTHON_USE_TYPE_SLOTS - if (likely(PyString_Check(n))) { - r = __Pyx_PyObject_GetAttrStrNoError(o, n); - if (unlikely(!r) && likely(!PyErr_Occurred())) { - r = __Pyx_NewRef(d); - } - return r; - } -#endif - r = PyObject_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#elif CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(!__pyx_m)) { - return NULL; - } - result = PyObject_GetAttr(__pyx_m, name); - if (likely(result)) { - return result; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* RaiseTooManyValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* ExtTypeTest */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - __Pyx_TypeName obj_type_name; - __Pyx_TypeName type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - type_name = __Pyx_PyType_GetName(type); - PyErr_Format(PyExc_TypeError, - "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, - obj_type_name, type_name); - __Pyx_DECREF_TypeName(obj_type_name); - __Pyx_DECREF_TypeName(type_name); - return 0; -} - -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - PyObject *exc_value = exc_info->exc_value; - if (exc_value == NULL || exc_value == Py_None) { - *value = NULL; - *type = NULL; - *tb = NULL; - } else { - *value = exc_value; - Py_INCREF(*value); - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - *tb = PyException_GetTraceback(exc_value); - } - #elif CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #endif -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = tstate->exc_info; - PyObject *tmp_value = exc_info->exc_value; - exc_info->exc_value = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); - #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - #endif -} -#endif - -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type = NULL, *local_value, *local_tb = NULL; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030C00A6 - local_value = tstate->current_exception; - tstate->current_exception = 0; - if (likely(local_value)) { - local_type = (PyObject*) Py_TYPE(local_value); - Py_INCREF(local_type); - local_tb = PyException_GetTraceback(local_value); - } - #else - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - #endif -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 - if (unlikely(tstate->current_exception)) -#elif CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - #if PY_VERSION_HEX >= 0x030B00a4 - tmp_value = exc_info->exc_value; - exc_info->exc_value = local_value; - tmp_type = NULL; - tmp_tb = NULL; - Py_XDECREF(local_type); - Py_XDECREF(local_tb); - #else - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - #endif - } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* SwapException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_value = exc_info->exc_value; - exc_info->exc_value = *value; - if (tmp_value == NULL || tmp_value == Py_None) { - Py_XDECREF(tmp_value); - tmp_value = NULL; - tmp_type = NULL; - tmp_tb = NULL; - } else { - tmp_type = (PyObject*) Py_TYPE(tmp_value); - Py_INCREF(tmp_type); - #if CYTHON_COMPILING_IN_CPYTHON - tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; - Py_XINCREF(tmp_tb); - #else - tmp_tb = PyException_GetTraceback(tmp_value); - #endif - } - #elif CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *module = 0; - PyObject *empty_dict = 0; - PyObject *empty_list = 0; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (unlikely(!py_import)) - goto bad; - if (!from_list) { - empty_list = PyList_New(0); - if (unlikely(!empty_list)) - goto bad; - from_list = empty_list; - } - #endif - empty_dict = PyDict_New(); - if (unlikely(!empty_dict)) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - #if CYTHON_COMPILING_IN_LIMITED_API - module = PyImport_ImportModuleLevelObject( - name, empty_dict, empty_dict, from_list, 1); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, 1); - #endif - if (unlikely(!module)) { - if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (unlikely(!py_level)) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - #if CYTHON_COMPILING_IN_LIMITED_API - module = PyImport_ImportModuleLevelObject( - name, empty_dict, empty_dict, from_list, level); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, level); - #endif - #endif - } - } -bad: - Py_XDECREF(empty_dict); - Py_XDECREF(empty_list); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - return module; -} - -/* ImportDottedModule */ -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { - PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; - if (unlikely(PyErr_Occurred())) { - PyErr_Clear(); - } - if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { - partial_name = name; - } else { - slice = PySequence_GetSlice(parts_tuple, 0, count); - if (unlikely(!slice)) - goto bad; - sep = PyUnicode_FromStringAndSize(".", 1); - if (unlikely(!sep)) - goto bad; - partial_name = PyUnicode_Join(sep, slice); - } - PyErr_Format( -#if PY_MAJOR_VERSION < 3 - PyExc_ImportError, - "No module named '%s'", PyString_AS_STRING(partial_name)); -#else -#if PY_VERSION_HEX >= 0x030600B1 - PyExc_ModuleNotFoundError, -#else - PyExc_ImportError, -#endif - "No module named '%U'", partial_name); -#endif -bad: - Py_XDECREF(sep); - Py_XDECREF(slice); - Py_XDECREF(partial_name); - return NULL; -} -#endif -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { - PyObject *imported_module; -#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) - PyObject *modules = PyImport_GetModuleDict(); - if (unlikely(!modules)) - return NULL; - imported_module = __Pyx_PyDict_GetItemStr(modules, name); - Py_XINCREF(imported_module); -#else - imported_module = PyImport_GetModule(name); -#endif - return imported_module; -} -#endif -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { - Py_ssize_t i, nparts; - nparts = PyTuple_GET_SIZE(parts_tuple); - for (i=1; i < nparts && module; i++) { - PyObject *part, *submodule; -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - part = PyTuple_GET_ITEM(parts_tuple, i); -#else - part = PySequence_ITEM(parts_tuple, i); -#endif - submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); -#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(part); -#endif - Py_DECREF(module); - module = submodule; - } - if (unlikely(!module)) { - return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); - } - return module; -} -#endif -static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { -#if PY_MAJOR_VERSION < 3 - PyObject *module, *from_list, *star = __pyx_n_s__3; - CYTHON_UNUSED_VAR(parts_tuple); - from_list = PyList_New(1); - if (unlikely(!from_list)) - return NULL; - Py_INCREF(star); - PyList_SET_ITEM(from_list, 0, star); - module = __Pyx_Import(name, from_list, 0); - Py_DECREF(from_list); - return module; -#else - PyObject *imported_module; - PyObject *module = __Pyx_Import(name, NULL, 0); - if (!parts_tuple || unlikely(!module)) - return module; - imported_module = __Pyx__ImportDottedModule_Lookup(name); - if (likely(imported_module)) { - Py_DECREF(module); - return imported_module; - } - PyErr_Clear(); - return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); -#endif -} -static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 - PyObject *module = __Pyx__ImportDottedModule_Lookup(name); - if (likely(module)) { - PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); - if (likely(spec)) { - PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); - if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { - Py_DECREF(spec); - spec = NULL; - } - Py_XDECREF(unsafe); - } - if (likely(!spec)) { - PyErr_Clear(); - return module; - } - Py_DECREF(spec); - Py_DECREF(module); - } else if (PyErr_Occurred()) { - PyErr_Clear(); - } -#endif - return __Pyx__ImportDottedModule(name, parts_tuple); -} - -/* ssize_strlen */ -static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { - size_t len = strlen(s); - if (unlikely(len > PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, "byte string is too long"); - return -1; - } - return (Py_ssize_t) len; -} - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (cls == a || cls == b) return 1; - mro = cls->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - PyObject *base = PyTuple_GET_ITEM(mro, i); - if (base == (PyObject *)a || base == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { - return type->tp_as_sequence->sq_repeat(seq, mul); - } else -#endif - { - return __Pyx_PySequence_Multiply_Generic(seq, mul); - } -} - -/* SetItemInt */ -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (unlikely(!j)) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; - PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; - if (mm && mm->mp_ass_subscript) { - int r; - PyObject *key = PyInt_FromSsize_t(i); - if (unlikely(!key)) return -1; - r = mm->mp_ass_subscript(o, key, v); - Py_DECREF(key); - return r; - } - if (likely(sm && sm->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { - Py_ssize_t l = sm->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return sm->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) -#else - if (is_list || PySequence_Check(o)) -#endif - { - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -/* RaiseUnboundLocalError */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* DivInt[long] */ -static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - const char* module_name_str = 0; - PyObject* module_name = 0; - PyObject* module_dot = 0; - PyObject* full_name = 0; - PyErr_Clear(); - module_name_str = PyModule_GetName(module); - if (unlikely(!module_name_str)) { goto modbad; } - module_name = PyUnicode_FromString(module_name_str); - if (unlikely(!module_name)) { goto modbad; } - module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); - if (unlikely(!module_dot)) { goto modbad; } - full_name = PyUnicode_Concat(module_dot, name); - if (unlikely(!full_name)) { goto modbad; } - #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) - { - PyObject *modules = PyImport_GetModuleDict(); - if (unlikely(!modules)) - goto modbad; - value = PyObject_GetItem(modules, full_name); - } - #else - value = PyImport_GetModule(full_name); - #endif - modbad: - Py_XDECREF(full_name); - Py_XDECREF(module_dot); - Py_XDECREF(module_name); - } - if (unlikely(!value)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* HasAttr */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (!r) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; - } -} - -/* ErrOccurredWithGIL */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { - int err; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - err = !!PyErr_Occurred(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif - return err; -} - -/* PyObject_GenericGetAttrNoDict */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, attr_name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(attr_name)); -#endif - __Pyx_DECREF_TypeName(type_name); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; - } - } - return descr; -} -#endif - -/* PyObject_GenericGetAttr */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); - } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); -} -#endif - -/* FixUpExtensionType */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { -#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - CYTHON_UNUSED_VAR(spec); - CYTHON_UNUSED_VAR(type); -#else - const PyType_Slot *slot = spec->slots; - while (slot && slot->slot && slot->slot != Py_tp_members) - slot++; - if (slot && slot->slot == Py_tp_members) { - int changed = 0; -#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) - const -#endif - PyMemberDef *memb = (PyMemberDef*) slot->pfunc; - while (memb && memb->name) { - if (memb->name[0] == '_' && memb->name[1] == '_') { -#if PY_VERSION_HEX < 0x030900b1 - if (strcmp(memb->name, "__weaklistoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_weaklistoffset = memb->offset; - changed = 1; - } - else if (strcmp(memb->name, "__dictoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_dictoffset = memb->offset; - changed = 1; - } -#if CYTHON_METH_FASTCALL - else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); -#if PY_VERSION_HEX >= 0x030800b4 - type->tp_vectorcall_offset = memb->offset; -#else - type->tp_print = (printfunc) memb->offset; -#endif - changed = 1; - } -#endif -#else - if ((0)); -#endif -#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON - else if (strcmp(memb->name, "__module__") == 0) { - PyObject *descr; - assert(memb->type == T_OBJECT); - assert(memb->flags == 0 || memb->flags == READONLY); - descr = PyDescr_NewMember(type, memb); - if (unlikely(!descr)) - return -1; - if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { - Py_DECREF(descr); - return -1; - } - Py_DECREF(descr); - changed = 1; - } -#endif - } - memb++; - } - if (changed) - PyType_Modified(type); - } -#endif - return 0; -} -#endif - -/* PyObjectCallNoArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { - PyObject *arg = NULL; - return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - -/* PyObjectGetMethod */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { - PyObject *attr; -#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP - __Pyx_TypeName type_name; - PyTypeObject *tp = Py_TYPE(obj); - PyObject *descr; - descrgetfunc f = NULL; - PyObject **dictptr, *dict; - int meth_found = 0; - assert (*method == NULL); - if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; - } - if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { - return 0; - } - descr = _PyType_Lookup(tp, name); - if (likely(descr != NULL)) { - Py_INCREF(descr); -#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR - if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) -#elif PY_MAJOR_VERSION >= 3 - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) - #endif -#else - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr))) - #endif -#endif - { - meth_found = 1; - } else { - f = Py_TYPE(descr)->tp_descr_get; - if (f != NULL && PyDescr_IsData(descr)) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - } - } - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr != NULL && (dict = *dictptr) != NULL) { - Py_INCREF(dict); - attr = __Pyx_PyDict_GetItemStr(dict, name); - if (attr != NULL) { - Py_INCREF(attr); - Py_DECREF(dict); - Py_XDECREF(descr); - goto try_unpack; - } - Py_DECREF(dict); - } - if (meth_found) { - *method = descr; - return 1; - } - if (f != NULL) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - if (likely(descr != NULL)) { - *method = descr; - return 0; - } - type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(name)); -#endif - __Pyx_DECREF_TypeName(type_name); - return 0; -#else - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; -#endif -try_unpack: -#if CYTHON_UNPACK_METHODS - if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { - PyObject *function = PyMethod_GET_FUNCTION(attr); - Py_INCREF(function); - Py_DECREF(attr); - *method = function; - return 1; - } -#endif - *method = attr; - return 0; -} - -/* PyObjectCallMethod0 */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { - PyObject *method = NULL, *result = NULL; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_CallOneArg(method, obj); - Py_DECREF(method); - return result; - } - if (unlikely(!method)) goto bad; - result = __Pyx_PyObject_CallNoArg(method); - Py_DECREF(method); -bad: - return result; -} - -/* ValidateBasesTuple */ -#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS -static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { - Py_ssize_t i, n = PyTuple_GET_SIZE(bases); - for (i = 1; i < n; i++) - { - PyObject *b0 = PyTuple_GET_ITEM(bases, i); - PyTypeObject *b; -#if PY_MAJOR_VERSION < 3 - if (PyClass_Check(b0)) - { - PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", - PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); - return -1; - } -#endif - b = (PyTypeObject*) b0; - if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) - { - __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); - PyErr_Format(PyExc_TypeError, - "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); - __Pyx_DECREF_TypeName(b_name); - return -1; - } - if (dictoffset == 0 && b->tp_dictoffset) - { - __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); - PyErr_Format(PyExc_TypeError, - "extension type '%.200s' has no __dict__ slot, " - "but base type '" __Pyx_FMT_TYPENAME "' has: " - "either add 'cdef dict __dict__' to the extension type " - "or add '__slots__ = [...]' to the base type", - type_name, b_name); - __Pyx_DECREF_TypeName(b_name); - return -1; - } - } - return 0; -} -#endif - -/* PyType_Ready */ -static int __Pyx_PyType_Ready(PyTypeObject *t) { -#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) - (void)__Pyx_PyObject_CallMethod0; -#if CYTHON_USE_TYPE_SPECS - (void)__Pyx_validate_bases_tuple; -#endif - return PyType_Ready(t); -#else - int r; - PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); - if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) - return -1; -#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) - { - int gc_was_enabled; - #if PY_VERSION_HEX >= 0x030A00b1 - gc_was_enabled = PyGC_Disable(); - (void)__Pyx_PyObject_CallMethod0; - #else - PyObject *ret, *py_status; - PyObject *gc = NULL; - #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) - gc = PyImport_GetModule(__pyx_kp_u_gc); - #endif - if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); - if (unlikely(!gc)) return -1; - py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); - if (unlikely(!py_status)) { - Py_DECREF(gc); - return -1; - } - gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); - Py_DECREF(py_status); - if (gc_was_enabled > 0) { - ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); - if (unlikely(!ret)) { - Py_DECREF(gc); - return -1; - } - Py_DECREF(ret); - } else if (unlikely(gc_was_enabled == -1)) { - Py_DECREF(gc); - return -1; - } - #endif - t->tp_flags |= Py_TPFLAGS_HEAPTYPE; -#if PY_VERSION_HEX >= 0x030A0000 - t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; -#endif -#else - (void)__Pyx_PyObject_CallMethod0; -#endif - r = PyType_Ready(t); -#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) - t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; - #if PY_VERSION_HEX >= 0x030A00b1 - if (gc_was_enabled) - PyGC_Enable(); - #else - if (gc_was_enabled) { - PyObject *tp, *v, *tb; - PyErr_Fetch(&tp, &v, &tb); - ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); - if (likely(ret || r == -1)) { - Py_XDECREF(ret); - PyErr_Restore(tp, v, tb); - } else { - Py_XDECREF(tp); - Py_XDECREF(v); - Py_XDECREF(tb); - r = -1; - } - } - Py_DECREF(gc); - #endif - } -#endif - return r; -#endif -} - -/* SetVTable */ -static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { - PyObject *ob = PyCapsule_New(vtable, 0, 0); - if (unlikely(!ob)) - goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) -#else - if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) -#endif - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* GetVTable */ -static void* __Pyx_GetVtable(PyTypeObject *type) { - void* ptr; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); -#else - PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); -#endif - if (!ob) - goto bad; - ptr = PyCapsule_GetPointer(ob, 0); - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* MergeVTables */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_MergeVtables(PyTypeObject *type) { - int i; - void** base_vtables; - __Pyx_TypeName tp_base_name; - __Pyx_TypeName base_name; - void* unknown = (void*)-1; - PyObject* bases = type->tp_bases; - int base_depth = 0; - { - PyTypeObject* base = type->tp_base; - while (base) { - base_depth += 1; - base = base->tp_base; - } - } - base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); - base_vtables[0] = unknown; - for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { - void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); - if (base_vtable != NULL) { - int j; - PyTypeObject* base = type->tp_base; - for (j = 0; j < base_depth; j++) { - if (base_vtables[j] == unknown) { - base_vtables[j] = __Pyx_GetVtable(base); - base_vtables[j + 1] = unknown; - } - if (base_vtables[j] == base_vtable) { - break; - } else if (base_vtables[j] == NULL) { - goto bad; - } - base = base->tp_base; - } - } - } - PyErr_Clear(); - free(base_vtables); - return 0; -bad: - tp_base_name = __Pyx_PyType_GetName(type->tp_base); - base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); - PyErr_Format(PyExc_TypeError, - "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); - __Pyx_DECREF_TypeName(tp_base_name); - __Pyx_DECREF_TypeName(base_name); - free(base_vtables); - return -1; -} -#endif - -/* SetupReduce */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; -} -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); -#else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } -#endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); -#else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } -#endif - if (object_getstate != getstate) { - goto __PYX_GOOD; - } - } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; -#else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; -#endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); - } - } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) { - __Pyx_TypeName type_obj_name = - __Pyx_PyType_GetName((PyTypeObject*)type_obj); - PyErr_Format(PyExc_RuntimeError, - "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); - __Pyx_DECREF_TypeName(type_obj_name); - } - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); - Py_XDECREF(object_getstate); - Py_XDECREF(getstate); -#endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); - return ret; -} -#endif - -/* FetchSharedCythonModule */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void) { - PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); - if (unlikely(!abi_module)) return NULL; - Py_INCREF(abi_module); - return abi_module; -} - -/* FetchCommonType */ -static int __Pyx_VerifyCachedType(PyObject *cached_type, - const char *name, - Py_ssize_t basicsize, - Py_ssize_t expected_basicsize) { - if (!PyType_Check(cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", name); - return -1; - } - if (basicsize != expected_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - name); - return -1; - } - return 0; -} -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* abi_module; - const char* object_name; - PyTypeObject *cached_type = NULL; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - object_name = strrchr(type->tp_name, '.'); - object_name = object_name ? object_name+1 : type->tp_name; - cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - if (__Pyx_VerifyCachedType( - (PyObject *)cached_type, - object_name, - cached_type->tp_basicsize, - type->tp_basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; -done: - Py_DECREF(abi_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#else -static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { - PyObject *abi_module, *cached_type = NULL; - const char* object_name = strrchr(spec->name, '.'); - object_name = object_name ? object_name+1 : spec->name; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - cached_type = PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - Py_ssize_t basicsize; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *py_basicsize; - py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); - if (unlikely(!py_basicsize)) goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; -#else - basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; -#endif - if (__Pyx_VerifyCachedType( - cached_type, - object_name, - basicsize, - spec->basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - CYTHON_UNUSED_VAR(module); - cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); - if (unlikely(!cached_type)) goto bad; - if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; -done: - Py_DECREF(abi_module); - assert(cached_type == NULL || PyType_Check(cached_type)); - return (PyTypeObject *) cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#endif - -/* PyVectorcallFastCallDict */ -#if CYTHON_METH_FASTCALL -static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) -{ - PyObject *res = NULL; - PyObject *kwnames; - PyObject **newargs; - PyObject **kwvalues; - Py_ssize_t i, pos; - size_t j; - PyObject *key, *value; - unsigned long keys_are_strings; - Py_ssize_t nkw = PyDict_GET_SIZE(kw); - newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); - if (unlikely(newargs == NULL)) { - PyErr_NoMemory(); - return NULL; - } - for (j = 0; j < nargs; j++) newargs[j] = args[j]; - kwnames = PyTuple_New(nkw); - if (unlikely(kwnames == NULL)) { - PyMem_Free(newargs); - return NULL; - } - kwvalues = newargs + nargs; - pos = i = 0; - keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; - while (PyDict_Next(kw, &pos, &key, &value)) { - keys_are_strings &= Py_TYPE(key)->tp_flags; - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(kwnames, i, key); - kwvalues[i] = value; - i++; - } - if (unlikely(!keys_are_strings)) { - PyErr_SetString(PyExc_TypeError, "keywords must be strings"); - goto cleanup; - } - res = vc(func, newargs, nargs, kwnames); -cleanup: - Py_DECREF(kwnames); - for (i = 0; i < nkw; i++) - Py_DECREF(kwvalues[i]); - PyMem_Free(newargs); - return res; -} -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) -{ - if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { - return vc(func, args, nargs, NULL); - } - return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); -} -#endif - -/* CythonFunctionShared */ -static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { -#if PY_VERSION_HEX < 0x030900B1 - __Pyx_Py_XDECREF_SET( - __Pyx_CyFunction_GetClassObj(f), - ((classobj) ? __Pyx_NewRef(classobj) : NULL)); -#else - __Pyx_Py_XDECREF_SET( - ((PyCMethodObject *) (f))->mm_class, - (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); -#endif -} -static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) -{ - CYTHON_UNUSED_VAR(closure); - if (unlikely(op->func_doc == NULL)) { - if (((PyCFunctionObject*)op)->m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_doc, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_name, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_qualname, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_dict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(op); - CYTHON_UNUSED_VAR(context); - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - CYTHON_UNUSED_VAR(context); - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value) { - value = Py_None; - } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " - "currently affect the values used in function calls", 1); - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_tuple; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - if (op->defaults_getter) { - if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value) { - value = Py_None; - } else if (unlikely(value != Py_None && !PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " - "currently affect the values used in function calls", 1); - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_kwdict; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - if (op->defaults_getter) { - if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value || value == Py_None) { - value = NULL; - } else if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - __Pyx_Py_XDECREF_SET(op->func_annotations, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->func_annotations; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyObject * -__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { - int is_coroutine; - CYTHON_UNUSED_VAR(context); - if (op->func_is_coroutine) { - return __Pyx_NewRef(op->func_is_coroutine); - } - is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; -#if PY_VERSION_HEX >= 0x03050000 - if (is_coroutine) { - PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; - fromlist = PyList_New(1); - if (unlikely(!fromlist)) return NULL; - Py_INCREF(marker); - PyList_SET_ITEM(fromlist, 0, marker); - module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); - Py_DECREF(fromlist); - if (unlikely(!module)) goto ignore; - op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); - Py_DECREF(module); - if (likely(op->func_is_coroutine)) { - return __Pyx_NewRef(op->func_is_coroutine); - } -ignore: - PyErr_Clear(); - } -#endif - op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); - return __Pyx_NewRef(op->func_is_coroutine); -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, -#if CYTHON_USE_TYPE_SPECS - {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, -#if CYTHON_METH_FASTCALL -#if CYTHON_BACKPORT_VECTORCALL - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, -#else - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, -#endif -#endif -#if PY_VERSION_HEX < 0x030500A0 - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, -#else - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, -#endif -#endif - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) -{ - CYTHON_UNUSED_VAR(args); -#if PY_MAJOR_VERSION >= 3 - Py_INCREF(m->func_qualname); - return m->func_qualname; -#else - return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyCFunctionObject *cf = (PyCFunctionObject*) op; - if (unlikely(op == NULL)) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - cf->m_ml = ml; - cf->m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - cf->m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; -#if PY_VERSION_HEX < 0x030900B1 - op->func_classobj = NULL; -#else - ((PyCMethodObject*)op)->mm_class = NULL; -#endif - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults_size = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - op->func_is_coroutine = NULL; -#if CYTHON_METH_FASTCALL - switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { - case METH_NOARGS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; - break; - case METH_O: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; - break; - case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; - break; - case METH_FASTCALL | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; - break; - case METH_VARARGS | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = NULL; - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - Py_DECREF(op); - return NULL; - } -#endif - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(((PyCFunctionObject*)m)->m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); -#if PY_VERSION_HEX < 0x030900B1 - Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); -#else - { - PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; - ((PyCMethodObject *) (m))->mm_class = NULL; - Py_XDECREF(cls); - } -#endif - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - Py_CLEAR(m->func_is_coroutine); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - __Pyx_PyHeapTypeObject_GC_Del(m); -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - __Pyx__CyFunction_dealloc(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(((PyCFunctionObject*)m)->m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - Py_VISIT(m->func_is_coroutine); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; -#if CYTHON_METH_FASTCALL - __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); - if (vc) { -#if CYTHON_ASSUME_SAFE_MACROS - return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); -#else - (void) &__Pyx_PyVectorcall_FastCallDict; - return PyVectorcall_Call(func, args, kw); -#endif - } -#endif - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); -#if PY_MAJOR_VERSION > 2 - PyErr_Format(PyExc_TypeError, - "unbound method %.200S() needs an argument", - cyfunc->func_qualname); -#else - PyErr_SetString(PyExc_TypeError, - "unbound method needs an argument"); -#endif - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) -{ - int ret = 0; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - if (unlikely(nargs < 1)) { - PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", - ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - ret = 1; - } - if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - return ret; -} -static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 0)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_meth(self, NULL); -} -static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 1)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_meth(self, args[0]); -} -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); -} -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; - PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); -} -#endif -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_CyFunctionType_slots[] = { - {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, - {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, - {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, - {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, - {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, - {Py_tp_methods, (void *)__pyx_CyFunction_methods}, - {Py_tp_members, (void *)__pyx_CyFunction_members}, - {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, - {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, - {0, 0}, -}; -static PyType_Spec __pyx_CyFunctionType_spec = { - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - __pyx_CyFunctionType_slots -}; -#else -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, -#if !CYTHON_METH_FASTCALL - 0, -#elif CYTHON_BACKPORT_VECTORCALL - (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), -#else - offsetof(PyCFunctionObject, vectorcall), -#endif - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#ifdef _Py_TPFLAGS_HAVE_VECTORCALL - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_PyMethod_New, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, -#endif -#if __PYX_NEED_TP_PRINT_SLOT - 0, -#endif -#if PY_VERSION_HEX >= 0x030C0000 - 0, -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, -#endif -}; -#endif -static int __pyx_CyFunction_init(PyObject *module) { -#if CYTHON_USE_TYPE_SPECS - __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); -#else - CYTHON_UNUSED_VAR(module); - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); -#endif - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - m->defaults_size = size; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); - } - return op; -} - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - CYTHON_MAYBE_UNUSED_VAR(tstate); - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} -#endif - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - if (c_line) { - (void) __pyx_cfilenm; - (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); - } - _PyTraceback_Add(funcname, filename, py_line); -} -#else -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = NULL; - PyObject *py_funcname = NULL; - #if PY_MAJOR_VERSION < 3 - PyObject *py_srcfile = NULL; - py_srcfile = PyString_FromString(filename); - if (!py_srcfile) goto bad; - #endif - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - funcname = PyUnicode_AsUTF8(py_funcname); - if (!funcname) goto bad; - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - if (!py_funcname) goto bad; - #endif - } - #if PY_MAJOR_VERSION < 3 - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - #else - py_code = PyCode_NewEmpty(filename, funcname, py_line); - #endif - Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline - return py_code; -bad: - Py_XDECREF(py_funcname); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_srcfile); - #endif - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject *ptype, *pvalue, *ptraceback; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) { - /* If the code object creation fails, then we should clear the - fetched exception references and propagate the new exception */ - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - goto bad; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} -#endif - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - __Pyx_TypeName obj_type_name; - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); - if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); - if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", - obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return -1; -} -static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject *obj = view->obj; - if (!obj) return; - if (PyObject_CheckBuffer(obj)) { - PyBuffer_Release(view); - return; - } - if ((0)) {} - view->obj = NULL; - Py_DECREF(obj); -} -#endif - - -/* MemviewSliceIsContig */ -static int -__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) -{ - int i, index, step, start; - Py_ssize_t itemsize = mvs.memview->view.itemsize; - if (order == 'F') { - step = 1; - start = 0; - } else { - step = -1; - start = ndim - 1; - } - for (i = 0; i < ndim; i++) { - index = start + step * i; - if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) - return 0; - itemsize *= mvs.shape[index]; - } - return 1; -} - -/* OverlappingSlices */ -static void -__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, - void **out_start, void **out_end, - int ndim, size_t itemsize) -{ - char *start, *end; - int i; - start = end = slice->data; - for (i = 0; i < ndim; i++) { - Py_ssize_t stride = slice->strides[i]; - Py_ssize_t extent = slice->shape[i]; - if (extent == 0) { - *out_start = *out_end = start; - return; - } else { - if (stride > 0) - end += stride * (extent - 1); - else - start += stride * (extent - 1); - } - } - *out_start = start; - *out_end = end + itemsize; -} -static int -__pyx_slices_overlap(__Pyx_memviewslice *slice1, - __Pyx_memviewslice *slice2, - int ndim, size_t itemsize) -{ - void *start1, *end1, *start2, *end2; - __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); - __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); - return (start1 < end2) && (start2 < end1); -} - -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; -} - -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; - } - } - *ts = t; - return count; -} -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; -} -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); -} -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparsable format string"; - } -} -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; - } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { - CYTHON_UNUSED_VAR(is_complex); - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { - CYTHON_UNUSED_VAR(is_complex); - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } -} -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; - } - } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; - } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; - } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); - } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; - } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } - } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; -} -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) -{ - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; - } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; - } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; -} -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; - } - } - } -} - -/* TypeInfoCompare */ - static int -__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) -{ - int i; - if (!a || !b) - return 0; - if (a == b) - return 1; - if (a->size != b->size || a->typegroup != b->typegroup || - a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) { - if (a->typegroup == 'H' || b->typegroup == 'H') { - return a->size == b->size; - } else { - return 0; - } - } - if (a->ndim) { - for (i = 0; i < a->ndim; i++) - if (a->arraysize[i] != b->arraysize[i]) - return 0; - } - if (a->typegroup == 'S') { - if (a->flags != b->flags) - return 0; - if (a->fields || b->fields) { - if (!(a->fields && b->fields)) - return 0; - for (i = 0; a->fields[i].type && b->fields[i].type; i++) { - __Pyx_StructField *field_a = a->fields + i; - __Pyx_StructField *field_b = b->fields + i; - if (field_a->offset != field_b->offset || - !__pyx_typeinfo_cmp(field_a->type, field_b->type)) - return 0; - } - return !a->fields[i].type && !b->fields[i].type; - } - } - return 1; -} - -/* MemviewSliceValidateAndInit */ - static int -__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) -{ - if (buf->shape[dim] <= 1) - return 1; - if (buf->strides) { - if (spec & __Pyx_MEMVIEW_CONTIG) { - if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) { - if (unlikely(buf->strides[dim] != sizeof(void *))) { - PyErr_Format(PyExc_ValueError, - "Buffer is not indirectly contiguous " - "in dimension %d.", dim); - goto fail; - } - } else if (unlikely(buf->strides[dim] != buf->itemsize)) { - PyErr_SetString(PyExc_ValueError, - "Buffer and memoryview are not contiguous " - "in the same dimension."); - goto fail; - } - } - if (spec & __Pyx_MEMVIEW_FOLLOW) { - Py_ssize_t stride = buf->strides[dim]; - if (stride < 0) - stride = -stride; - if (unlikely(stride < buf->itemsize)) { - PyErr_SetString(PyExc_ValueError, - "Buffer and memoryview are not contiguous " - "in the same dimension."); - goto fail; - } - } - } else { - if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) { - PyErr_Format(PyExc_ValueError, - "C-contiguous buffer is not contiguous in " - "dimension %d", dim); - goto fail; - } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) { - PyErr_Format(PyExc_ValueError, - "C-contiguous buffer is not indirect in " - "dimension %d", dim); - goto fail; - } else if (unlikely(buf->suboffsets)) { - PyErr_SetString(PyExc_ValueError, - "Buffer exposes suboffsets but no strides"); - goto fail; - } - } - return 1; -fail: - return 0; -} -static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) -{ - CYTHON_UNUSED_VAR(ndim); - if (spec & __Pyx_MEMVIEW_DIRECT) { - if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { - PyErr_Format(PyExc_ValueError, - "Buffer not compatible with direct access " - "in dimension %d.", dim); - goto fail; - } - } - if (spec & __Pyx_MEMVIEW_PTR) { - if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) { - PyErr_Format(PyExc_ValueError, - "Buffer is not indirectly accessible " - "in dimension %d.", dim); - goto fail; - } - } - return 1; -fail: - return 0; -} -static int -__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) -{ - int i; - if (c_or_f_flag & __Pyx_IS_F_CONTIG) { - Py_ssize_t stride = 1; - for (i = 0; i < ndim; i++) { - if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { - PyErr_SetString(PyExc_ValueError, - "Buffer not fortran contiguous."); - goto fail; - } - stride = stride * buf->shape[i]; - } - } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) { - Py_ssize_t stride = 1; - for (i = ndim - 1; i >- 1; i--) { - if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { - PyErr_SetString(PyExc_ValueError, - "Buffer not C contiguous."); - goto fail; - } - stride = stride * buf->shape[i]; - } - } - return 1; -fail: - return 0; -} -static int __Pyx_ValidateAndInit_memviewslice( - int *axes_specs, - int c_or_f_flag, - int buf_flags, - int ndim, - __Pyx_TypeInfo *dtype, - __Pyx_BufFmt_StackElem stack[], - __Pyx_memviewslice *memviewslice, - PyObject *original_obj) -{ - struct __pyx_memoryview_obj *memview, *new_memview; - __Pyx_RefNannyDeclarations - Py_buffer *buf; - int i, spec = 0, retval = -1; - __Pyx_BufFmt_Context ctx; - int from_memoryview = __pyx_memoryview_check(original_obj); - __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0); - if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *) - original_obj)->typeinfo)) { - memview = (struct __pyx_memoryview_obj *) original_obj; - new_memview = NULL; - } else { - memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( - original_obj, buf_flags, 0, dtype); - new_memview = memview; - if (unlikely(!memview)) - goto fail; - } - buf = &memview->view; - if (unlikely(buf->ndim != ndim)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - ndim, buf->ndim); - goto fail; - } - if (new_memview) { - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail; - } - if (unlikely((unsigned) buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) " - "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)", - buf->itemsize, - (buf->itemsize > 1) ? "s" : "", - dtype->name, - dtype->size, - (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->len > 0) { - for (i = 0; i < ndim; i++) { - spec = axes_specs[i]; - if (unlikely(!__pyx_check_strides(buf, i, ndim, spec))) - goto fail; - if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec))) - goto fail; - } - if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))) - goto fail; - } - if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice, - new_memview != NULL) == -1)) { - goto fail; - } - retval = 0; - goto no_fail; -fail: - Py_XDECREF(new_memview); - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} - -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_int(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 3, - &__Pyx_TypeInfo_int, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 3, - &__Pyx_TypeInfo_float, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, - &__Pyx_TypeInfo_int, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice -__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, - const char *mode, int ndim, - size_t sizeof_dtype, int contig_flag, - int dtype_is_object) -{ - __Pyx_RefNannyDeclarations - int i; - __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } }; - struct __pyx_memoryview_obj *from_memview = from_mvs->memview; - Py_buffer *buf = &from_memview->view; - PyObject *shape_tuple = NULL; - PyObject *temp_int = NULL; - struct __pyx_array_obj *array_obj = NULL; - struct __pyx_memoryview_obj *memview_obj = NULL; - __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); - for (i = 0; i < ndim; i++) { - if (unlikely(from_mvs->suboffsets[i] >= 0)) { - PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " - "indirect dimensions (axis %d)", i); - goto fail; - } - } - shape_tuple = PyTuple_New(ndim); - if (unlikely(!shape_tuple)) { - goto fail; - } - __Pyx_GOTREF(shape_tuple); - for(i = 0; i < ndim; i++) { - temp_int = PyInt_FromSsize_t(from_mvs->shape[i]); - if(unlikely(!temp_int)) { - goto fail; - } else { - PyTuple_SET_ITEM(shape_tuple, i, temp_int); - temp_int = NULL; - } - } - array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL); - if (unlikely(!array_obj)) { - goto fail; - } - __Pyx_GOTREF(array_obj); - memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( - (PyObject *) array_obj, contig_flag, - dtype_is_object, - from_mvs->memview->typeinfo); - if (unlikely(!memview_obj)) - goto fail; - if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) - goto fail; - if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, - dtype_is_object) < 0)) - goto fail; - goto no_fail; -fail: - __Pyx_XDECREF(new_mvs.memview); - new_mvs.memview = NULL; - new_mvs.data = NULL; -no_fail: - __Pyx_XDECREF(shape_tuple); - __Pyx_XDECREF(temp_int); - __Pyx_XDECREF(array_obj); - __Pyx_RefNannyFinishContext(); - return new_mvs; -} - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; - } - } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; - } - } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - __pyx_nonatomic_int_type old_acquisition_count; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - return; - } - old_acquisition_count = __pyx_add_acquisition_count(memview); - if (unlikely(old_acquisition_count <= 0)) { - if (likely(old_acquisition_count == 0)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } else { - __pyx_fatalerror("Acquisition count is %d (line %d)", - old_acquisition_count+1, lineno); - } - } -} -static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - __pyx_nonatomic_int_type old_acquisition_count; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - old_acquisition_count = __pyx_sub_acquisition_count(memview); - memslice->data = NULL; - if (likely(old_acquisition_count > 1)) { - memslice->memview = NULL; - } else if (likely(old_acquisition_count == 1)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - __pyx_fatalerror("Acquisition count is %d (line %d)", - old_acquisition_count-1, lineno); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(int) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(int) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (int) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (int) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (int) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (int) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(long) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(long) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (long) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (long) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (long) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (long) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const char neg_one = (char) -1, const_zero = (char) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(char) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (char) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (char) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(char) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(char) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - char val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (char) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (char) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (char) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (char) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (char) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((char) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((char) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (char) -1; - } - } else { - char val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (char) -1; - val = __Pyx_PyInt_As_char(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to char"); - return (char) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to char"); - return (char) -1; -} - -/* FormatTypeName */ - #if CYTHON_COMPILING_IN_LIMITED_API -static __Pyx_TypeName -__Pyx_PyType_GetName(PyTypeObject* tp) -{ - PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_n_s_name_2); - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { - PyErr_Clear(); - Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__23)); - } - return name; -} -#endif - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[5]; - int same=1, i, found_dot; - const char* rt_from_call = Py_GetVersion(); - PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - found_dot = 0; - for (i = 0; i < 4; i++) { - if (!ctversion[i]) { - same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); - break; - } - if (rt_from_call[i] != ctversion[i]) { - same = 0; - break; - } - } - if (!same) { - char rtversion[5] = {'\0'}; - char message[200]; - for (i=0; i<4; ++i) { - if (rt_from_call[i] == '.') { - if (found_dot) break; - found_dot = 1; - } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { - break; - } - rtversion[i] = rt_from_call[i]; - } - PyOS_snprintf(message, sizeof(message), - "compile time version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* InitStrings */ - #if PY_MAJOR_VERSION >= 3 -static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { - if (t.is_unicode | t.is_str) { - if (t.intern) { - *str = PyUnicode_InternFromString(t.s); - } else if (t.encoding) { - *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); - } else { - *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); - } - } else { - *str = PyBytes_FromStringAndSize(t.s, t.n - 1); - } - if (!*str) - return -1; - if (PyObject_Hash(*str) == -1) - return -1; - return 0; -} -#endif -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION >= 3 - __Pyx_InitString(*t, t->p); - #else - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - #endif - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { - __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " - "The ability to return an instance of a strict subclass of int is deprecated, " - "and may be removed in a future version of Python.", - result_type_name)) { - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; - } - __Pyx_DECREF_TypeName(result_type_name); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", - type_name, type_name, result_type_name); - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(__Pyx_PyLong_IsCompact(b))) { - return __Pyx_PyLong_CompactValue(b); - } else { - const digit* digits = __Pyx_PyLong_Digits(b); - const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { - if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { - return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); -#if PY_MAJOR_VERSION < 3 - } else if (likely(PyInt_CheckExact(o))) { - return PyInt_AS_LONG(o); -#endif - } else { - Py_ssize_t ival; - PyObject *x; - x = PyNumber_Index(o); - if (!x) return -1; - ival = PyInt_AsLong(x); - Py_DECREF(x); - return ival; - } -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -/* #### Code section: utility_code_pragmas_end ### */ -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - - - -/* #### Code section: end ### */ -#endif /* Py_PYTHON_H */ diff --git a/spaces/digitalxingtong/Nailv-read-Bert-Vits2/monotonic_align/core.c b/spaces/digitalxingtong/Nailv-read-Bert-Vits2/monotonic_align/core.c deleted file mode 100644 index 5f8af54d32474f821e9d1f4d2679d78128722596..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Nailv-read-Bert-Vits2/monotonic_align/core.c +++ /dev/null @@ -1,26530 +0,0 @@ -/* Generated by Cython 3.0.0 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "name": "monotonic_align.core", - "sources": [ - "core.pyx" - ] - }, - "module_name": "monotonic_align.core" -} -END: Cython Metadata */ - -#ifndef PY_SSIZE_T_CLEAN -#define PY_SSIZE_T_CLEAN -#endif /* PY_SSIZE_T_CLEAN */ -#if defined(CYTHON_LIMITED_API) && 0 - #ifndef Py_LIMITED_API - #if CYTHON_LIMITED_API+0 > 0x03030000 - #define Py_LIMITED_API CYTHON_LIMITED_API - #else - #define Py_LIMITED_API 0x03030000 - #endif - #endif -#endif - -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.7+ or Python 3.3+. -#else -#define CYTHON_ABI "3_0_0" -#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI -#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x030000F0 -#define CYTHON_FUTURE_DIVISION 1 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #define HAVE_LONG_LONG -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#if defined(GRAALVM_PYTHON) - /* For very preliminary testing purposes. Most variables are set the same as PyPy. - The existence of this section does not imply that anything works or is even tested */ - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 1 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) - #endif - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(PYPY_VERSION) - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) - #endif - #if PY_VERSION_HEX < 0x03090000 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(CYTHON_LIMITED_API) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 1 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #undef CYTHON_CLINE_IN_TRACEBACK - #define CYTHON_CLINE_IN_TRACEBACK 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 1 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #endif - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL 0 - #undef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 1 - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(PY_NOGIL) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #ifndef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #ifndef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #ifndef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) - #endif - #ifndef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #endif - #if PY_VERSION_HEX < 0x030400a1 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #elif !defined(CYTHON_USE_TP_FINALIZE) - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #if PY_VERSION_HEX < 0x030600B1 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #elif !defined(CYTHON_USE_DICT_VERSIONS) - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) - #endif - #if PY_VERSION_HEX < 0x030700A3 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK 1 - #endif - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if !defined(CYTHON_VECTORCALL) -#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) -#endif -#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED - #if defined(__cplusplus) - /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 - * but leads to warnings with -pedantic, since it is a C++17 feature */ - #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) - #if __has_cpp_attribute(maybe_unused) - #define CYTHON_UNUSED [[maybe_unused]] - #endif - #endif - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR - #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - #endif - #endif - #if _MSC_VER < 1300 - #ifdef _WIN64 - typedef unsigned long long __pyx_uintptr_t; - #else - typedef unsigned int __pyx_uintptr_t; - #endif - #else - #ifdef _WIN64 - typedef unsigned __int64 __pyx_uintptr_t; - #else - typedef unsigned __int32 __pyx_uintptr_t; - #endif - #endif -#else - #include - typedef uintptr_t __pyx_uintptr_t; -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) - /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 - * but leads to warnings with -pedantic, since it is a C++17 feature */ - #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif -#ifdef __cplusplus - template - struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; - #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) -#else - #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) -#endif -#if CYTHON_COMPILING_IN_PYPY == 1 - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) -#else - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) -#endif -#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_DefaultClassType PyClass_Type - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, - PyObject *code, PyObject *c, PyObject* n, PyObject *v, - PyObject *fv, PyObject *cell, PyObject* fn, - PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject *co=NULL, *result=NULL; - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(p))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; - if (!(empty = PyTuple_New(0))) goto end; - result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); - end: - Py_XDECREF((PyObject*) co); - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(empty); - if (type) { - PyErr_Restore(type, value, traceback); - } - return result; - } -#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif -#endif -#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) - #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) -#else - #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) - #define __Pyx_Py_Is(x, y) Py_Is(x, y) -#else - #define __Pyx_Py_Is(x, y) ((x) == (y)) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) - #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) -#else - #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) - #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) -#else - #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) -#endif -#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) - #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) -#else - #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) -#endif -#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) -#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) -#else - #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) -#endif -#ifndef CO_COROUTINE - #define CO_COROUTINE 0x80 -#endif -#ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x200 -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef Py_TPFLAGS_SEQUENCE - #define Py_TPFLAGS_SEQUENCE 0 -#endif -#ifndef Py_TPFLAGS_MAPPING - #define Py_TPFLAGS_MAPPING 0 -#endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_METH_FASTCALL - #define __Pyx_METH_FASTCALL METH_FASTCALL - #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast - #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords -#else - #define __Pyx_METH_FASTCALL METH_VARARGS - #define __Pyx_PyCFunction_FastCall PyCFunction - #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords -#endif -#if CYTHON_VECTORCALL - #define __pyx_vectorcallfunc vectorcallfunc - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET - #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) -#elif CYTHON_BACKPORT_VECTORCALL - typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, - size_t nargsf, PyObject *kwnames); - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) -#else - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) -#endif -#if PY_VERSION_HEX < 0x030900B1 - #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) - typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); -#else - #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) - #define __Pyx_PyCMethod PyCMethod -#endif -#ifndef METH_METHOD - #define METH_METHOD 0x200 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyThreadState_Current PyThreadState_Get() -#elif !CYTHON_FAST_THREAD_STATE - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) -{ - void *result; - result = PyModule_GetState(op); - if (!result) - Py_FatalError("Couldn't find the module state"); - return result; -} -#endif -#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) -#else - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if PY_MAJOR_VERSION < 3 - #if CYTHON_COMPILING_IN_PYPY - #if PYPY_VERSION_NUM < 0x07030600 - #if defined(__cplusplus) && __cplusplus >= 201402L - [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] - #elif defined(__GNUC__) || defined(__clang__) - __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) - #elif defined(_MSC_VER) - __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) - #endif - static CYTHON_INLINE int PyGILState_Check(void) { - return 0; - } - #else // PYPY_VERSION_NUM < 0x07030600 - #endif // PYPY_VERSION_NUM < 0x07030600 - #else - static CYTHON_INLINE int PyGILState_Check(void) { - PyThreadState * tstate = _PyThreadState_Current; - return tstate && (tstate == PyGILState_GetThisThreadState()); - } - #endif -#endif -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { - PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); - if (res == NULL) PyErr_Clear(); - return res; -} -#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) -#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError -#define __Pyx_PyDict_GetItemStr PyDict_GetItem -#else -static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { -#if CYTHON_COMPILING_IN_PYPY - return PyDict_GetItem(dict, name); -#else - PyDictEntry *ep; - PyDictObject *mp = (PyDictObject*) dict; - long hash = ((PyStringObject *) name)->ob_shash; - assert(hash != -1); - ep = (mp->ma_lookup)(mp, name, hash); - if (ep == NULL) { - return NULL; - } - return ep->me_value; -#endif -} -#define __Pyx_PyDict_GetItemStr PyDict_GetItem -#endif -#if CYTHON_USE_TYPE_SLOTS - #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) - #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) - #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) -#else - #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) - #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) - #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next -#endif -#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 -#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ - PyTypeObject *type = Py_TYPE(obj);\ - assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ - PyObject_GC_Del(obj);\ - Py_DECREF(type);\ -} -#else -#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) - #define __Pyx_PyUnicode_DATA(u) ((void*)u) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) -#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_READY(op) (0) - #else - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #endif - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) - #else - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif - #endif -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #if !defined(PyUnicode_DecodeUnicodeEscape) - #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) - #endif - #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) - #undef PyUnicode_Contains - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) - #endif - #if !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) - #endif - #if !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) - #endif -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #define __Pyx_PySequence_ListKeepNew(obj)\ - (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) -#else - #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) -#endif -#if PY_VERSION_HEX >= 0x030900A4 - #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) -#else - #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) - #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define __Pyx_Py3Int_Check(op) PyLong_Check(op) - #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#else - #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) - #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) - #if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES - #endif -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - -#define __PYX_MARK_ERR_POS(f_index, lineno) \ - { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } -#define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } - -#ifdef CYTHON_EXTERN_C - #undef __PYX_EXTERN_C - #define __PYX_EXTERN_C CYTHON_EXTERN_C -#elif defined(__PYX_EXTERN_C) - #ifdef _MSC_VER - #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") - #else - #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. - #endif -#else - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__monotonic_align__core -#define __PYX_HAVE_API__monotonic_align__core -/* Early includes */ -#include "pythread.h" -#include -#include -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) -{ - const wchar_t *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#endif -#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_VERSION_HEX >= 0x030C00A7 - #ifndef _PyLong_SIGN_MASK - #define _PyLong_SIGN_MASK 3 - #endif - #ifndef _PyLong_NON_SIZE_BITS - #define _PyLong_NON_SIZE_BITS 3 - #endif - #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) - #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) - #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) - #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) - #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) - #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) - #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_SignedDigitCount(x)\ - ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) - #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) - #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) - #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) - #else - #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) - #endif - typedef Py_ssize_t __Pyx_compact_pylong; - typedef size_t __Pyx_compact_upylong; - #else // Py < 3.12 - #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) - #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) - #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) - #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) - #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) - #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) - #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) - #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) - #define __Pyx_PyLong_CompactValue(x)\ - ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) - typedef sdigit __Pyx_compact_pylong; - typedef digit __Pyx_compact_upylong; - #endif - #if PY_VERSION_HEX >= 0x030C00A5 - #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) - #else - #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) - #endif -#endif -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = (char) c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -#if !CYTHON_USE_MODULE_STATE -static PyObject *__pyx_m = NULL; -#endif -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm = __FILE__; -static const char *__pyx_filename; - -/* #### Code section: filename_table ### */ - -static const char *__pyx_f[] = { - "core.pyx", - "", -}; -/* #### Code section: utility_code_proto_before_types ### */ -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* BufferFormatStructs.proto */ -struct __Pyx_StructField_; -#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) -typedef struct { - const char* name; - struct __Pyx_StructField_* fields; - size_t size; - size_t arraysize[8]; - int ndim; - char typegroup; - char is_unsigned; - int flags; -} __Pyx_TypeInfo; -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - size_t struct_alignment; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; - char is_valid_array; -} __Pyx_BufFmt_Context; - -/* Atomics.proto */ -#include -#ifndef CYTHON_ATOMICS - #define CYTHON_ATOMICS 1 -#endif -#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS -#define __pyx_atomic_int_type int -#define __pyx_nonatomic_int_type int -#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ - (__STDC_VERSION__ >= 201112L) &&\ - !defined(__STDC_NO_ATOMICS__)) - #include -#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ - (__cplusplus >= 201103L) ||\ - (defined(_MSC_VER) && _MSC_VER >= 1700))) - #include -#endif -#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ - (__STDC_VERSION__ >= 201112L) &&\ - !defined(__STDC_NO_ATOMICS__) &&\ - ATOMIC_INT_LOCK_FREE == 2) - #undef __pyx_atomic_int_type - #define __pyx_atomic_int_type atomic_int - #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) - #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) - #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) - #pragma message ("Using standard C atomics") - #elif defined(__PYX_DEBUG_ATOMICS) - #warning "Using standard C atomics" - #endif -#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ - (__cplusplus >= 201103L) ||\ -\ - (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ - ATOMIC_INT_LOCK_FREE == 2) - #undef __pyx_atomic_int_type - #define __pyx_atomic_int_type std::atomic_int - #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) - #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) - #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) - #pragma message ("Using standard C++ atomics") - #elif defined(__PYX_DEBUG_ATOMICS) - #warning "Using standard C++ atomics" - #endif -#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ - (__GNUC_MINOR__ > 1 ||\ - (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) - #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) - #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1) - #ifdef __PYX_DEBUG_ATOMICS - #warning "Using GNU atomics" - #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) - #include - #undef __pyx_atomic_int_type - #define __pyx_atomic_int_type long - #define __pyx_nonatomic_int_type long - #pragma intrinsic (_InterlockedExchangeAdd) - #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) - #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) - #ifdef __PYX_DEBUG_ATOMICS - #pragma message ("Using MSVC atomics") - #endif -#else - #undef CYTHON_ATOMICS - #define CYTHON_ATOMICS 0 - #ifdef __PYX_DEBUG_ATOMICS - #warning "Not using atomics" - #endif -#endif -#if CYTHON_ATOMICS - #define __pyx_add_acquisition_count(memview)\ - __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) - #define __pyx_sub_acquisition_count(memview)\ - __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview)) -#else - #define __pyx_add_acquisition_count(memview)\ - __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) - #define __pyx_sub_acquisition_count(memview)\ - __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) -#endif - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - -/* #### Code section: numeric_typedefs ### */ -/* #### Code section: complex_type_declarations ### */ -/* #### Code section: type_declarations ### */ - -/*--- Type declarations ---*/ -struct __pyx_array_obj; -struct __pyx_MemviewEnum_obj; -struct __pyx_memoryview_obj; -struct __pyx_memoryviewslice_obj; -struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each; - -/* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ -struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each { - int __pyx_n; - float max_neg_val; -}; - -/* "View.MemoryView":114 - * @cython.collection_type("sequence") - * @cname("__pyx_array") - * cdef class array: # <<<<<<<<<<<<<< - * - * cdef: - */ -struct __pyx_array_obj { - PyObject_HEAD - struct __pyx_vtabstruct_array *__pyx_vtab; - char *data; - Py_ssize_t len; - char *format; - int ndim; - Py_ssize_t *_shape; - Py_ssize_t *_strides; - Py_ssize_t itemsize; - PyObject *mode; - PyObject *_format; - void (*callback_free_data)(void *); - int free_data; - int dtype_is_object; -}; - - -/* "View.MemoryView":302 - * - * @cname('__pyx_MemviewEnum') - * cdef class Enum(object): # <<<<<<<<<<<<<< - * cdef object name - * def __init__(self, name): - */ -struct __pyx_MemviewEnum_obj { - PyObject_HEAD - PyObject *name; -}; - - -/* "View.MemoryView":337 - * - * @cname('__pyx_memoryview') - * cdef class memoryview: # <<<<<<<<<<<<<< - * - * cdef object obj - */ -struct __pyx_memoryview_obj { - PyObject_HEAD - struct __pyx_vtabstruct_memoryview *__pyx_vtab; - PyObject *obj; - PyObject *_size; - PyObject *_array_interface; - PyThread_type_lock lock; - __pyx_atomic_int_type acquisition_count; - Py_buffer view; - int flags; - int dtype_is_object; - __Pyx_TypeInfo *typeinfo; -}; - - -/* "View.MemoryView":952 - * @cython.collection_type("sequence") - * @cname('__pyx_memoryviewslice') - * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< - * "Internal class for passing memoryview slices to Python" - * - */ -struct __pyx_memoryviewslice_obj { - struct __pyx_memoryview_obj __pyx_base; - __Pyx_memviewslice from_slice; - PyObject *from_object; - PyObject *(*to_object_func)(char *); - int (*to_dtype_func)(char *, PyObject *); -}; - - - -/* "View.MemoryView":114 - * @cython.collection_type("sequence") - * @cname("__pyx_array") - * cdef class array: # <<<<<<<<<<<<<< - * - * cdef: - */ - -struct __pyx_vtabstruct_array { - PyObject *(*get_memview)(struct __pyx_array_obj *); -}; -static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; - - -/* "View.MemoryView":337 - * - * @cname('__pyx_memoryview') - * cdef class memoryview: # <<<<<<<<<<<<<< - * - * cdef object obj - */ - -struct __pyx_vtabstruct_memoryview { - char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); - PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); - PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); - PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); - PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); - PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); - PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); - PyObject *(*_get_base)(struct __pyx_memoryview_obj *); -}; -static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; - - -/* "View.MemoryView":952 - * @cython.collection_type("sequence") - * @cname('__pyx_memoryviewslice') - * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< - * "Internal class for passing memoryview slices to Python" - * - */ - -struct __pyx_vtabstruct__memoryviewslice { - struct __pyx_vtabstruct_memoryview __pyx_base; -}; -static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; -/* #### Code section: utility_code_proto ### */ - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, Py_ssize_t); - void (*DECREF)(void*, PyObject*, Py_ssize_t); - void (*GOTREF)(void*, PyObject*, Py_ssize_t); - void (*GIVEREF)(void*, PyObject*, Py_ssize_t); - void* (*SetupContext)(const char*, Py_ssize_t, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - } - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) - #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() -#endif - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) - #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContextNogil() - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_Py_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; Py_XDECREF(tmp);\ - } while (0) -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#if PY_VERSION_HEX >= 0x030C00A6 -#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) -#else -#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) -#endif -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) -#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* TupleAndListFromArray.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); -static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); -#endif - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* fastcall.proto */ -#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) -#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) -#define __Pyx_KwValues_VARARGS(args, nargs) NULL -#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) -#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) -#if CYTHON_METH_FASTCALL - #define __Pyx_Arg_FASTCALL(args, i) args[i] - #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) - #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) - static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); - #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) -#else - #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS - #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS - #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS - #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS - #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS -#endif -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) -#else -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) -#endif - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, - const char* function_name); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#if !CYTHON_VECTORCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif -#if !CYTHON_VECTORCALL -#if PY_VERSION_HEX >= 0x03080000 - #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif - #define __Pxy_PyFrame_Initialize_Offsets() - #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) -#else - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif -#endif -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectFastCall.proto */ -#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); - -/* RaiseUnexpectedTypeError.proto */ -static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); - -/* GCCDiagnostics.proto */ -#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - -/* BuildPyUnicode.proto */ -static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, - int prepend_sign, char padding_char); - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); - -/* JoinPyUnicode.proto */ -static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, - Py_UCS4 max_char); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* PyObjectFormatSimple.proto */ -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - PyObject_Format(s, f)) -#elif PY_MAJOR_VERSION < 3 - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ - PyObject_Format(s, f)) -#elif CYTHON_USE_TYPE_SLOTS - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ - likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ - PyObject_Format(s, f)) -#else - #define __Pyx_PyObject_FormatSimple(s, f) (\ - likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ - PyObject_Format(s, f)) -#endif - -CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* KeywordStringCheck.proto */ -static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); - -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -/* UnaryNegOverflows.proto */ -#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) do {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* AssertionsEnabled.proto */ -#define __Pyx_init_assertions_enabled() -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define __pyx_assertions_enabled() (1) -#elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API) - #define __pyx_assertions_enabled() (!Py_OptimizeFlag) -#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6 - static int __pyx_assertions_enabled_flag; - #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) - #undef __Pyx_init_assertions_enabled - static void __Pyx_init_assertions_enabled(void) { - __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level; - } -#else - #define __pyx_assertions_enabled() (!Py_OptimizeFlag) -#endif - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportDottedModule.proto */ -static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); -#endif - -/* ssize_strlen.proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* PySequenceMultiply.proto */ -#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) -static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); - -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* RaiseUnboundLocalError.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* DivInt[long].proto */ -static CYTHON_INLINE long __Pyx_div_long(long, long); - -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* HasAttr.proto */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); - -/* ErrOccurredWithGIL.proto */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); - -/* PyObject_GenericGetAttrNoDict.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr -#endif - -/* PyObject_GenericGetAttr.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr -#endif - -/* IncludeStructmemberH.proto */ -#include - -/* FixUpExtensionType.proto */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); -#endif - -/* PyObjectCallNoArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); - -/* PyObjectGetMethod.proto */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); - -/* PyObjectCallMethod0.proto */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); - -/* ValidateBasesTuple.proto */ -#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS -static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); -#endif - -/* PyType_Ready.proto */ -CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyTypeObject *type); - -/* MergeVTables.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_MergeVtables(PyTypeObject *type); -#endif - -/* SetupReduce.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_setup_reduce(PyObject* type_obj); -#endif - -/* FetchSharedCythonModule.proto */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void); - -/* FetchCommonType.proto */ -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -#else -static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); -#endif - -/* PyMethodNew.proto */ -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { - CYTHON_UNUSED_VAR(typ); - if (!self) - return __Pyx_NewRef(func); - return PyMethod_New(func, self); -} -#else - #define __Pyx_PyMethod_New PyMethod_New -#endif - -/* PyVectorcallFastCallDict.proto */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); -#endif - -/* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CYFUNCTION_COROUTINE 0x08 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#if PY_VERSION_HEX < 0x030900B1 - #define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#else - #define __Pyx_CyFunction_GetClassObj(f)\ - ((PyObject*) ((PyCMethodObject *) (f))->mm_class) -#endif -#define __Pyx_CyFunction_SetClassObj(f, classobj)\ - __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { -#if PY_VERSION_HEX < 0x030900B1 - PyCFunctionObject func; -#else - PyCMethodObject func; -#endif -#if CYTHON_BACKPORT_VECTORCALL - __pyx_vectorcallfunc func_vectorcall; -#endif -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; -#if PY_VERSION_HEX < 0x030900B1 - PyObject *func_classobj; -#endif - void *defaults; - int defaults_pyobjects; - size_t defaults_size; // used by FusedFunction for copying defaults - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; - PyObject *func_is_coroutine; -} __pyx_CyFunctionObject; -#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) -#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) -#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(PyObject *module); -#if CYTHON_METH_FASTCALL -static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); -#if CYTHON_BACKPORT_VECTORCALL -#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) -#else -#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) -#endif -#endif - -/* CythonFunction.proto */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); -#endif - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -#if PY_MAJOR_VERSION < 3 - static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); - static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else - #define __Pyx_GetBuffer PyObject_GetBuffer - #define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - - -/* BufferStructDeclare.proto */ -typedef struct { - Py_ssize_t shape, strides, suboffsets; -} __Pyx_Buf_DimInfo; -typedef struct { - size_t refcount; - Py_buffer pybuffer; -} __Pyx_Buffer; -typedef struct { - __Pyx_Buffer *rcbuffer; - char *data; - __Pyx_Buf_DimInfo diminfo[8]; -} __Pyx_LocalBuf_ND; - -/* MemviewSliceIsContig.proto */ -static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); - -/* OverlappingSlices.proto */ -static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, - __Pyx_memviewslice *slice2, - int ndim, size_t itemsize); - -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); - -/* TypeInfoCompare.proto */ -static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); - -/* MemviewSliceValidateAndInit.proto */ -static int __Pyx_ValidateAndInit_memviewslice( - int *axes_specs, - int c_or_f_flag, - int buf_flags, - int ndim, - __Pyx_TypeInfo *dtype, - __Pyx_BufFmt_StackElem stack[], - __Pyx_memviewslice *memviewslice, - PyObject *original_obj); - -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_int(PyObject *, int writable_flag); - -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float(PyObject *, int writable_flag); - -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *, int writable_flag); - -/* MemviewSliceCopyTemplate.proto */ -static __Pyx_memviewslice -__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, - const char *mode, int ndim, - size_t sizeof_dtype, int contig_flag, - int dtype_is_object); - -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); - -/* FormatTypeName.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -typedef PyObject *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%U" -static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); -#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) -#else -typedef const char *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%.200s" -#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) -#define __Pyx_DECREF_TypeName(obj) -#endif - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -/* #### Code section: module_declarations ### */ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ -static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ - -/* Module declarations from "cython.view" */ - -/* Module declarations from "cython.dataclasses" */ - -/* Module declarations from "cython" */ - -/* Module declarations from "monotonic_align.core" */ -static PyObject *__pyx_collections_abc_Sequence = 0; -static PyObject *generic = 0; -static PyObject *strided = 0; -static PyObject *indirect = 0; -static PyObject *contiguous = 0; -static PyObject *indirect_contiguous = 0; -static int __pyx_memoryview_thread_locks_used; -static PyThread_type_lock __pyx_memoryview_thread_locks[8]; -static void __pyx_f_15monotonic_align_4core_maximum_path_each(__Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each *__pyx_optional_args); /*proto*/ -static void __pyx_f_15monotonic_align_4core_maximum_path_c(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ -static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ -static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ -static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ -static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ -static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ -static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ -static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ -static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ -static int __pyx_memoryview_err_no_memory(void); /*proto*/ -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ -static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ -static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ -/* #### Code section: typeinfo ### */ -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 }; -/* #### Code section: before_global_var ### */ -#define __Pyx_MODULE_NAME "monotonic_align.core" -extern int __pyx_module_is_main_monotonic_align__core; -int __pyx_module_is_main_monotonic_align__core = 0; - -/* Implementation of "monotonic_align.core" */ -/* #### Code section: global_var ### */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin___import__; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_MemoryError; -static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_TypeError; -static PyObject *__pyx_builtin_AssertionError; -static PyObject *__pyx_builtin_Ellipsis; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_IndexError; -/* #### Code section: string_decls ### */ -static const char __pyx_k_[] = ": "; -static const char __pyx_k_O[] = "O"; -static const char __pyx_k_c[] = "c"; -static const char __pyx_k__2[] = "."; -static const char __pyx_k__3[] = "*"; -static const char __pyx_k__6[] = "'"; -static const char __pyx_k__7[] = ")"; -static const char __pyx_k_gc[] = "gc"; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k__23[] = "?"; -static const char __pyx_k_abc[] = "abc"; -static const char __pyx_k_and[] = " and "; -static const char __pyx_k_got[] = " (got "; -static const char __pyx_k_new[] = "__new__"; -static const char __pyx_k_obj[] = "obj"; -static const char __pyx_k_sys[] = "sys"; -static const char __pyx_k_base[] = "base"; -static const char __pyx_k_dict[] = "__dict__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_mode[] = "mode"; -static const char __pyx_k_name[] = "name"; -static const char __pyx_k_ndim[] = "ndim"; -static const char __pyx_k_pack[] = "pack"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_spec[] = "__spec__"; -static const char __pyx_k_step[] = "step"; -static const char __pyx_k_stop[] = "stop"; -static const char __pyx_k_t_xs[] = "t_xs"; -static const char __pyx_k_t_ys[] = "t_ys"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_ASCII[] = "ASCII"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_count[] = "count"; -static const char __pyx_k_error[] = "error"; -static const char __pyx_k_flags[] = "flags"; -static const char __pyx_k_index[] = "index"; -static const char __pyx_k_paths[] = "paths"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_shape[] = "shape"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_enable[] = "enable"; -static const char __pyx_k_encode[] = "encode"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_name_2[] = "__name__"; -static const char __pyx_k_pickle[] = "pickle"; -static const char __pyx_k_reduce[] = "__reduce__"; -static const char __pyx_k_struct[] = "struct"; -static const char __pyx_k_unpack[] = "unpack"; -static const char __pyx_k_update[] = "update"; -static const char __pyx_k_values[] = "values"; -static const char __pyx_k_disable[] = "disable"; -static const char __pyx_k_fortran[] = "fortran"; -static const char __pyx_k_memview[] = "memview"; -static const char __pyx_k_Ellipsis[] = "Ellipsis"; -static const char __pyx_k_Sequence[] = "Sequence"; -static const char __pyx_k_core_pyx[] = "core.pyx"; -static const char __pyx_k_getstate[] = "__getstate__"; -static const char __pyx_k_itemsize[] = "itemsize"; -static const char __pyx_k_pyx_type[] = "__pyx_type"; -static const char __pyx_k_register[] = "register"; -static const char __pyx_k_setstate[] = "__setstate__"; -static const char __pyx_k_TypeError[] = "TypeError"; -static const char __pyx_k_enumerate[] = "enumerate"; -static const char __pyx_k_isenabled[] = "isenabled"; -static const char __pyx_k_pyx_state[] = "__pyx_state"; -static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; -static const char __pyx_k_IndexError[] = "IndexError"; -static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_pyx_result[] = "__pyx_result"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_MemoryError[] = "MemoryError"; -static const char __pyx_k_PickleError[] = "PickleError"; -static const char __pyx_k_collections[] = "collections"; -static const char __pyx_k_initializing[] = "_initializing"; -static const char __pyx_k_is_coroutine[] = "_is_coroutine"; -static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = ""; -static const char __pyx_k_version_info[] = "version_info"; -static const char __pyx_k_class_getitem[] = "__class_getitem__"; -static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; -static const char __pyx_k_AssertionError[] = "AssertionError"; -static const char __pyx_k_maximum_path_c[] = "maximum_path_c"; -static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; -static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; -static const char __pyx_k_collections_abc[] = "collections.abc"; -static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; -static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; -static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; -static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; -static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_strided_and_direct[] = ""; -static const char __pyx_k_monotonic_align_core[] = "monotonic_align.core"; -static const char __pyx_k_strided_and_indirect[] = ""; -static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; -static const char __pyx_k_contiguous_and_direct[] = ""; -static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; -static const char __pyx_k_MemoryView_of_r_object[] = ""; -static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; -static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; -static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; -static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; -static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; -static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; -static const char __pyx_k_strided_and_direct_or_indirect[] = ""; -static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; -static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; -static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; -static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; -static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; -static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; -static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; -static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; -static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; -static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; -static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; -/* #### Code section: decls ### */ -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_15monotonic_align_4core_maximum_path_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs); /* proto */ -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -/* #### Code section: late_includes ### */ -/* #### Code section: module_state ### */ -typedef struct { - PyObject *__pyx_d; - PyObject *__pyx_b; - PyObject *__pyx_cython_runtime; - PyObject *__pyx_empty_tuple; - PyObject *__pyx_empty_bytes; - PyObject *__pyx_empty_unicode; - #ifdef __Pyx_CyFunction_USED - PyTypeObject *__pyx_CyFunctionType; - #endif - #ifdef __Pyx_FusedFunction_USED - PyTypeObject *__pyx_FusedFunctionType; - #endif - #ifdef __Pyx_Generator_USED - PyTypeObject *__pyx_GeneratorType; - #endif - #ifdef __Pyx_IterableCoroutine_USED - PyTypeObject *__pyx_IterableCoroutineType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineAwaitType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineType; - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - PyObject *__pyx_type___pyx_array; - PyObject *__pyx_type___pyx_MemviewEnum; - PyObject *__pyx_type___pyx_memoryview; - PyObject *__pyx_type___pyx_memoryviewslice; - #endif - PyTypeObject *__pyx_array_type; - PyTypeObject *__pyx_MemviewEnum_type; - PyTypeObject *__pyx_memoryview_type; - PyTypeObject *__pyx_memoryviewslice_type; - PyObject *__pyx_kp_u_; - PyObject *__pyx_n_s_ASCII; - PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; - PyObject *__pyx_n_s_AssertionError; - PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; - PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; - PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; - PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; - PyObject *__pyx_kp_u_Cannot_index_with_type; - PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; - PyObject *__pyx_kp_s_Dimension_d_is_not_direct; - PyObject *__pyx_n_s_Ellipsis; - PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; - PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; - PyObject *__pyx_n_s_IndexError; - PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; - PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; - PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; - PyObject *__pyx_kp_u_Invalid_shape_in_axis; - PyObject *__pyx_n_s_MemoryError; - PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; - PyObject *__pyx_kp_s_MemoryView_of_r_object; - PyObject *__pyx_n_b_O; - PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; - PyObject *__pyx_n_s_PickleError; - PyObject *__pyx_n_s_Sequence; - PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; - PyObject *__pyx_n_s_TypeError; - PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; - PyObject *__pyx_n_s_ValueError; - PyObject *__pyx_n_s_View_MemoryView; - PyObject *__pyx_kp_u__2; - PyObject *__pyx_n_s__23; - PyObject *__pyx_n_s__3; - PyObject *__pyx_kp_u__6; - PyObject *__pyx_kp_u__7; - PyObject *__pyx_n_s_abc; - PyObject *__pyx_n_s_allocate_buffer; - PyObject *__pyx_kp_u_and; - PyObject *__pyx_n_s_asyncio_coroutines; - PyObject *__pyx_n_s_base; - PyObject *__pyx_n_s_c; - PyObject *__pyx_n_u_c; - PyObject *__pyx_n_s_class; - PyObject *__pyx_n_s_class_getitem; - PyObject *__pyx_n_s_cline_in_traceback; - PyObject *__pyx_n_s_collections; - PyObject *__pyx_kp_s_collections_abc; - PyObject *__pyx_kp_s_contiguous_and_direct; - PyObject *__pyx_kp_s_contiguous_and_indirect; - PyObject *__pyx_kp_s_core_pyx; - PyObject *__pyx_n_s_count; - PyObject *__pyx_n_s_dict; - PyObject *__pyx_kp_u_disable; - PyObject *__pyx_n_s_dtype_is_object; - PyObject *__pyx_kp_u_enable; - PyObject *__pyx_n_s_encode; - PyObject *__pyx_n_s_enumerate; - PyObject *__pyx_n_s_error; - PyObject *__pyx_n_s_flags; - PyObject *__pyx_n_s_format; - PyObject *__pyx_n_s_fortran; - PyObject *__pyx_n_u_fortran; - PyObject *__pyx_kp_u_gc; - PyObject *__pyx_n_s_getstate; - PyObject *__pyx_kp_u_got; - PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; - PyObject *__pyx_n_s_id; - PyObject *__pyx_n_s_import; - PyObject *__pyx_n_s_index; - PyObject *__pyx_n_s_initializing; - PyObject *__pyx_n_s_is_coroutine; - PyObject *__pyx_kp_u_isenabled; - PyObject *__pyx_n_s_itemsize; - PyObject *__pyx_kp_s_itemsize_0_for_cython_array; - PyObject *__pyx_n_s_main; - PyObject *__pyx_n_s_maximum_path_c; - PyObject *__pyx_n_s_memview; - PyObject *__pyx_n_s_mode; - PyObject *__pyx_n_s_monotonic_align_core; - PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_name_2; - PyObject *__pyx_n_s_ndim; - PyObject *__pyx_n_s_new; - PyObject *__pyx_kp_s_no_default___reduce___due_to_non; - PyObject *__pyx_n_s_obj; - PyObject *__pyx_n_s_pack; - PyObject *__pyx_n_s_paths; - PyObject *__pyx_n_s_pickle; - PyObject *__pyx_n_s_pyx_PickleError; - PyObject *__pyx_n_s_pyx_checksum; - PyObject *__pyx_n_s_pyx_result; - PyObject *__pyx_n_s_pyx_state; - PyObject *__pyx_n_s_pyx_type; - PyObject *__pyx_n_s_pyx_unpickle_Enum; - PyObject *__pyx_n_s_pyx_vtable; - PyObject *__pyx_n_s_range; - PyObject *__pyx_n_s_reduce; - PyObject *__pyx_n_s_reduce_cython; - PyObject *__pyx_n_s_reduce_ex; - PyObject *__pyx_n_s_register; - PyObject *__pyx_n_s_setstate; - PyObject *__pyx_n_s_setstate_cython; - PyObject *__pyx_n_s_shape; - PyObject *__pyx_n_s_size; - PyObject *__pyx_n_s_spec; - PyObject *__pyx_n_s_start; - PyObject *__pyx_n_s_step; - PyObject *__pyx_n_s_stop; - PyObject *__pyx_kp_s_strided_and_direct; - PyObject *__pyx_kp_s_strided_and_direct_or_indirect; - PyObject *__pyx_kp_s_strided_and_indirect; - PyObject *__pyx_kp_s_stringsource; - PyObject *__pyx_n_s_struct; - PyObject *__pyx_n_s_sys; - PyObject *__pyx_n_s_t_xs; - PyObject *__pyx_n_s_t_ys; - PyObject *__pyx_n_s_test; - PyObject *__pyx_kp_s_unable_to_allocate_array_data; - PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; - PyObject *__pyx_n_s_unpack; - PyObject *__pyx_n_s_update; - PyObject *__pyx_n_s_values; - PyObject *__pyx_n_s_version_info; - PyObject *__pyx_int_0; - PyObject *__pyx_int_1; - PyObject *__pyx_int_3; - PyObject *__pyx_int_112105877; - PyObject *__pyx_int_136983863; - PyObject *__pyx_int_184977713; - PyObject *__pyx_int_neg_1; - float __pyx_k__9; - PyObject *__pyx_slice__5; - PyObject *__pyx_tuple__4; - PyObject *__pyx_tuple__8; - PyObject *__pyx_tuple__10; - PyObject *__pyx_tuple__11; - PyObject *__pyx_tuple__12; - PyObject *__pyx_tuple__13; - PyObject *__pyx_tuple__14; - PyObject *__pyx_tuple__15; - PyObject *__pyx_tuple__16; - PyObject *__pyx_tuple__17; - PyObject *__pyx_tuple__18; - PyObject *__pyx_tuple__19; - PyObject *__pyx_tuple__21; - PyObject *__pyx_codeobj__20; - PyObject *__pyx_codeobj__22; -} __pyx_mstate; - -#if CYTHON_USE_MODULE_STATE -#ifdef __cplusplus -namespace { - extern struct PyModuleDef __pyx_moduledef; -} /* anonymous namespace */ -#else -static struct PyModuleDef __pyx_moduledef; -#endif - -#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - -#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - -#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) -#else -static __pyx_mstate __pyx_mstate_global_static = -#ifdef __cplusplus - {}; -#else - {0}; -#endif -static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; -#endif -/* #### Code section: module_state_clear ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_clear(PyObject *m) { - __pyx_mstate *clear_module_state = __pyx_mstate(m); - if (!clear_module_state) return 0; - Py_CLEAR(clear_module_state->__pyx_d); - Py_CLEAR(clear_module_state->__pyx_b); - Py_CLEAR(clear_module_state->__pyx_cython_runtime); - Py_CLEAR(clear_module_state->__pyx_empty_tuple); - Py_CLEAR(clear_module_state->__pyx_empty_bytes); - Py_CLEAR(clear_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_CLEAR(clear_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); - #endif - Py_CLEAR(clear_module_state->__pyx_array_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_array); - Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); - Py_CLEAR(clear_module_state->__pyx_memoryview_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); - Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); - Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); - Py_CLEAR(clear_module_state->__pyx_kp_u_); - Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); - Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); - Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); - Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); - Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); - Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); - Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); - Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); - Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); - Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); - Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); - Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); - Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); - Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); - Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); - Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); - Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); - Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); - Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); - Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); - Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); - Py_CLEAR(clear_module_state->__pyx_n_b_O); - Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); - Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); - Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); - Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); - Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); - Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); - Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); - Py_CLEAR(clear_module_state->__pyx_kp_u__2); - Py_CLEAR(clear_module_state->__pyx_n_s__23); - Py_CLEAR(clear_module_state->__pyx_n_s__3); - Py_CLEAR(clear_module_state->__pyx_kp_u__6); - Py_CLEAR(clear_module_state->__pyx_kp_u__7); - Py_CLEAR(clear_module_state->__pyx_n_s_abc); - Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); - Py_CLEAR(clear_module_state->__pyx_kp_u_and); - Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); - Py_CLEAR(clear_module_state->__pyx_n_s_base); - Py_CLEAR(clear_module_state->__pyx_n_s_c); - Py_CLEAR(clear_module_state->__pyx_n_u_c); - Py_CLEAR(clear_module_state->__pyx_n_s_class); - Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); - Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); - Py_CLEAR(clear_module_state->__pyx_n_s_collections); - Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); - Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); - Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); - Py_CLEAR(clear_module_state->__pyx_kp_s_core_pyx); - Py_CLEAR(clear_module_state->__pyx_n_s_count); - Py_CLEAR(clear_module_state->__pyx_n_s_dict); - Py_CLEAR(clear_module_state->__pyx_kp_u_disable); - Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); - Py_CLEAR(clear_module_state->__pyx_kp_u_enable); - Py_CLEAR(clear_module_state->__pyx_n_s_encode); - Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); - Py_CLEAR(clear_module_state->__pyx_n_s_error); - Py_CLEAR(clear_module_state->__pyx_n_s_flags); - Py_CLEAR(clear_module_state->__pyx_n_s_format); - Py_CLEAR(clear_module_state->__pyx_n_s_fortran); - Py_CLEAR(clear_module_state->__pyx_n_u_fortran); - Py_CLEAR(clear_module_state->__pyx_kp_u_gc); - Py_CLEAR(clear_module_state->__pyx_n_s_getstate); - Py_CLEAR(clear_module_state->__pyx_kp_u_got); - Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); - Py_CLEAR(clear_module_state->__pyx_n_s_id); - Py_CLEAR(clear_module_state->__pyx_n_s_import); - Py_CLEAR(clear_module_state->__pyx_n_s_index); - Py_CLEAR(clear_module_state->__pyx_n_s_initializing); - Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); - Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); - Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); - Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); - Py_CLEAR(clear_module_state->__pyx_n_s_main); - Py_CLEAR(clear_module_state->__pyx_n_s_maximum_path_c); - Py_CLEAR(clear_module_state->__pyx_n_s_memview); - Py_CLEAR(clear_module_state->__pyx_n_s_mode); - Py_CLEAR(clear_module_state->__pyx_n_s_monotonic_align_core); - Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_name_2); - Py_CLEAR(clear_module_state->__pyx_n_s_ndim); - Py_CLEAR(clear_module_state->__pyx_n_s_new); - Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); - Py_CLEAR(clear_module_state->__pyx_n_s_obj); - Py_CLEAR(clear_module_state->__pyx_n_s_pack); - Py_CLEAR(clear_module_state->__pyx_n_s_paths); - Py_CLEAR(clear_module_state->__pyx_n_s_pickle); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); - Py_CLEAR(clear_module_state->__pyx_n_s_range); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); - Py_CLEAR(clear_module_state->__pyx_n_s_register); - Py_CLEAR(clear_module_state->__pyx_n_s_setstate); - Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_shape); - Py_CLEAR(clear_module_state->__pyx_n_s_size); - Py_CLEAR(clear_module_state->__pyx_n_s_spec); - Py_CLEAR(clear_module_state->__pyx_n_s_start); - Py_CLEAR(clear_module_state->__pyx_n_s_step); - Py_CLEAR(clear_module_state->__pyx_n_s_stop); - Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); - Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); - Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); - Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); - Py_CLEAR(clear_module_state->__pyx_n_s_struct); - Py_CLEAR(clear_module_state->__pyx_n_s_sys); - Py_CLEAR(clear_module_state->__pyx_n_s_t_xs); - Py_CLEAR(clear_module_state->__pyx_n_s_t_ys); - Py_CLEAR(clear_module_state->__pyx_n_s_test); - Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); - Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); - Py_CLEAR(clear_module_state->__pyx_n_s_unpack); - Py_CLEAR(clear_module_state->__pyx_n_s_update); - Py_CLEAR(clear_module_state->__pyx_n_s_values); - Py_CLEAR(clear_module_state->__pyx_n_s_version_info); - Py_CLEAR(clear_module_state->__pyx_int_0); - Py_CLEAR(clear_module_state->__pyx_int_1); - Py_CLEAR(clear_module_state->__pyx_int_3); - Py_CLEAR(clear_module_state->__pyx_int_112105877); - Py_CLEAR(clear_module_state->__pyx_int_136983863); - Py_CLEAR(clear_module_state->__pyx_int_184977713); - Py_CLEAR(clear_module_state->__pyx_int_neg_1); - Py_CLEAR(clear_module_state->__pyx_slice__5); - Py_CLEAR(clear_module_state->__pyx_tuple__4); - Py_CLEAR(clear_module_state->__pyx_tuple__8); - Py_CLEAR(clear_module_state->__pyx_tuple__10); - Py_CLEAR(clear_module_state->__pyx_tuple__11); - Py_CLEAR(clear_module_state->__pyx_tuple__12); - Py_CLEAR(clear_module_state->__pyx_tuple__13); - Py_CLEAR(clear_module_state->__pyx_tuple__14); - Py_CLEAR(clear_module_state->__pyx_tuple__15); - Py_CLEAR(clear_module_state->__pyx_tuple__16); - Py_CLEAR(clear_module_state->__pyx_tuple__17); - Py_CLEAR(clear_module_state->__pyx_tuple__18); - Py_CLEAR(clear_module_state->__pyx_tuple__19); - Py_CLEAR(clear_module_state->__pyx_tuple__21); - Py_CLEAR(clear_module_state->__pyx_codeobj__20); - Py_CLEAR(clear_module_state->__pyx_codeobj__22); - return 0; -} -#endif -/* #### Code section: module_state_traverse ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { - __pyx_mstate *traverse_module_state = __pyx_mstate(m); - if (!traverse_module_state) return 0; - Py_VISIT(traverse_module_state->__pyx_d); - Py_VISIT(traverse_module_state->__pyx_b); - Py_VISIT(traverse_module_state->__pyx_cython_runtime); - Py_VISIT(traverse_module_state->__pyx_empty_tuple); - Py_VISIT(traverse_module_state->__pyx_empty_bytes); - Py_VISIT(traverse_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_VISIT(traverse_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); - #endif - Py_VISIT(traverse_module_state->__pyx_array_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_array); - Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); - Py_VISIT(traverse_module_state->__pyx_memoryview_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); - Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); - Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); - Py_VISIT(traverse_module_state->__pyx_kp_u_); - Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); - Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); - Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); - Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); - Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); - Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); - Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); - Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); - Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); - Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); - Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); - Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); - Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); - Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); - Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); - Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); - Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); - Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); - Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); - Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); - Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); - Py_VISIT(traverse_module_state->__pyx_n_b_O); - Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); - Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); - Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); - Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); - Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); - Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); - Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); - Py_VISIT(traverse_module_state->__pyx_kp_u__2); - Py_VISIT(traverse_module_state->__pyx_n_s__23); - Py_VISIT(traverse_module_state->__pyx_n_s__3); - Py_VISIT(traverse_module_state->__pyx_kp_u__6); - Py_VISIT(traverse_module_state->__pyx_kp_u__7); - Py_VISIT(traverse_module_state->__pyx_n_s_abc); - Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); - Py_VISIT(traverse_module_state->__pyx_kp_u_and); - Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); - Py_VISIT(traverse_module_state->__pyx_n_s_base); - Py_VISIT(traverse_module_state->__pyx_n_s_c); - Py_VISIT(traverse_module_state->__pyx_n_u_c); - Py_VISIT(traverse_module_state->__pyx_n_s_class); - Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); - Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); - Py_VISIT(traverse_module_state->__pyx_n_s_collections); - Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); - Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); - Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); - Py_VISIT(traverse_module_state->__pyx_kp_s_core_pyx); - Py_VISIT(traverse_module_state->__pyx_n_s_count); - Py_VISIT(traverse_module_state->__pyx_n_s_dict); - Py_VISIT(traverse_module_state->__pyx_kp_u_disable); - Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); - Py_VISIT(traverse_module_state->__pyx_kp_u_enable); - Py_VISIT(traverse_module_state->__pyx_n_s_encode); - Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); - Py_VISIT(traverse_module_state->__pyx_n_s_error); - Py_VISIT(traverse_module_state->__pyx_n_s_flags); - Py_VISIT(traverse_module_state->__pyx_n_s_format); - Py_VISIT(traverse_module_state->__pyx_n_s_fortran); - Py_VISIT(traverse_module_state->__pyx_n_u_fortran); - Py_VISIT(traverse_module_state->__pyx_kp_u_gc); - Py_VISIT(traverse_module_state->__pyx_n_s_getstate); - Py_VISIT(traverse_module_state->__pyx_kp_u_got); - Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); - Py_VISIT(traverse_module_state->__pyx_n_s_id); - Py_VISIT(traverse_module_state->__pyx_n_s_import); - Py_VISIT(traverse_module_state->__pyx_n_s_index); - Py_VISIT(traverse_module_state->__pyx_n_s_initializing); - Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); - Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); - Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); - Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); - Py_VISIT(traverse_module_state->__pyx_n_s_main); - Py_VISIT(traverse_module_state->__pyx_n_s_maximum_path_c); - Py_VISIT(traverse_module_state->__pyx_n_s_memview); - Py_VISIT(traverse_module_state->__pyx_n_s_mode); - Py_VISIT(traverse_module_state->__pyx_n_s_monotonic_align_core); - Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_name_2); - Py_VISIT(traverse_module_state->__pyx_n_s_ndim); - Py_VISIT(traverse_module_state->__pyx_n_s_new); - Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); - Py_VISIT(traverse_module_state->__pyx_n_s_obj); - Py_VISIT(traverse_module_state->__pyx_n_s_pack); - Py_VISIT(traverse_module_state->__pyx_n_s_paths); - Py_VISIT(traverse_module_state->__pyx_n_s_pickle); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); - Py_VISIT(traverse_module_state->__pyx_n_s_range); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); - Py_VISIT(traverse_module_state->__pyx_n_s_register); - Py_VISIT(traverse_module_state->__pyx_n_s_setstate); - Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_shape); - Py_VISIT(traverse_module_state->__pyx_n_s_size); - Py_VISIT(traverse_module_state->__pyx_n_s_spec); - Py_VISIT(traverse_module_state->__pyx_n_s_start); - Py_VISIT(traverse_module_state->__pyx_n_s_step); - Py_VISIT(traverse_module_state->__pyx_n_s_stop); - Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); - Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); - Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); - Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); - Py_VISIT(traverse_module_state->__pyx_n_s_struct); - Py_VISIT(traverse_module_state->__pyx_n_s_sys); - Py_VISIT(traverse_module_state->__pyx_n_s_t_xs); - Py_VISIT(traverse_module_state->__pyx_n_s_t_ys); - Py_VISIT(traverse_module_state->__pyx_n_s_test); - Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); - Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); - Py_VISIT(traverse_module_state->__pyx_n_s_unpack); - Py_VISIT(traverse_module_state->__pyx_n_s_update); - Py_VISIT(traverse_module_state->__pyx_n_s_values); - Py_VISIT(traverse_module_state->__pyx_n_s_version_info); - Py_VISIT(traverse_module_state->__pyx_int_0); - Py_VISIT(traverse_module_state->__pyx_int_1); - Py_VISIT(traverse_module_state->__pyx_int_3); - Py_VISIT(traverse_module_state->__pyx_int_112105877); - Py_VISIT(traverse_module_state->__pyx_int_136983863); - Py_VISIT(traverse_module_state->__pyx_int_184977713); - Py_VISIT(traverse_module_state->__pyx_int_neg_1); - Py_VISIT(traverse_module_state->__pyx_slice__5); - Py_VISIT(traverse_module_state->__pyx_tuple__4); - Py_VISIT(traverse_module_state->__pyx_tuple__8); - Py_VISIT(traverse_module_state->__pyx_tuple__10); - Py_VISIT(traverse_module_state->__pyx_tuple__11); - Py_VISIT(traverse_module_state->__pyx_tuple__12); - Py_VISIT(traverse_module_state->__pyx_tuple__13); - Py_VISIT(traverse_module_state->__pyx_tuple__14); - Py_VISIT(traverse_module_state->__pyx_tuple__15); - Py_VISIT(traverse_module_state->__pyx_tuple__16); - Py_VISIT(traverse_module_state->__pyx_tuple__17); - Py_VISIT(traverse_module_state->__pyx_tuple__18); - Py_VISIT(traverse_module_state->__pyx_tuple__19); - Py_VISIT(traverse_module_state->__pyx_tuple__21); - Py_VISIT(traverse_module_state->__pyx_codeobj__20); - Py_VISIT(traverse_module_state->__pyx_codeobj__22); - return 0; -} -#endif -/* #### Code section: module_state_defines ### */ -#define __pyx_d __pyx_mstate_global->__pyx_d -#define __pyx_b __pyx_mstate_global->__pyx_b -#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime -#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple -#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes -#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode -#ifdef __Pyx_CyFunction_USED -#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType -#endif -#ifdef __Pyx_FusedFunction_USED -#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType -#endif -#ifdef __Pyx_Generator_USED -#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType -#endif -#ifdef __Pyx_IterableCoroutine_USED -#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array -#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum -#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview -#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice -#endif -#define __pyx_array_type __pyx_mstate_global->__pyx_array_type -#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type -#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type -#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type -#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ -#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII -#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi -#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError -#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri -#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is -#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor -#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi -#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type -#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with -#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct -#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis -#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr -#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 -#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError -#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d -#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte -#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr -#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis -#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError -#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x -#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object -#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O -#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a -#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError -#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence -#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d -#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError -#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object -#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError -#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView -#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 -#define __pyx_n_s__23 __pyx_mstate_global->__pyx_n_s__23 -#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 -#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 -#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 -#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc -#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer -#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and -#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines -#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base -#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c -#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c -#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class -#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem -#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback -#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections -#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc -#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct -#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect -#define __pyx_kp_s_core_pyx __pyx_mstate_global->__pyx_kp_s_core_pyx -#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count -#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict -#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable -#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object -#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable -#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode -#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate -#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error -#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags -#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format -#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran -#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran -#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc -#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate -#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got -#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi -#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id -#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import -#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index -#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing -#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine -#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled -#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize -#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array -#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main -#define __pyx_n_s_maximum_path_c __pyx_mstate_global->__pyx_n_s_maximum_path_c -#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview -#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode -#define __pyx_n_s_monotonic_align_core __pyx_mstate_global->__pyx_n_s_monotonic_align_core -#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 -#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim -#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new -#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non -#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj -#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack -#define __pyx_n_s_paths __pyx_mstate_global->__pyx_n_s_paths -#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle -#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError -#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum -#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result -#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state -#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type -#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum -#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable -#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range -#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce -#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython -#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex -#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register -#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate -#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython -#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape -#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size -#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec -#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start -#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step -#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop -#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct -#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect -#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect -#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource -#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct -#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys -#define __pyx_n_s_t_xs __pyx_mstate_global->__pyx_n_s_t_xs -#define __pyx_n_s_t_ys __pyx_mstate_global->__pyx_n_s_t_ys -#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test -#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data -#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str -#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack -#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update -#define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values -#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info -#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 -#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 -#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 -#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 -#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 -#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 -#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 -#define __pyx_k__9 __pyx_mstate_global->__pyx_k__9 -#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 -#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 -#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 -#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 -#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 -#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 -#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 -#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 -#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 -#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 -#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 -#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 -#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 -#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 -#define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 -#define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22 -/* #### Code section: module_code ### */ - -/* "View.MemoryView":131 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ - -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) - } - } else { - switch (__pyx_nargs) { - case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) - } else { - - /* "View.MemoryView":132 - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< - * - * cdef int idx - */ - __pyx_v_allocate_buffer = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - - /* "View.MemoryView":131 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_dim; - char __pyx_v_order; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - char *__pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_UCS4 __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); - - /* "View.MemoryView":137 - * cdef Py_ssize_t dim - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize - * - */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 137, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); - - /* "View.MemoryView":138 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< - * - * if not self.ndim: - */ - __pyx_v_self->itemsize = __pyx_v_itemsize; - - /* "View.MemoryView":140 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError, "Empty shape tuple for cython.array" - * - */ - __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":141 - * - * if not self.ndim: - * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); - __PYX_ERR(1, 141, __pyx_L1_error) - - /* "View.MemoryView":140 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError, "Empty shape tuple for cython.array" - * - */ - } - - /* "View.MemoryView":143 - * raise ValueError, "Empty shape tuple for cython.array" - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError, "itemsize <= 0 for cython.array" - * - */ - __pyx_t_2 = (__pyx_v_itemsize <= 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":144 - * - * if itemsize <= 0: - * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); - __PYX_ERR(1, 144, __pyx_L1_error) - - /* "View.MemoryView":143 - * raise ValueError, "Empty shape tuple for cython.array" - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError, "itemsize <= 0 for cython.array" - * - */ - } - - /* "View.MemoryView":146 - * raise ValueError, "itemsize <= 0 for cython.array" - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { - - /* "View.MemoryView":147 - * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_7 = 1; - } - } - { - PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":146 - * raise ValueError, "itemsize <= 0 for cython.array" - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - } - - /* "View.MemoryView":148 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format - * - */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) - __pyx_t_4 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":149 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * - * - */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(1, 149, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_8; - - /* "View.MemoryView":152 - * - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim - * - */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - - /* "View.MemoryView":153 - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< - * - * if not self._shape: - */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - - /* "View.MemoryView":155 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate shape and strides." - * - */ - __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); - if (unlikely(__pyx_t_3)) { - - /* "View.MemoryView":156 - * - * if not self._shape: - * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< - * - * - */ - __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); - __PYX_ERR(1, 156, __pyx_L1_error) - - /* "View.MemoryView":155 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate shape and strides." - * - */ - } - - /* "View.MemoryView":159 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - */ - __pyx_t_7 = 0; - __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_7; - __pyx_t_7 = (__pyx_t_7 + 1); - - /* "View.MemoryView":160 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - * self._shape[idx] = dim - */ - __pyx_t_3 = (__pyx_v_dim <= 0); - if (unlikely(__pyx_t_3)) { - - /* "View.MemoryView":161 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< - * self._shape[idx] = dim - * - */ - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); - __pyx_t_9 += 22; - __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); - __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u_); - __pyx_t_9 += 2; - __Pyx_GIVEREF(__pyx_kp_u_); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); - __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u__2); - __pyx_t_9 += 1; - __Pyx_GIVEREF(__pyx_kp_u__2); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 161, __pyx_L1_error) - - /* "View.MemoryView":160 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - * self._shape[idx] = dim - */ - } - - /* "View.MemoryView":162 - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - * self._shape[idx] = dim # <<<<<<<<<<<<<< - * - * cdef char order - */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - - /* "View.MemoryView":159 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError, f"Invalid shape in axis {idx}: {dim}." - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":165 - * - * cdef char order - * if mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) - if (__pyx_t_3) { - - /* "View.MemoryView":166 - * cdef char order - * if mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * elif mode == 'fortran': - */ - __pyx_v_order = 'C'; - - /* "View.MemoryView":167 - * if mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * elif mode == 'fortran': - * order = b'F' - */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - - /* "View.MemoryView":165 - * - * cdef char order - * if mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L11; - } - - /* "View.MemoryView":168 - * order = b'C' - * self.mode = u'c' - * elif mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) - if (likely(__pyx_t_3)) { - - /* "View.MemoryView":169 - * self.mode = u'c' - * elif mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * else: - */ - __pyx_v_order = 'F'; - - /* "View.MemoryView":170 - * elif mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * else: - * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" - */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; - - /* "View.MemoryView":168 - * order = b'C' - * self.mode = u'c' - * elif mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L11; - } - - /* "View.MemoryView":172 - * self.mode = u'fortran' - * else: - * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< - * - * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 172, __pyx_L1_error) - } - __pyx_L11:; - - /* "View.MemoryView":174 - * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" - * - * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< - * - * self.free_data = allocate_buffer - */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - - /* "View.MemoryView":176 - * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * - */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; - - /* "View.MemoryView":177 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * - * if allocate_buffer: - */ - __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_3; - - /* "View.MemoryView":179 - * self.dtype_is_object = format == b'O' - * - * if allocate_buffer: # <<<<<<<<<<<<<< - * _allocate_buffer(self) - * - */ - if (__pyx_v_allocate_buffer) { - - /* "View.MemoryView":180 - * - * if allocate_buffer: - * _allocate_buffer(self) # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) - - /* "View.MemoryView":179 - * self.dtype_is_object = format == b'O' - * - * if allocate_buffer: # <<<<<<<<<<<<<< - * _allocate_buffer(self) - * - */ - } - - /* "View.MemoryView":131 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":182 - * _allocate_buffer(self) - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - */ - -/* Python wrapper */ -CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - char *__pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - Py_ssize_t *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (unlikely(__pyx_v_info == NULL)) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":184 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":185 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":186 - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":187 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":186 - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - goto __pyx_L4; - } - - /* "View.MemoryView":188 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":189 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError, "Can only create a buffer that is contiguous in memory." - */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":188 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - } - __pyx_L4:; - - /* "View.MemoryView":190 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data - */ - __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":191 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); - __PYX_ERR(1, 191, __pyx_L1_error) - - /* "View.MemoryView":190 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data - */ - } - - /* "View.MemoryView":185 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - } - - /* "View.MemoryView":192 - * if not (flags & bufmode): - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * - */ - __pyx_t_2 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_2; - - /* "View.MemoryView":193 - * raise ValueError, "Can only create a buffer that is contiguous in memory." - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * - * if flags & PyBUF_STRIDES: - */ - __pyx_t_3 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_3; - - /* "View.MemoryView":195 - * info.len = self.len - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":196 - * - * if flags & PyBUF_STRIDES: - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides - */ - __pyx_t_4 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_4; - - /* "View.MemoryView":197 - * if flags & PyBUF_STRIDES: - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * else: - */ - __pyx_t_5 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_5; - - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * else: - * info.ndim = 1 - */ - __pyx_t_5 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_5; - - /* "View.MemoryView":195 - * info.len = self.len - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape - */ - goto __pyx_L6; - } - - /* "View.MemoryView":200 - * info.strides = self._strides - * else: - * info.ndim = 1 # <<<<<<<<<<<<<< - * info.shape = &self.len if flags & PyBUF_ND else NULL - * info.strides = NULL - */ - /*else*/ { - __pyx_v_info->ndim = 1; - - /* "View.MemoryView":201 - * else: - * info.ndim = 1 - * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< - * info.strides = NULL - * - */ - if (((__pyx_v_flags & PyBUF_ND) != 0)) { - __pyx_t_5 = (&__pyx_v_self->len); - } else { - __pyx_t_5 = NULL; - } - __pyx_v_info->shape = __pyx_t_5; - - /* "View.MemoryView":202 - * info.ndim = 1 - * info.shape = &self.len if flags & PyBUF_ND else NULL - * info.strides = NULL # <<<<<<<<<<<<<< - * - * info.suboffsets = NULL - */ - __pyx_v_info->strides = NULL; - } - __pyx_L6:; - - /* "View.MemoryView":204 - * info.strides = NULL - * - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 - */ - __pyx_v_info->suboffsets = NULL; - - /* "View.MemoryView":205 - * - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 - * info.format = self.format if flags & PyBUF_FORMAT else NULL - */ - __pyx_t_3 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_3; - - /* "View.MemoryView":206 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< - * info.format = self.format if flags & PyBUF_FORMAT else NULL - * info.obj = self - */ - __pyx_v_info->readonly = 0; - - /* "View.MemoryView":207 - * info.itemsize = self.itemsize - * info.readonly = 0 - * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< - * info.obj = self - * - */ - if (((__pyx_v_flags & PyBUF_FORMAT) != 0)) { - __pyx_t_2 = __pyx_v_self->format; - } else { - __pyx_t_2 = NULL; - } - __pyx_v_info->format = __pyx_t_2; - - /* "View.MemoryView":208 - * info.readonly = 0 - * info.format = self.format if flags & PyBUF_FORMAT else NULL - * info.obj = self # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): - */ - __Pyx_INCREF((PyObject *)__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_v_self); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "View.MemoryView":182 - * _allocate_buffer(self) - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":210 - * info.obj = self - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - */ - -/* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":211 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - */ - __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":212 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: - */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); - - /* "View.MemoryView":211 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":213 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - */ - if (__pyx_v_self->free_data) { - } else { - __pyx_t_1 = __pyx_v_self->free_data; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->data != NULL); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "View.MemoryView":214 - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) - */ - if (__pyx_v_self->dtype_is_object) { - - /* "View.MemoryView":215 - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< - * free(self.data) - * PyObject_Free(self._shape) - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - - /* "View.MemoryView":214 - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) - */ - } - - /* "View.MemoryView":216 - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) - * - */ - free(__pyx_v_self->data); - - /* "View.MemoryView":213 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - */ - } - __pyx_L3:; - - /* "View.MemoryView":217 - * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< - * - * @property - */ - PyObject_Free(__pyx_v_self->_shape); - - /* "View.MemoryView":210 - * info.obj = self - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":219 - * PyObject_Free(self._shape) - * - * @property # <<<<<<<<<<<<<< - * def memview(self): - * return self.get_memview() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":221 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< - * - * @cname('get_memview') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":219 - * PyObject_Free(self._shape) - * - * @property # <<<<<<<<<<<<<< - * def memview(self): - * return self.get_memview() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":224 - * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) - */ - -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); - - /* "View.MemoryView":225 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) - * - */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - - /* "View.MemoryView":226 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF((PyObject *)__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":224 - * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":228 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] - * - */ - -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "View.MemoryView":229 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< - * - * def __getattr__(self, attr): - */ - __pyx_r = (__pyx_v_self->_shape[0]); - goto __pyx_L0; - - /* "View.MemoryView":228 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":231 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); - - /* "View.MemoryView":232 - * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< - * - * def __getitem__(self, item): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":231 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":234 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - -/* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":235 - * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< - * - * def __setitem__(self, item, value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":234 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":237 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - -/* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - - /* "View.MemoryView":238 - * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "View.MemoryView":237 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":248 - * - * @cname("__pyx_array_allocate_buffer") - * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< - * - * - */ - -static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_i; - PyObject **__pyx_v_p; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_allocate_buffer", 0); - - /* "View.MemoryView":254 - * cdef PyObject **p - * - * self.free_data = True # <<<<<<<<<<<<<< - * self.data = malloc(self.len) - * if not self.data: - */ - __pyx_v_self->free_data = 1; - - /* "View.MemoryView":255 - * - * self.free_data = True - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError, "unable to allocate array data." - */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - - /* "View.MemoryView":256 - * self.free_data = True - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate array data." - * - */ - __pyx_t_1 = (!(__pyx_v_self->data != 0)); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":257 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: - */ - __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); - __PYX_ERR(1, 257, __pyx_L1_error) - - /* "View.MemoryView":256 - * self.free_data = True - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError, "unable to allocate array data." - * - */ - } - - /* "View.MemoryView":259 - * raise MemoryError, "unable to allocate array data." - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len // self.itemsize): - */ - if (__pyx_v_self->dtype_is_object) { - - /* "View.MemoryView":260 - * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len // self.itemsize): - * p[i] = Py_None - */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - - /* "View.MemoryView":261 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_self->itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(1, 261, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(1, 261, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":262 - * p = self.data - * for i in range(self.len // self.itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * return 0 - */ - (__pyx_v_p[__pyx_v_i]) = Py_None; - - /* "View.MemoryView":263 - * for i in range(self.len // self.itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * return 0 - * - */ - Py_INCREF(Py_None); - } - - /* "View.MemoryView":259 - * raise MemoryError, "unable to allocate array data." - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len // self.itemsize): - */ - } - - /* "View.MemoryView":264 - * p[i] = Py_None - * Py_INCREF(Py_None) - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":248 - * - * @cname("__pyx_array_allocate_buffer") - * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< - * - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":268 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< - * cdef array result - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - */ - -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - PyObject *__pyx_v_mode = 0; - struct __pyx_array_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); - - /* "View.MemoryView":270 - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): - * cdef array result - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< - * - * if buf is NULL: - */ - if (((__pyx_v_c_mode[0]) == 'f')) { - __Pyx_INCREF(__pyx_n_s_fortran); - __pyx_t_1 = __pyx_n_s_fortran; - } else { - __Pyx_INCREF(__pyx_n_s_c); - __pyx_t_1 = __pyx_n_s_c; - } - __pyx_v_mode = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":272 - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - * - * if buf is NULL: # <<<<<<<<<<<<<< - * result = array.__new__(array, shape, itemsize, format, mode) - * else: - */ - __pyx_t_2 = (__pyx_v_buf == NULL); - if (__pyx_t_2) { - - /* "View.MemoryView":273 - * - * if buf is NULL: - * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< - * else: - * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) - */ - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __Pyx_INCREF(__pyx_v_mode); - __Pyx_GIVEREF(__pyx_v_mode); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":272 - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - * - * if buf is NULL: # <<<<<<<<<<<<<< - * result = array.__new__(array, shape, itemsize, format, mode) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":275 - * result = array.__new__(array, shape, itemsize, format, mode) - * else: - * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf - * - */ - /*else*/ { - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); - __Pyx_INCREF(__pyx_v_mode); - __Pyx_GIVEREF(__pyx_v_mode); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":276 - * else: - * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result->data = __pyx_v_buf; - } - __pyx_L3:; - - /* "View.MemoryView":278 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF((PyObject *)__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "View.MemoryView":268 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< - * cdef array result - * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_mode); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":304 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - -/* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); - - /* "View.MemoryView":305 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name - */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; - - /* "View.MemoryView":304 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":306 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":307 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< - * - * cdef generic = Enum("") - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; - - /* "View.MemoryView":306 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) - */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - if (__pyx_t_2) { - - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None - */ - __pyx_v_use_setstate = 1; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } - - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_2; - } - __pyx_L3:; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - * else: - */ - if (__pyx_v_use_setstate) { - - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_136983863); - __Pyx_GIVEREF(__pyx_int_136983863); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - * else: - */ - } - - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_136983863); - __Pyx_GIVEREF(__pyx_int_136983863); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":349 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags - */ - -/* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) - } - } else { - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); - values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) - } else { - __pyx_v_dtype_is_object = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_intptr_t __pyx_t_4; - size_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "View.MemoryView":350 - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: - */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; - - /* "View.MemoryView":351 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - */ - __pyx_v_self->flags = __pyx_v_flags; - - /* "View.MemoryView":352 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_obj != Py_None); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "View.MemoryView":353 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - */ - __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - - /* "View.MemoryView":354 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":355 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - - /* "View.MemoryView":356 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - */ - Py_INCREF(Py_None); - - /* "View.MemoryView":354 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - } - - /* "View.MemoryView":352 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - } - - /* "View.MemoryView":358 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: - */ - __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); - if (__pyx_t_1) { - - /* "View.MemoryView":360 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); - if (__pyx_t_1) { - - /* "View.MemoryView":361 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - - /* "View.MemoryView":362 - * if __pyx_memoryview_thread_locks_used < 8: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - - /* "View.MemoryView":360 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } - - /* "View.MemoryView":363 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - __pyx_t_1 = (__pyx_v_self->lock == NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":364 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError - */ - __pyx_v_self->lock = PyThread_allocate_lock(); - - /* "View.MemoryView":365 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - __pyx_t_1 = (__pyx_v_self->lock == NULL); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":366 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: - */ - PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) - - /* "View.MemoryView":365 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - } - - /* "View.MemoryView":363 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - } - - /* "View.MemoryView":358 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < 8: - */ - } - - /* "View.MemoryView":368 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":369 - * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object - */ - __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - - /* "View.MemoryView":368 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - goto __pyx_L11; - } - - /* "View.MemoryView":371 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< - * - * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 - */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; - - /* "View.MemoryView":373 - * self.dtype_is_object = dtype_is_object - * - * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< - * self.typeinfo = NULL - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(__pyx_assertions_enabled())) { - __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); - __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); - if (unlikely(__pyx_t_5 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(1, 373, __pyx_L1_error) - } - __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); - if (unlikely(!__pyx_t_1)) { - __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); - __PYX_ERR(1, 373, __pyx_L1_error) - } - } - #else - if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) - #endif - - /* "View.MemoryView":374 - * - * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 - * self.typeinfo = NULL # <<<<<<<<<<<<<< - * - * def __dealloc__(memoryview self): - */ - __pyx_v_self->typeinfo = NULL; - - /* "View.MemoryView":349 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":376 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyThread_type_lock __pyx_t_5; - PyThread_type_lock __pyx_t_6; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":377 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":378 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - - /* "View.MemoryView":377 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":379 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":381 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - - /* "View.MemoryView":382 - * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< - * - * cdef int i - */ - Py_DECREF(Py_None); - - /* "View.MemoryView":379 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - } - __pyx_L3:; - - /* "View.MemoryView":386 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_1 = (__pyx_v_self->lock != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":387 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - */ - __pyx_t_2 = __pyx_memoryview_thread_locks_used; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":388 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); - if (__pyx_t_1) { - - /* "View.MemoryView":389 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - - /* "View.MemoryView":390 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); - if (__pyx_t_1) { - - /* "View.MemoryView":392 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break - */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; - - /* "View.MemoryView":390 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - } - - /* "View.MemoryView":393 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) - */ - goto __pyx_L6_break; - - /* "View.MemoryView":388 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - } - } - /*else*/ { - - /* "View.MemoryView":395 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; - - /* "View.MemoryView":386 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - } - - /* "View.MemoryView":376 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":397 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ - -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); - - /* "View.MemoryView":399 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< - * - * for dim, idx in enumerate(index): - */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - - /* "View.MemoryView":401 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 401, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); - - /* "View.MemoryView":402 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< - * - * return itemp - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; - - /* "View.MemoryView":401 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":404 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_itemp; - goto __pyx_L0; - - /* "View.MemoryView":397 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":407 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":408 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - if (__pyx_t_1) { - - /* "View.MemoryView":409 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< - * - * have_slices, indices = _unellipsify(index, self.view.ndim) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_self); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "View.MemoryView":408 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * - */ - } - - /* "View.MemoryView":411 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * cdef char *itemp - */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 411, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_v_indices = __pyx_t_4; - __pyx_t_4 = 0; - - /* "View.MemoryView":414 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":415 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":414 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - } - - /* "View.MemoryView":417 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) - * - */ - /*else*/ { - __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_5; - - /* "View.MemoryView":418 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< - * - * def __setitem__(memoryview self, object index, object value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "View.MemoryView":407 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":420 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError, "Cannot assign to read-only memoryview" - */ - -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "View.MemoryView":421 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError, "Cannot assign to read-only memoryview" - * - */ - if (unlikely(__pyx_v_self->view.readonly)) { - - /* "View.MemoryView":422 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); - __PYX_ERR(1, 422, __pyx_L1_error) - - /* "View.MemoryView":421 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError, "Cannot assign to read-only memoryview" - * - */ - } - - /* "View.MemoryView":424 - * raise TypeError, "Cannot assign to read-only memoryview" - * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * if have_slices: - */ - __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(__pyx_t_1 != Py_None)) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 424, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":426 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":427 - * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_obj = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":428 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":429 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) - */ - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":428 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":431 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L5:; - - /* "View.MemoryView":426 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: - */ - goto __pyx_L4; - } - - /* "View.MemoryView":433 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< - * - * cdef is_slice(self, obj): - */ - /*else*/ { - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L4:; - - /* "View.MemoryView":420 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError, "Cannot assign to read-only memoryview" - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":435 - * self.setitem_indexed(index, value) - * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: - */ - -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); - - /* "View.MemoryView":436 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = (!__pyx_t_1); - if (__pyx_t_2) { - - /* "View.MemoryView":437 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { - - /* "View.MemoryView":438 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "View.MemoryView":439 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None - */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - - /* "View.MemoryView":438 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":437 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "View.MemoryView":440 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - - /* "View.MemoryView":441 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< - * - * return obj - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - - /* "View.MemoryView":437 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - __pyx_L6_except_error:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } - - /* "View.MemoryView":436 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - } - - /* "View.MemoryView":443 - * return None - * - * return obj # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assignment(self, dst, src): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - - /* "View.MemoryView":435 - * self.setitem_indexed(index, value) - * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":445 - * return obj - * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - */ - -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - __Pyx_memviewslice __pyx_v_msrc; - __Pyx_memviewslice __pyx_v_mdst; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - - /* "View.MemoryView":448 - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] - * - */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) - __pyx_v_msrc = (__pyx_t_1[0]); - - /* "View.MemoryView":449 - * cdef __Pyx_memviewslice src_slice - * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] - * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< - * - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) - */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) - __pyx_v_mdst = (__pyx_t_1[0]); - - /* "View.MemoryView":451 - * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] - * - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) - - /* "View.MemoryView":445 - * return obj - * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":453 - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL - */ - -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - - /* "View.MemoryView":455 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item - * - */ - __pyx_v_tmp = NULL; - - /* "View.MemoryView":460 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< - * - * if self.view.itemsize > sizeof(array): - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; - - /* "View.MemoryView":462 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); - if (__pyx_t_2) { - - /* "View.MemoryView":463 - * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError - */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - - /* "View.MemoryView":464 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - __pyx_t_2 = (__pyx_v_tmp == NULL); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":465 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: - */ - PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) - - /* "View.MemoryView":464 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - } - - /* "View.MemoryView":466 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array - */ - __pyx_v_item = __pyx_v_tmp; - - /* "View.MemoryView":462 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":468 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< - * - * try: - */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); - } - __pyx_L3:; - - /* "View.MemoryView":470 - * item = array - * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value - */ - /*try:*/ { - - /* "View.MemoryView":471 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - if (__pyx_v_self->dtype_is_object) { - - /* "View.MemoryView":472 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) - */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - - /* "View.MemoryView":471 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":474 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L8:; - - /* "View.MemoryView":478 - * - * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); - if (__pyx_t_2) { - - /* "View.MemoryView":479 - * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) - */ - __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - - /* "View.MemoryView":478 - * - * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - } - - /* "View.MemoryView":480 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: - */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); - } - - /* "View.MemoryView":483 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< - * - * cdef setitem_indexed(self, index, value): - */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; - } - - /* "View.MemoryView":453 - * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":485 - * PyMem_Free(tmp) - * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) - */ - -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); - - /* "View.MemoryView":486 - * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; - - /* "View.MemoryView":487 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":485 - * PyMem_Free(tmp) - * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":489 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":492 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem - * - */ - __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":495 - * cdef bytes bytesitem - * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) - */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":496 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { - - /* "View.MemoryView":497 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError, "Unable to convert item to object" - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - { - PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":496 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - } - - /* "View.MemoryView":501 - * raise ValueError, "Unable to convert item to object" - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - /*else:*/ { - __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) - __pyx_t_10 = (__pyx_t_9 == 1); - if (__pyx_t_10) { - - /* "View.MemoryView":502 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; - - /* "View.MemoryView":501 - * raise ValueError, "Unable to convert item to object" - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - } - - /* "View.MemoryView":503 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":498 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError, "Unable to convert item to object" - * else: - */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_1); - - /* "View.MemoryView":499 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); - __PYX_ERR(1, 499, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - - /* "View.MemoryView":496 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - __pyx_L5_except_error:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; - } - - /* "View.MemoryView":489 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":505 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - char *__pyx_t_9; - char *__pyx_t_10; - char *__pyx_t_11; - char *__pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":508 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue - */ - __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":513 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - if (__pyx_t_2) { - - /* "View.MemoryView":514 - * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":513 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): - */ - /*else*/ { - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_6 = 1; - } - } - { - PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - } - __pyx_L3:; - - /* "View.MemoryView":518 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_7 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(1, 518, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_8 = __pyx_v_bytesvalue; - __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); - __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); - for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { - __pyx_t_9 = __pyx_t_12; - __pyx_v_c = (__pyx_t_9[0]); - - /* "View.MemoryView":519 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - __pyx_v_i = __pyx_t_7; - - /* "View.MemoryView":518 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_7 = (__pyx_t_7 + 1); - - /* "View.MemoryView":519 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "View.MemoryView":505 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":521 - * itemp[i] = c - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - */ - -/* Python wrapper */ -CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - char *__pyx_t_4; - void *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (unlikely(__pyx_v_info == NULL)) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":523 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":524 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); - __PYX_ERR(1, 524, __pyx_L1_error) - - /* "View.MemoryView":523 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - */ - } - - /* "View.MemoryView":526 - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":527 - * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL - */ - __pyx_t_3 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_3; - - /* "View.MemoryView":526 - * raise ValueError, "Cannot create writable memory view from read-only memoryview" - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":529 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_STRIDES: - */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; - - /* "View.MemoryView":531 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":532 - * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL - */ - __pyx_t_3 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_3; - - /* "View.MemoryView":531 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - goto __pyx_L7; - } - - /* "View.MemoryView":534 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_INDIRECT: - */ - /*else*/ { - __pyx_v_info->strides = NULL; - } - __pyx_L7:; - - /* "View.MemoryView":536 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":537 - * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL - */ - __pyx_t_3 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_3; - - /* "View.MemoryView":536 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":539 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: - */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; - - /* "View.MemoryView":541 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":542 - * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL - */ - __pyx_t_4 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_4; - - /* "View.MemoryView":541 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":544 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< - * - * info.buf = self.view.buf - */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; - - /* "View.MemoryView":546 - * info.format = NULL - * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - */ - __pyx_t_5 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_5; - - /* "View.MemoryView":547 - * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len - */ - __pyx_t_6 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_6; - - /* "View.MemoryView":548 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly - */ - __pyx_t_7 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_7; - - /* "View.MemoryView":549 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self - */ - __pyx_t_7 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_7; - - /* "View.MemoryView":550 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self - * - */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; - - /* "View.MemoryView":551 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF((PyObject *)__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_v_self); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "View.MemoryView":521 - * itemp[i] = c - * - * @cname('getbuffer') # <<<<<<<<<<<<<< - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":554 - * - * - * @property # <<<<<<<<<<<<<< - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result - */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":554 - * - * - * @property # <<<<<<<<<<<<<< - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":560 - * return result - * - * @property # <<<<<<<<<<<<<< - * def base(self): - * return self._get_base() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":562 - * @property - * def base(self): - * return self._get_base() # <<<<<<<<<<<<<< - * - * cdef _get_base(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":560 - * return result - * - * @property # <<<<<<<<<<<<<< - * def base(self): - * return self._get_base() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":564 - * return self._get_base() - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - -static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_base", 0); - - /* "View.MemoryView":565 - * - * cdef _get_base(self): - * return self.obj # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; - - /* "View.MemoryView":564 - * return self._get_base() - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":567 - * return self.obj - * - * @property # <<<<<<<<<<<<<< - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_7genexpr__pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":569 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } /* exit inner scope */ - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "View.MemoryView":567 - * return self.obj - * - * @property # <<<<<<<<<<<<<< - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":571 - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def strides(self): - * if self.view.strides == NULL: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_8genexpr1__pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":573 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError, "Buffer view does not expose strides" - */ - __pyx_t_1 = (__pyx_v_self->view.strides == NULL); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":575 - * if self.view.strides == NULL: - * - * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); - __PYX_ERR(1, 575, __pyx_L1_error) - - /* "View.MemoryView":573 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError, "Buffer view does not expose strides" - */ - } - - /* "View.MemoryView":577 - * raise ValueError, "Buffer view does not expose strides" - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } /* exit inner scope */ - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "View.MemoryView":571 - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def strides(self): - * if self.view.strides == NULL: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":579 - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def suboffsets(self): - * if self.view.suboffsets == NULL: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":581 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * - */ - __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":582 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":581 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * - */ - } - - /* "View.MemoryView":584 - * return (-1,) * self.view.ndim - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } /* exit inner scope */ - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "View.MemoryView":579 - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def suboffsets(self): - * if self.view.suboffsets == NULL: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":586 - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def ndim(self): - * return self.view.ndim - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":588 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":586 - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - * - * @property # <<<<<<<<<<<<<< - * def ndim(self): - * return self.view.ndim - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":590 - * return self.view.ndim - * - * @property # <<<<<<<<<<<<<< - * def itemsize(self): - * return self.view.itemsize - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":592 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":590 - * return self.view.ndim - * - * @property # <<<<<<<<<<<<<< - * def itemsize(self): - * return self.view.itemsize - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":594 - * return self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def nbytes(self): - * return self.size * self.view.itemsize - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":596 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":594 - * return self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def nbytes(self): - * return self.size * self.view.itemsize - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":598 - * return self.size * self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def size(self): - * if self._size is None: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":600 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * - */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":601 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< - * - * for length in self.view.shape[:self.view.ndim]: - */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; - - /* "View.MemoryView":603 - * result = 1 - * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length - * - */ - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); - __pyx_t_5 = 0; - - /* "View.MemoryView":604 - * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< - * - * self._size = result - */ - __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); - __pyx_t_5 = 0; - } - - /* "View.MemoryView":606 - * result *= length - * - * self._size = result # <<<<<<<<<<<<<< - * - * return self._size - */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; - - /* "View.MemoryView":600 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * - */ - } - - /* "View.MemoryView":608 - * self._size = result - * - * return self._size # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; - goto __pyx_L0; - - /* "View.MemoryView":598 - * return self.size * self.view.itemsize - * - * @property # <<<<<<<<<<<<<< - * def size(self): - * if self._size is None: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":610 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ - -/* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); - - /* "View.MemoryView":611 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * - */ - __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); - if (__pyx_t_1) { - - /* "View.MemoryView":612 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< - * - * return 0 - */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; - - /* "View.MemoryView":611 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * - */ - } - - /* "View.MemoryView":614 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":610 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":616 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":617 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":618 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "View.MemoryView":617 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) - * - */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":616 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":620 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "View.MemoryView":621 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":620 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":624 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); - - /* "View.MemoryView":627 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":628 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< - * - * def is_f_contig(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":624 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":630 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); - - /* "View.MemoryView":633 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":634 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< - * - * def copy(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":630 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":636 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); - - /* "View.MemoryView":638 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< - * - * slice_copy(self, &mslice) - */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - - /* "View.MemoryView":640 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, - */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - - /* "View.MemoryView":641 - * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, - */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":646 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< - * - * def copy_fortran(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":636 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":648 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); - - /* "View.MemoryView":650 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< - * - * slice_copy(self, &src) - */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - - /* "View.MemoryView":652 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, - */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - - /* "View.MemoryView":653 - * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, - */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; - - /* "View.MemoryView":658 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":648 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":662 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - - /* "View.MemoryView":663 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":664 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; - - /* "View.MemoryView":665 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_check') - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":662 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":668 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":669 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o) noexcept: - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":668 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":671 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_idx; - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_UCS4 __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); - - /* "View.MemoryView":677 - * """ - * cdef Py_ssize_t idx - * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< - * - * result = [slice(None)] * ndim - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_index); - if (__pyx_t_2) { - __Pyx_INCREF(((PyObject*)__pyx_v_index)); - __pyx_t_1 = __pyx_v_index; - } else { - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - } - __pyx_v_tup = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":679 - * tup = index if isinstance(index, tuple) else (index,) - * - * result = [slice(None)] * ndim # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__5); - __Pyx_GIVEREF(__pyx_slice__5); - PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5); - } - } - __pyx_v_result = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":680 - * - * result = [slice(None)] * ndim - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * idx = 0 - */ - __pyx_v_have_slices = 0; - - /* "View.MemoryView":681 - * result = [slice(None)] * ndim - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * idx = 0 - * for item in tup: - */ - __pyx_v_seen_ellipsis = 0; - - /* "View.MemoryView":682 - * have_slices = False - * seen_ellipsis = False - * idx = 0 # <<<<<<<<<<<<<< - * for item in tup: - * if item is Ellipsis: - */ - __pyx_v_idx = 0; - - /* "View.MemoryView":683 - * seen_ellipsis = False - * idx = 0 - * for item in tup: # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ - if (unlikely(__pyx_v_tup == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 683, __pyx_L1_error) - } - __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - for (;;) { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":684 - * idx = 0 - * for item in tup: - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * idx += ndim - len(tup) - */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - if (__pyx_t_2) { - - /* "View.MemoryView":685 - * for item in tup: - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * idx += ndim - len(tup) - * seen_ellipsis = True - */ - __pyx_t_2 = (!__pyx_v_seen_ellipsis); - if (__pyx_t_2) { - - /* "View.MemoryView":686 - * if item is Ellipsis: - * if not seen_ellipsis: - * idx += ndim - len(tup) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * have_slices = True - */ - if (unlikely(__pyx_v_tup == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 686, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) - __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); - - /* "View.MemoryView":687 - * if not seen_ellipsis: - * idx += ndim - len(tup) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * have_slices = True - * else: - */ - __pyx_v_seen_ellipsis = 1; - - /* "View.MemoryView":685 - * for item in tup: - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * idx += ndim - len(tup) - * seen_ellipsis = True - */ - } - - /* "View.MemoryView":688 - * idx += ndim - len(tup) - * seen_ellipsis = True - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if isinstance(item, slice): - */ - __pyx_v_have_slices = 1; - - /* "View.MemoryView":684 - * idx = 0 - * for item in tup: - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * idx += ndim - len(tup) - */ - goto __pyx_L5; - } - - /* "View.MemoryView":690 - * have_slices = True - * else: - * if isinstance(item, slice): # <<<<<<<<<<<<<< - * have_slices = True - * elif not PyIndex_Check(item): - */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - if (__pyx_t_2) { - - /* "View.MemoryView":691 - * else: - * if isinstance(item, slice): - * have_slices = True # <<<<<<<<<<<<<< - * elif not PyIndex_Check(item): - * raise TypeError, f"Cannot index with type '{type(item)}'" - */ - __pyx_v_have_slices = 1; - - /* "View.MemoryView":690 - * have_slices = True - * else: - * if isinstance(item, slice): # <<<<<<<<<<<<<< - * have_slices = True - * elif not PyIndex_Check(item): - */ - goto __pyx_L7; - } - - /* "View.MemoryView":692 - * if isinstance(item, slice): - * have_slices = True - * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item - */ - __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":693 - * have_slices = True - * elif not PyIndex_Check(item): - * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< - * result[idx] = item - * idx += 1 - */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = 0; - __pyx_t_6 = 127; - __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); - __pyx_t_5 += 24; - __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_5 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(1, 693, __pyx_L1_error) - - /* "View.MemoryView":692 - * if isinstance(item, slice): - * have_slices = True - * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item - */ - } - __pyx_L7:; - - /* "View.MemoryView":694 - * elif not PyIndex_Check(item): - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item # <<<<<<<<<<<<<< - * idx += 1 - * - */ - if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) - } - __pyx_L5:; - - /* "View.MemoryView":695 - * raise TypeError, f"Cannot index with type '{type(item)}'" - * result[idx] = item - * idx += 1 # <<<<<<<<<<<<<< - * - * nslices = ndim - idx - */ - __pyx_v_idx = (__pyx_v_idx + 1); - - /* "View.MemoryView":683 - * seen_ellipsis = False - * idx = 0 - * for item in tup: # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "View.MemoryView":697 - * idx += 1 - * - * nslices = ndim - idx # <<<<<<<<<<<<<< - * return have_slices or nslices, tuple(result) - * - */ - __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - - /* "View.MemoryView":698 - * - * nslices = ndim - idx - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __pyx_t_7; - __pyx_t_7 = 0; - __pyx_L9_bool_binop_done:; - __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); - __pyx_t_1 = 0; - __pyx_t_7 = 0; - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":671 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":700 - * return have_slices or nslices, tuple(result) - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - */ - -static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - - /* "View.MemoryView":701 - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError, "Indirect dimensions not supported" - */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); - - /* "View.MemoryView":702 - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError, "Indirect dimensions not supported" - * return 0 # return type just used as an error flag - */ - __pyx_t_4 = (__pyx_v_suboffset >= 0); - if (unlikely(__pyx_t_4)) { - - /* "View.MemoryView":703 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< - * return 0 # return type just used as an error flag - * - */ - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); - __PYX_ERR(1, 703, __pyx_L1_error) - - /* "View.MemoryView":702 - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError, "Indirect dimensions not supported" - * return 0 # return type just used as an error flag - */ - } - } - - /* "View.MemoryView":704 - * if suboffset >= 0: - * raise ValueError, "Indirect dimensions not supported" - * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":700 - * return have_slices or nslices, tuple(result) - * - * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":711 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step - */ - -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - Py_ssize_t __pyx_v_cindex; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - struct __pyx_memoryview_obj *__pyx_t_3; - char *__pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":712 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst - */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; - - /* "View.MemoryView":719 - * - * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< - * - * cdef _memoryviewslice memviewsliceobj - */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - - /* "View.MemoryView":723 - * cdef _memoryviewslice memviewsliceobj - * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(__pyx_assertions_enabled())) { - __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); - if (unlikely(!__pyx_t_1)) { - __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); - __PYX_ERR(1, 723, __pyx_L1_error) - } - } - #else - if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) - #endif - - /* "View.MemoryView":725 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":726 - * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: - */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) - __pyx_t_2 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":727 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) - */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - - /* "View.MemoryView":725 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice - */ - goto __pyx_L3; - } - - /* "View.MemoryView":729 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src - * - */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - - /* "View.MemoryView":730 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; - - /* "View.MemoryView":736 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data - * - */ - __pyx_t_3 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_3; - - /* "View.MemoryView":737 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_4; - - /* "View.MemoryView":742 - * - * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step, cindex - */ - __pyx_v_p_dst = (&__pyx_v_dst); - - /* "View.MemoryView":743 - * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step, cindex - * cdef bint have_start, have_stop, have_step - */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - - /* "View.MemoryView":747 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * cindex = index - */ - __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } - } else { - __pyx_t_8 = __pyx_t_7(__pyx_t_2); - if (unlikely(!__pyx_t_8)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 747, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_v_dim = __pyx_t_5; - __pyx_t_5 = (__pyx_t_5 + 1); - - /* "View.MemoryView":748 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * cindex = index - * slice_memviewslice( - */ - __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":749 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * cindex = index # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - */ - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) - __pyx_v_cindex = __pyx_t_9; - - /* "View.MemoryView":750 - * if PyIndex_Check(index): - * cindex = index - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - */ - __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) - - /* "View.MemoryView":748 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * cindex = index - * slice_memviewslice( - */ - goto __pyx_L6; - } - - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - */ - __pyx_t_1 = (__pyx_v_index == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 - */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: - */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - */ - goto __pyx_L6; - } - - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 - */ - /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) - __pyx_t_9 = __pyx_t_11; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_9 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_9; - - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 - * - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) - __pyx_t_9 = __pyx_t_11; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_9 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_9; - - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< - * - * have_start = index.start is not None - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) - __pyx_t_9 = __pyx_t_11; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_9 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_9; - - /* "View.MemoryView":766 - * step = index.step or 0 - * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = (__pyx_t_8 != Py_None); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_have_start = __pyx_t_1; - - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None - * - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = (__pyx_t_8 != Py_None); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_have_stop = __pyx_t_1; - - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< - * - * slice_memviewslice( - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = (__pyx_t_8 != Py_None); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_have_step = __pyx_t_1; - - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - */ - __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) - - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; - - /* "View.MemoryView":747 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * cindex = index - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __Pyx_XDECREF((PyObject *)__pyx_r); - - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } - - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - } - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - /*else*/ { - __Pyx_XDECREF((PyObject *)__pyx_r); - - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "View.MemoryView":711 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":793 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":813 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: - */ - __pyx_t_1 = (!__pyx_v_is_slice); - if (__pyx_t_1) { - - /* "View.MemoryView":815 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - __pyx_t_1 = (__pyx_v_start < 0); - if (__pyx_t_1) { - - /* "View.MemoryView":816 - * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - - /* "View.MemoryView":815 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - } - - /* "View.MemoryView":817 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) - * else: - */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = (!__pyx_t_1); - if (__pyx_t_2) { - - /* "View.MemoryView":818 - * start += shape - * if not 0 <= start < shape: - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * - */ - __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) - - /* "View.MemoryView":817 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) - * else: - */ - } - - /* "View.MemoryView":813 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":821 - * else: - * - * if have_step: # <<<<<<<<<<<<<< - * negative_step = step < 0 - * if step == 0: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_have_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":822 - * - * if have_step: - * negative_step = step < 0 # <<<<<<<<<<<<<< - * if step == 0: - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - */ - __pyx_v_negative_step = (__pyx_v_step < 0); - - /* "View.MemoryView":823 - * if have_step: - * negative_step = step < 0 - * if step == 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - * else: - */ - __pyx_t_2 = (__pyx_v_step == 0); - if (__pyx_t_2) { - - /* "View.MemoryView":824 - * negative_step = step < 0 - * if step == 0: - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * negative_step = False - */ - __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - - /* "View.MemoryView":823 - * if have_step: - * negative_step = step < 0 - * if step == 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - * else: - */ - } - - /* "View.MemoryView":821 - * else: - * - * if have_step: # <<<<<<<<<<<<<< - * negative_step = step < 0 - * if step == 0: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":826 - * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) - * else: - * negative_step = False # <<<<<<<<<<<<<< - * step = 1 - * - */ - /*else*/ { - __pyx_v_negative_step = 0; - - /* "View.MemoryView":827 - * else: - * negative_step = False - * step = 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_step = 1; - } - __pyx_L6:; - - /* "View.MemoryView":830 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":831 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: - */ - __pyx_t_2 = (__pyx_v_start < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":832 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: - */ - __pyx_t_2 = (__pyx_v_start < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":834 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: - */ - __pyx_v_start = 0; - - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: - */ - } - - /* "View.MemoryView":831 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":835 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ - __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); - if (__pyx_t_2) { - - /* "View.MemoryView":836 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - if (__pyx_v_negative_step) { - - /* "View.MemoryView":837 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":836 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - goto __pyx_L11; - } - - /* "View.MemoryView":839 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L11:; - - /* "View.MemoryView":835 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ - } - __pyx_L9:; - - /* "View.MemoryView":830 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - goto __pyx_L8; - } - - /* "View.MemoryView":841 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - /*else*/ { - if (__pyx_v_negative_step) { - - /* "View.MemoryView":842 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":841 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - goto __pyx_L12; - } - - /* "View.MemoryView":844 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< - * - * if have_stop: - */ - /*else*/ { - __pyx_v_start = 0; - } - __pyx_L12:; - } - __pyx_L8:; - - /* "View.MemoryView":846 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":847 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - __pyx_t_2 = (__pyx_v_stop < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":848 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 - */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - - /* "View.MemoryView":849 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - __pyx_t_2 = (__pyx_v_stop < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":850 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape - */ - __pyx_v_stop = 0; - - /* "View.MemoryView":849 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - } - - /* "View.MemoryView":847 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - goto __pyx_L14; - } - - /* "View.MemoryView":851 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); - if (__pyx_t_2) { - - /* "View.MemoryView":852 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - __pyx_v_stop = __pyx_v_shape; - - /* "View.MemoryView":851 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - } - __pyx_L14:; - - /* "View.MemoryView":846 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - goto __pyx_L13; - } - - /* "View.MemoryView":854 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - if (__pyx_v_negative_step) { - - /* "View.MemoryView":855 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape - */ - __pyx_v_stop = -1L; - - /* "View.MemoryView":854 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - goto __pyx_L16; - } - - /* "View.MemoryView":857 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; - } - __pyx_L16:; - } - __pyx_L13:; - - /* "View.MemoryView":861 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< - * - * if (stop - start) - step * new_shape: - */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - - /* "View.MemoryView":863 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":864 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< - * - * if new_shape < 0: - */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); - - /* "View.MemoryView":863 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - } - - /* "View.MemoryView":866 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * - */ - __pyx_t_2 = (__pyx_v_new_shape < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":867 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_new_shape = 0; - - /* "View.MemoryView":866 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * - */ - } - - /* "View.MemoryView":870 - * - * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset - */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - - /* "View.MemoryView":871 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset - * - */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - - /* "View.MemoryView":872 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; - } - __pyx_L3:; - - /* "View.MemoryView":875 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":876 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride - */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - - /* "View.MemoryView":875 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - goto __pyx_L19; - } - - /* "View.MemoryView":878 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< - * - * if suboffset >= 0: - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L19:; - - /* "View.MemoryView":880 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: - */ - __pyx_t_2 = (__pyx_v_suboffset >= 0); - if (__pyx_t_2) { - - /* "View.MemoryView":881 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - __pyx_t_2 = (!__pyx_v_is_slice); - if (__pyx_t_2) { - - /* "View.MemoryView":882 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - __pyx_t_2 = (__pyx_v_new_ndim == 0); - if (__pyx_t_2) { - - /* "View.MemoryView":883 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " - */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":882 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - goto __pyx_L22; - } - - /* "View.MemoryView":885 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: - */ - /*else*/ { - - /* "View.MemoryView":886 - * else: - * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim - */ - __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) - } - __pyx_L22:; - - /* "View.MemoryView":881 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - goto __pyx_L21; - } - - /* "View.MemoryView":888 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< - * - * return 0 - */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L21:; - - /* "View.MemoryView":880 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: - */ - } - - /* "View.MemoryView":890 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":793 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":896 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_UCS4 __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); - - /* "View.MemoryView":898 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp - */ - __pyx_v_suboffset = -1L; - - /* "View.MemoryView":899 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp - * - */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":902 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len // itemsize - * stride = itemsize - */ - __pyx_t_2 = (__pyx_v_view->ndim == 0); - if (__pyx_t_2) { - - /* "View.MemoryView":903 - * - * if view.ndim == 0: - * shape = view.len // itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(1, 903, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(1, 903, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - - /* "View.MemoryView":904 - * if view.ndim == 0: - * shape = view.len // itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] - */ - __pyx_v_stride = __pyx_v_itemsize; - - /* "View.MemoryView":902 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len // itemsize - * stride = itemsize - */ - goto __pyx_L3; - } - - /* "View.MemoryView":906 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: - */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - - /* "View.MemoryView":907 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] - */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - - /* "View.MemoryView":908 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * - */ - __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); - if (__pyx_t_2) { - - /* "View.MemoryView":909 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: - */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - - /* "View.MemoryView":908 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * - */ - } - } - __pyx_L3:; - - /* "View.MemoryView":911 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - __pyx_t_2 = (__pyx_v_index < 0); - if (__pyx_t_2) { - - /* "View.MemoryView":912 - * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - - /* "View.MemoryView":913 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - __pyx_t_2 = (__pyx_v_index < 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":914 - * index += view.shape[dim] - * if index < 0: - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< - * - * if index >= shape: - */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_4 = 127; - __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_1 += 37; - __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_kp_u__7); - __pyx_t_1 += 1; - __Pyx_GIVEREF(__pyx_kp_u__7); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(1, 914, __pyx_L1_error) - - /* "View.MemoryView":913 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - } - - /* "View.MemoryView":911 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - } - - /* "View.MemoryView":916 - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":917 - * - * if index >= shape: - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride - */ - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = 0; - __pyx_t_4 = 127; - __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_1 += 37; - __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); - __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_kp_u__7); - __pyx_t_1 += 1; - __Pyx_GIVEREF(__pyx_kp_u__7); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 917, __pyx_L1_error) - - /* "View.MemoryView":916 - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - */ - } - - /* "View.MemoryView":919 - * raise IndexError, f"Out of bounds on buffer access (axis {dim})" - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset - */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - - /* "View.MemoryView":920 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * - */ - __pyx_t_2 = (__pyx_v_suboffset >= 0); - if (__pyx_t_2) { - - /* "View.MemoryView":921 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< - * - * return resultp - */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":920 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * - */ - } - - /* "View.MemoryView":923 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; - - /* "View.MemoryView":896 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":929 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * - */ - -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":930 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< - * - * cdef Py_ssize_t *shape = memslice.shape - */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; - - /* "View.MemoryView":932 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides - * - */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; - - /* "View.MemoryView":933 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; - - /* "View.MemoryView":937 - * - * cdef int i, j - * for i in range(ndim // 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":938 - * cdef int i, j - * for i in range(ndim // 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] - */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - - /* "View.MemoryView":939 - * for i in range(ndim // 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] - * - */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - - /* "View.MemoryView":940 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - - /* "View.MemoryView":942 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") - * - */ - __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { - - /* "View.MemoryView":943 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< - * - * return 0 - */ - __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - - /* "View.MemoryView":942 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") - * - */ - } - } - - /* "View.MemoryView":945 - * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":929 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":963 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - */ - -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":964 - * - * def __dealloc__(self): - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - - /* "View.MemoryView":963 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":966 - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ - -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":967 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":968 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":967 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - } - - /* "View.MemoryView":970 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "View.MemoryView":966 - * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":972 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) - */ - -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":973 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: - */ - __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); - if (__pyx_t_1) { - - /* "View.MemoryView":974 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) - */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) - - /* "View.MemoryView":973 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":976 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< - * - * cdef _get_base(self): - */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; - - /* "View.MemoryView":972 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":978 - * memoryview.assign_item_from_object(self, itemp, value) - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.from_object - * - */ - -static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_base", 0); - - /* "View.MemoryView":979 - * - * cdef _get_base(self): - * return self.from_object # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; - - /* "View.MemoryView":978 - * memoryview.assign_item_from_object(self, itemp, value) - * - * cdef _get_base(self): # <<<<<<<<<<<<<< - * return self.from_object - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - if (unlikely(__pyx_nargs > 0)) { - __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - PyObject* values[1] = {0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v___pyx_state = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":999 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - - /* "View.MemoryView":1007 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); - if (__pyx_t_1) { - - /* "View.MemoryView":1008 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "View.MemoryView":1007 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ - } - - /* "View.MemoryView":1013 - * - * - * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1015 - * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; - - /* "View.MemoryView":1016 - * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< - * - * result.from_object = ( memviewslice.memview)._get_base() - */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - - /* "View.MemoryView":1018 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo - * - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; - - /* "View.MemoryView":1019 - * - * result.from_object = ( memviewslice.memview)._get_base() - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< - * - * result.view = memviewslice.memview.view - */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - - /* "View.MemoryView":1021 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; - - /* "View.MemoryView":1022 - * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - - /* "View.MemoryView":1023 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - - /* "View.MemoryView":1024 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - - /* "View.MemoryView":1025 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - */ - Py_INCREF(Py_None); - - /* "View.MemoryView":1027 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: - */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1028 - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO - */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - - /* "View.MemoryView":1027 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: - */ - goto __pyx_L4; - } - - /* "View.MemoryView":1030 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< - * - * result.view.shape = result.from_slice.shape - */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; - } - __pyx_L4:; - - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * - */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - - /* "View.MemoryView":1033 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - - /* "View.MemoryView":1036 - * - * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; - - /* "View.MemoryView":1037 - * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); - - /* "View.MemoryView":1038 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ - __pyx_t_1 = (__pyx_v_suboffset >= 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1039 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - - /* "View.MemoryView":1040 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< - * - * result.view.len = result.view.itemsize - */ - goto __pyx_L6_break; - - /* "View.MemoryView":1038 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ - } - } - __pyx_L6_break:; - - /* "View.MemoryView":1042 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length - */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - - /* "View.MemoryView":1043 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * - */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1044 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func - */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - } - - /* "View.MemoryView":1046 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func - * - */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; - - /* "View.MemoryView":1047 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - - /* "View.MemoryView":1049 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_result); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":999 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1052 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - */ - -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - - /* "View.MemoryView":1055 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":1056 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: - */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) - __pyx_t_2 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1057 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) - */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; - - /* "View.MemoryView":1055 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice - */ - } - - /* "View.MemoryView":1059 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice - * - */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - - /* "View.MemoryView":1060 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_slice_copy') - */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; - } - - /* "View.MemoryView":1052 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1063 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ - -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); - - /* "View.MemoryView":1067 - * cdef (Py_ssize_t*) shape, strides, suboffsets - * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets - */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; - - /* "View.MemoryView":1068 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets - * - */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; - - /* "View.MemoryView":1069 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview - */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; - - /* "View.MemoryView":1071 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf - * - */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - - /* "View.MemoryView":1072 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): - */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - - /* "View.MemoryView":1074 - * dst.data = memview.view.buf - * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; - - /* "View.MemoryView":1075 - * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - - /* "View.MemoryView":1076 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - * - */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - - /* "View.MemoryView":1077 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_object') - */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; - } - - /* "View.MemoryView":1063 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1080 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - */ - -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); - - /* "View.MemoryView":1083 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) - * - */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - - /* "View.MemoryView":1084 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_object_from_slice') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1080 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1087 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ - -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *(*__pyx_t_2)(char *); - int (*__pyx_t_3)(char *, PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - - /* "View.MemoryView":1094 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - if (__pyx_t_1) { - - /* "View.MemoryView":1095 - * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - */ - __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_2; - - /* "View.MemoryView":1096 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL - */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_3; - - /* "View.MemoryView":1094 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1098 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL - * - */ - /*else*/ { - __pyx_v_to_object_func = NULL; - - /* "View.MemoryView":1099 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; - - /* "View.MemoryView":1101 - * to_dtype_func = NULL - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) - */ - __Pyx_XDECREF(__pyx_r); - - /* "View.MemoryView":1103 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1087 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1109 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< - * return -arg if arg < 0 else arg - * - */ - -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - - /* "View.MemoryView":1110 - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: - * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< - * - * @cname('__pyx_get_best_slice_order') - */ - if ((__pyx_v_arg < 0)) { - __pyx_t_1 = (-__pyx_v_arg); - } else { - __pyx_t_1 = __pyx_v_arg; - } - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":1109 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< - * return -arg if arg < 0 else arg - * - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1113 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1118 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * - */ - __pyx_v_c_stride = 0; - - /* "View.MemoryView":1119 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_f_stride = 0; - - /* "View.MemoryView":1121 - * cdef Py_ssize_t f_stride = 0 - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1122 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1123 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1124 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - goto __pyx_L4_break; - - /* "View.MemoryView":1122 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break - */ - } - } - __pyx_L4_break:; - - /* "View.MemoryView":1126 - * break - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1127 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1128 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - */ - goto __pyx_L7_break; - - /* "View.MemoryView":1127 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - } - } - __pyx_L7_break:; - - /* "View.MemoryView":1131 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); - if (__pyx_t_2) { - - /* "View.MemoryView":1132 - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' - */ - __pyx_r = 'C'; - goto __pyx_L0; - - /* "View.MemoryView":1131 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - } - - /* "View.MemoryView":1134 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) - */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; - } - - /* "View.MemoryView":1113 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1137 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, - */ - -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - - /* "View.MemoryView":1144 - * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); - - /* "View.MemoryView":1145 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] - */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - - /* "View.MemoryView":1146 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); - - /* "View.MemoryView":1147 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - - /* "View.MemoryView":1149 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - __pyx_t_1 = (__pyx_v_ndim == 1); - if (__pyx_t_1) { - - /* "View.MemoryView":1150 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - __pyx_t_2 = (__pyx_v_src_stride > 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_dst_stride > 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - - /* "View.MemoryView":1151 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_1 = __pyx_t_2; - __pyx_L5_bool_binop_done:; - - /* "View.MemoryView":1150 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - if (__pyx_t_1) { - - /* "View.MemoryView":1152 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): - */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - - /* "View.MemoryView":1150 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - goto __pyx_L4; - } - - /* "View.MemoryView":1154 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - */ - /*else*/ { - __pyx_t_3 = __pyx_v_dst_extent; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "View.MemoryView":1155 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride - */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - - /* "View.MemoryView":1156 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - - /* "View.MemoryView":1157 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): - */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; - - /* "View.MemoryView":1149 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1159 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, - */ - /*else*/ { - __pyx_t_3 = __pyx_v_dst_extent; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, - */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - - /* "View.MemoryView":1164 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - - /* "View.MemoryView":1165 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, - */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1137 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, - */ - - /* function exit code */ -} - -/* "View.MemoryView":1167 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) noexcept nogil: - */ - -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1170 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) noexcept nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) - * - */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1167 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) noexcept nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1174 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - */ - -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1176 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< - * - * for shape in src.shape[:ndim]: - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; - - /* "View.MemoryView":1178 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape - * - */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); - - /* "View.MemoryView":1179 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< - * - * return size - */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } - - /* "View.MemoryView":1181 - * size *= shape - * - * return size # <<<<<<<<<<<<<< - * - * @cname('__pyx_fill_contig_strides_array') - */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; - - /* "View.MemoryView":1174 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1184 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) noexcept nogil: - */ - -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1193 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - __pyx_t_1 = (__pyx_v_order == 'F'); - if (__pyx_t_1) { - - /* "View.MemoryView":1194 - * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; - - /* "View.MemoryView":1195 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: - */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - - /* "View.MemoryView":1196 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): - */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - - /* "View.MemoryView":1193 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1198 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; - - /* "View.MemoryView":1199 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * - */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - - /* "View.MemoryView":1200 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * - * return stride - */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; - - /* "View.MemoryView":1202 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_data_to_temp') - */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; - - /* "View.MemoryView":1184 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) noexcept nogil: - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1205 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, - */ - -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":1216 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1217 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< - * - * result = malloc(size) - */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - - /* "View.MemoryView":1219 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err_no_memory() - */ - __pyx_v_result = malloc(__pyx_v_size); - - /* "View.MemoryView":1220 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err_no_memory() - * - */ - __pyx_t_2 = (!(__pyx_v_result != 0)); - if (__pyx_t_2) { - - /* "View.MemoryView":1221 - * result = malloc(size) - * if not result: - * _err_no_memory() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - - /* "View.MemoryView":1220 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err_no_memory() - * - */ - } - - /* "View.MemoryView":1224 - * - * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): - */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - - /* "View.MemoryView":1225 - * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - - /* "View.MemoryView":1226 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1227 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 - * - */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - - /* "View.MemoryView":1228 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) - */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } - - /* "View.MemoryView":1230 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< - * - * - */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - - /* "View.MemoryView":1233 - * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1234 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * - */ - __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1235 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): - */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - - /* "View.MemoryView":1234 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * - */ - } - } - - /* "View.MemoryView":1237 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1238 - * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - - /* "View.MemoryView":1237 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":1240 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< - * - * return result - */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); - } - __pyx_L9:; - - /* "View.MemoryView":1242 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "View.MemoryView":1205 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1247 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" - */ - -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - Py_UCS4 __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); - - /* "View.MemoryView":1249 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_dim') - */ - __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = 0; - __pyx_t_3 = 127; - __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); - __pyx_t_2 += 35; - __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); - __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u_got); - __pyx_t_2 += 6; - __Pyx_GIVEREF(__pyx_kp_u_got); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); - __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u_and); - __pyx_t_2 += 5; - __Pyx_GIVEREF(__pyx_kp_u_and); - PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); - __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_kp_u__7); - __pyx_t_2 += 1; - __Pyx_GIVEREF(__pyx_kp_u__7); - PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 1249, __pyx_L1_error) - - /* "View.MemoryView":1247 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1252 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg % dim - * - */ - -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_msg); - - /* "View.MemoryView":1253 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: - * raise error, msg % dim # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 1253, __pyx_L1_error) - - /* "View.MemoryView":1252 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg % dim - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_msg); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1256 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg - * - */ - -static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_msg); - - /* "View.MemoryView":1257 - * @cname('__pyx_memoryview_err') - * cdef int _err(PyObject *error, str msg) except -1 with gil: - * raise error, msg # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_no_memory') - */ - __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); - __PYX_ERR(1, 1257, __pyx_L1_error) - - /* "View.MemoryView":1256 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< - * raise error, msg - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_msg); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1260 - * - * @cname('__pyx_memoryview_err_no_memory') - * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - -static int __pyx_memoryview_err_no_memory(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_no_memory", 0); - - /* "View.MemoryView":1261 - * @cname('__pyx_memoryview_err_no_memory') - * cdef int _err_no_memory() except -1 with gil: - * raise MemoryError # <<<<<<<<<<<<<< - * - * - */ - PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - - /* "View.MemoryView":1260 - * - * @cname('__pyx_memoryview_err_no_memory') - * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1265 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; - int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "View.MemoryView":1273 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; - - /* "View.MemoryView":1274 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1276 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False - */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - - /* "View.MemoryView":1277 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp - */ - __pyx_v_broadcasting = 0; - - /* "View.MemoryView":1278 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp - * - */ - __pyx_v_direct_copy = 0; - - /* "View.MemoryView":1281 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1282 - * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - - /* "View.MemoryView":1281 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1283 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1284 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< - * - * cdef int ndim = max(src_ndim, dst_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - - /* "View.MemoryView":1283 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - } - __pyx_L3:; - - /* "View.MemoryView":1286 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if ((__pyx_t_3 > __pyx_t_4)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_ndim = __pyx_t_5; - - /* "View.MemoryView":1288 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1289 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True - */ - __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); - if (__pyx_t_2) { - - /* "View.MemoryView":1290 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 - */ - __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); - if (__pyx_t_2) { - - /* "View.MemoryView":1291 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: - */ - __pyx_v_broadcasting = 1; - - /* "View.MemoryView":1292 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) - */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; - - /* "View.MemoryView":1290 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 - */ - goto __pyx_L7; - } - - /* "View.MemoryView":1294 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: - */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) - } - __pyx_L7:; - - /* "View.MemoryView":1289 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True - */ - } - - /* "View.MemoryView":1296 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - */ - __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1297 - * - * if src.suboffsets[i] >= 0: - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< - * - * if slices_overlap(&src, &dst, ndim, itemsize): - */ - __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - - /* "View.MemoryView":1296 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - */ - } - } - - /* "View.MemoryView":1299 - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - if (__pyx_t_2) { - - /* "View.MemoryView":1301 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ - __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); - if (__pyx_t_2) { - - /* "View.MemoryView":1302 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - - /* "View.MemoryView":1301 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ - } - - /* "View.MemoryView":1304 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * - */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; - - /* "View.MemoryView":1305 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< - * - * if not broadcasting: - */ - __pyx_v_src = __pyx_v_tmp; - - /* "View.MemoryView":1299 - * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - } - - /* "View.MemoryView":1307 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = (!__pyx_v_broadcasting); - if (__pyx_t_2) { - - /* "View.MemoryView":1310 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - */ - __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1311 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) - */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - - /* "View.MemoryView":1310 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - */ - goto __pyx_L12; - } - - /* "View.MemoryView":1312 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - */ - __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); - if (__pyx_t_2) { - - /* "View.MemoryView":1313 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< - * - * if direct_copy: - */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - - /* "View.MemoryView":1312 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - */ - } - __pyx_L12:; - - /* "View.MemoryView":1315 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - */ - if (__pyx_v_direct_copy) { - - /* "View.MemoryView":1317 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1318 - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * free(tmpdata) - */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - - /* "View.MemoryView":1319 - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1320 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1321 - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * if order == 'F' == get_best_order(&dst, ndim): - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":1315 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - */ - } - - /* "View.MemoryView":1307 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":1323 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); - } - if (__pyx_t_2) { - - /* "View.MemoryView":1326 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - - /* "View.MemoryView":1327 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - - /* "View.MemoryView":1323 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":1329 - * transpose_memslice(&dst) - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1330 - * - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * - */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1331 - * refcount_copying(&dst, dtype_is_object, ndim, inc=False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< - * - * free(tmpdata) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1333 - * refcount_copying(&dst, dtype_is_object, ndim, inc=True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1334 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_broadcast_leading') - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":1265 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - - /* function exit code */ - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1337 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) noexcept nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - - /* "View.MemoryView":1341 - * int ndim_other) noexcept nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - - /* "View.MemoryView":1343 - * cdef int offset = ndim_other - ndim - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1344 - * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - - /* "View.MemoryView":1345 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1346 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): - */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } - - /* "View.MemoryView":1348 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1349 - * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 - */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - - /* "View.MemoryView":1350 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 - * - */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - - /* "View.MemoryView":1351 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; - } - - /* "View.MemoryView":1337 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) noexcept nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1359 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< - * - * if dtype_is_object: - */ - -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - - /* "View.MemoryView":1361 - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) - * - */ - if (__pyx_v_dtype_is_object) { - - /* "View.MemoryView":1362 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1361 - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) - * - */ - } - - /* "View.MemoryView":1359 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< - * - * if dtype_is_object: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1365 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) noexcept with gil: - */ - -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1368 - * Py_ssize_t *strides, int ndim, - * bint inc) noexcept with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1365 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) noexcept with gil: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif -} - -/* "View.MemoryView":1371 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc) noexcept: - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - - /* "View.MemoryView":1374 - * Py_ssize_t *strides, int ndim, bint inc) noexcept: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * - * for i in range(shape[0]): - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1376 - * cdef Py_ssize_t stride = strides[0] - * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: - */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1377 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - __pyx_t_4 = (__pyx_v_ndim == 1); - if (__pyx_t_4) { - - /* "View.MemoryView":1378 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - if (__pyx_v_inc) { - - /* "View.MemoryView":1379 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) - */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); - - /* "View.MemoryView":1378 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":1381 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) - */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; - - /* "View.MemoryView":1377 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - goto __pyx_L5; - } - - /* "View.MemoryView":1383 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< - * - * data += stride - */ - /*else*/ { - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; - - /* "View.MemoryView":1385 - * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) - * - * data += stride # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - - /* "View.MemoryView":1371 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc) noexcept: - * cdef Py_ssize_t i - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) noexcept nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1394 - * size_t itemsize, void *item, - * bint dtype_is_object) noexcept nogil: - * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, inc=True) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1395 - * bint dtype_is_object) noexcept nogil: - * refcount_copying(dst, dtype_is_object, ndim, inc=False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< - * refcount_copying(dst, dtype_is_object, ndim, inc=True) - * - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1396 - * refcount_copying(dst, dtype_is_object, ndim, inc=False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< - * - * - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) noexcept nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1400 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) noexcept nogil: - */ - -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1404 - * size_t itemsize, void *item) noexcept nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] - * - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1405 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_extent = (__pyx_v_shape[0]); - - /* "View.MemoryView":1407 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - __pyx_t_1 = (__pyx_v_ndim == 1); - if (__pyx_t_1) { - - /* "View.MemoryView":1408 - * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1409 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - - /* "View.MemoryView":1410 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - - /* "View.MemoryView":1407 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1412 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) - * data += stride - */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1413 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< - * data += stride - * - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1414 - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1400 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) noexcept nogil: - */ - - /* function exit code */ -} - -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 3)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "(tree fragment)":6 - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - */ - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 6, __pyx_L1_error) - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - */ - } - - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_v___pyx_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - __pyx_t_2 = (__pyx_v___pyx_state != Py_None); - if (__pyx_t_2) { - - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - } - - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 > 1); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_2 = __pyx_t_4; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 14, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; - } - } - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - } - - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ - -static void __pyx_f_15monotonic_align_4core_maximum_path_each(__Pyx_memviewslice __pyx_v_path, __Pyx_memviewslice __pyx_v_value, int __pyx_v_t_y, int __pyx_v_t_x, struct __pyx_opt_args_15monotonic_align_4core_maximum_path_each *__pyx_optional_args) { - float __pyx_v_max_neg_val = __pyx_k__9; - int __pyx_v_x; - int __pyx_v_y; - float __pyx_v_v_prev; - float __pyx_v_v_cur; - int __pyx_v_index; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - long __pyx_t_4; - int __pyx_t_5; - long __pyx_t_6; - long __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - float __pyx_t_11; - float __pyx_t_12; - float __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_max_neg_val = __pyx_optional_args->max_neg_val; - } - } - - /* "monotonic_align/core.pyx":13 - * cdef float v_cur - * cdef float tmp - * cdef int index = t_x - 1 # <<<<<<<<<<<<<< - * - * for y in range(t_y): - */ - __pyx_v_index = (__pyx_v_t_x - 1); - - /* "monotonic_align/core.pyx":15 - * cdef int index = t_x - 1 - * - * for y in range(t_y): # <<<<<<<<<<<<<< - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: - */ - __pyx_t_1 = __pyx_v_t_y; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_y = __pyx_t_3; - - /* "monotonic_align/core.pyx":16 - * - * for y in range(t_y): - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): # <<<<<<<<<<<<<< - * if x == y: - * v_cur = max_neg_val - */ - __pyx_t_4 = (__pyx_v_y + 1); - __pyx_t_5 = __pyx_v_t_x; - if ((__pyx_t_4 < __pyx_t_5)) { - __pyx_t_6 = __pyx_t_4; - } else { - __pyx_t_6 = __pyx_t_5; - } - __pyx_t_4 = __pyx_t_6; - __pyx_t_5 = ((__pyx_v_t_x + __pyx_v_y) - __pyx_v_t_y); - __pyx_t_6 = 0; - if ((__pyx_t_5 > __pyx_t_6)) { - __pyx_t_7 = __pyx_t_5; - } else { - __pyx_t_7 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_4; - for (__pyx_t_5 = __pyx_t_7; __pyx_t_5 < __pyx_t_6; __pyx_t_5+=1) { - __pyx_v_x = __pyx_t_5; - - /* "monotonic_align/core.pyx":17 - * for y in range(t_y): - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: # <<<<<<<<<<<<<< - * v_cur = max_neg_val - * else: - */ - __pyx_t_8 = (__pyx_v_x == __pyx_v_y); - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":18 - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: - * v_cur = max_neg_val # <<<<<<<<<<<<<< - * else: - * v_cur = value[y-1, x] - */ - __pyx_v_v_cur = __pyx_v_max_neg_val; - - /* "monotonic_align/core.pyx":17 - * for y in range(t_y): - * for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)): - * if x == y: # <<<<<<<<<<<<<< - * v_cur = max_neg_val - * else: - */ - goto __pyx_L7; - } - - /* "monotonic_align/core.pyx":20 - * v_cur = max_neg_val - * else: - * v_cur = value[y-1, x] # <<<<<<<<<<<<<< - * if x == 0: - * if y == 0: - */ - /*else*/ { - __pyx_t_9 = (__pyx_v_y - 1); - __pyx_t_10 = __pyx_v_x; - __pyx_v_v_cur = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_9 * __pyx_v_value.strides[0]) )) + __pyx_t_10)) ))); - } - __pyx_L7:; - - /* "monotonic_align/core.pyx":21 - * else: - * v_cur = value[y-1, x] - * if x == 0: # <<<<<<<<<<<<<< - * if y == 0: - * v_prev = 0. - */ - __pyx_t_8 = (__pyx_v_x == 0); - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":22 - * v_cur = value[y-1, x] - * if x == 0: - * if y == 0: # <<<<<<<<<<<<<< - * v_prev = 0. - * else: - */ - __pyx_t_8 = (__pyx_v_y == 0); - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":23 - * if x == 0: - * if y == 0: - * v_prev = 0. # <<<<<<<<<<<<<< - * else: - * v_prev = max_neg_val - */ - __pyx_v_v_prev = 0.; - - /* "monotonic_align/core.pyx":22 - * v_cur = value[y-1, x] - * if x == 0: - * if y == 0: # <<<<<<<<<<<<<< - * v_prev = 0. - * else: - */ - goto __pyx_L9; - } - - /* "monotonic_align/core.pyx":25 - * v_prev = 0. - * else: - * v_prev = max_neg_val # <<<<<<<<<<<<<< - * else: - * v_prev = value[y-1, x-1] - */ - /*else*/ { - __pyx_v_v_prev = __pyx_v_max_neg_val; - } - __pyx_L9:; - - /* "monotonic_align/core.pyx":21 - * else: - * v_cur = value[y-1, x] - * if x == 0: # <<<<<<<<<<<<<< - * if y == 0: - * v_prev = 0. - */ - goto __pyx_L8; - } - - /* "monotonic_align/core.pyx":27 - * v_prev = max_neg_val - * else: - * v_prev = value[y-1, x-1] # <<<<<<<<<<<<<< - * value[y, x] += max(v_prev, v_cur) - * - */ - /*else*/ { - __pyx_t_10 = (__pyx_v_y - 1); - __pyx_t_9 = (__pyx_v_x - 1); - __pyx_v_v_prev = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_10 * __pyx_v_value.strides[0]) )) + __pyx_t_9)) ))); - } - __pyx_L8:; - - /* "monotonic_align/core.pyx":28 - * else: - * v_prev = value[y-1, x-1] - * value[y, x] += max(v_prev, v_cur) # <<<<<<<<<<<<<< - * - * for y in range(t_y - 1, -1, -1): - */ - __pyx_t_11 = __pyx_v_v_cur; - __pyx_t_12 = __pyx_v_v_prev; - if ((__pyx_t_11 > __pyx_t_12)) { - __pyx_t_13 = __pyx_t_11; - } else { - __pyx_t_13 = __pyx_t_12; - } - __pyx_t_9 = __pyx_v_y; - __pyx_t_10 = __pyx_v_x; - *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_9 * __pyx_v_value.strides[0]) )) + __pyx_t_10)) )) += __pyx_t_13; - } - } - - /* "monotonic_align/core.pyx":30 - * value[y, x] += max(v_prev, v_cur) - * - * for y in range(t_y - 1, -1, -1): # <<<<<<<<<<<<<< - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): - */ - for (__pyx_t_1 = (__pyx_v_t_y - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_y = __pyx_t_1; - - /* "monotonic_align/core.pyx":31 - * - * for y in range(t_y - 1, -1, -1): - * path[y, index] = 1 # <<<<<<<<<<<<<< - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): - * index = index - 1 - */ - __pyx_t_10 = __pyx_v_y; - __pyx_t_9 = __pyx_v_index; - *((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_path.data + __pyx_t_10 * __pyx_v_path.strides[0]) )) + __pyx_t_9)) )) = 1; - - /* "monotonic_align/core.pyx":32 - * for y in range(t_y - 1, -1, -1): - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): # <<<<<<<<<<<<<< - * index = index - 1 - * - */ - __pyx_t_14 = (__pyx_v_index != 0); - if (__pyx_t_14) { - } else { - __pyx_t_8 = __pyx_t_14; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_14 = (__pyx_v_index == __pyx_v_y); - if (!__pyx_t_14) { - } else { - __pyx_t_8 = __pyx_t_14; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_9 = (__pyx_v_y - 1); - __pyx_t_10 = __pyx_v_index; - __pyx_t_15 = (__pyx_v_y - 1); - __pyx_t_16 = (__pyx_v_index - 1); - __pyx_t_14 = ((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_9 * __pyx_v_value.strides[0]) )) + __pyx_t_10)) ))) < (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_value.data + __pyx_t_15 * __pyx_v_value.strides[0]) )) + __pyx_t_16)) )))); - __pyx_t_8 = __pyx_t_14; - __pyx_L13_bool_binop_done:; - if (__pyx_t_8) { - - /* "monotonic_align/core.pyx":33 - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): - * index = index - 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_index = (__pyx_v_index - 1); - - /* "monotonic_align/core.pyx":32 - * for y in range(t_y - 1, -1, -1): - * path[y, index] = 1 - * if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]): # <<<<<<<<<<<<<< - * index = index - 1 - * - */ - } - } - - /* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ - - /* function exit code */ -} - -/* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - -static PyObject *__pyx_pw_15monotonic_align_4core_1maximum_path_c(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static void __pyx_f_15monotonic_align_4core_maximum_path_c(__Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs, CYTHON_UNUSED int __pyx_skip_dispatch) { - CYTHON_UNUSED int __pyx_v_b; - int __pyx_v_i; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save; - #endif - - /* "monotonic_align/core.pyx":39 - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: - * cdef int b = paths.shape[0] # <<<<<<<<<<<<<< - * cdef int i - * for i in prange(b, nogil=True): - */ - __pyx_v_b = (__pyx_v_paths.shape[0]); - - /* "monotonic_align/core.pyx":41 - * cdef int b = paths.shape[0] - * cdef int i - * for i in prange(b, nogil=True): # <<<<<<<<<<<<<< - * maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i]) - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - _save = NULL; - if (PyGILState_Check()) { - Py_UNBLOCK_THREADS - } - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_b; - { - int __pyx_parallel_temp0 = ((int)0xbad0bad0); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_6, __pyx_t_7) firstprivate(__pyx_t_4, __pyx_t_5) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - - /* "monotonic_align/core.pyx":42 - * cdef int i - * for i in prange(b, nogil=True): - * maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i]) # <<<<<<<<<<<<<< - */ - __pyx_t_4.data = __pyx_v_paths.data; - __pyx_t_4.memview = __pyx_v_paths.memview; - __PYX_INC_MEMVIEW(&__pyx_t_4, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_stride = __pyx_v_paths.strides[0]; - __pyx_t_4.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_4.shape[0] = __pyx_v_paths.shape[1]; -__pyx_t_4.strides[0] = __pyx_v_paths.strides[1]; - __pyx_t_4.suboffsets[0] = -1; - -__pyx_t_4.shape[1] = __pyx_v_paths.shape[2]; -__pyx_t_4.strides[1] = __pyx_v_paths.strides[2]; - __pyx_t_4.suboffsets[1] = -1; - -__pyx_t_5.data = __pyx_v_values.data; - __pyx_t_5.memview = __pyx_v_values.memview; - __PYX_INC_MEMVIEW(&__pyx_t_5, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_stride = __pyx_v_values.strides[0]; - __pyx_t_5.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_5.shape[0] = __pyx_v_values.shape[1]; -__pyx_t_5.strides[0] = __pyx_v_values.strides[1]; - __pyx_t_5.suboffsets[0] = -1; - -__pyx_t_5.shape[1] = __pyx_v_values.shape[2]; -__pyx_t_5.strides[1] = __pyx_v_values.strides[2]; - __pyx_t_5.suboffsets[1] = -1; - -__pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_i; - __pyx_f_15monotonic_align_4core_maximum_path_each(__pyx_t_4, __pyx_t_5, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_t_ys.data) + __pyx_t_6)) ))), (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_t_xs.data) + __pyx_t_7)) ))), NULL); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 42, __pyx_L8_error) - __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 0); - __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL; - __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 0); - __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - goto __pyx_L11; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L10; - __pyx_L10:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates0) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_i; - } - __pyx_L11:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 0); - __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL; - __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 0); - __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_i = __pyx_parallel_temp0; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "monotonic_align/core.pyx":41 - * cdef int b = paths.shape[0] - * cdef int i - * for i in prange(b, nogil=True): # <<<<<<<<<<<<<< - * maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i]) - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - if (_save) { - Py_BLOCK_THREADS - } - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - if (_save) { - Py_BLOCK_THREADS - } - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } - - /* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - #ifdef WITH_THREAD - __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("monotonic_align.core.maximum_path_c", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __pyx_L0:; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_15monotonic_align_4core_1maximum_path_c(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -static PyMethodDef __pyx_mdef_15monotonic_align_4core_1maximum_path_c = {"maximum_path_c", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15monotonic_align_4core_1maximum_path_c, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15monotonic_align_4core_1maximum_path_c(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - __Pyx_memviewslice __pyx_v_paths = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_values = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_t_ys = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_t_xs = { 0, 0, { 0 }, { 0 }, { 0 } }; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("maximum_path_c (wrapper)", 0); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paths,&__pyx_n_s_values,&__pyx_n_s_t_ys,&__pyx_n_s_t_xs,0}; - PyObject* values[4] = {0,0,0,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_paths)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_values)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, 1); __PYX_ERR(0, 38, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t_ys)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, 2); __PYX_ERR(0, 38, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t_xs)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, 3); __PYX_ERR(0, 38, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "maximum_path_c") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 4)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - } - __pyx_v_paths = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_paths.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_v_values = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_values.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_v_t_ys = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_t_ys.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_v_t_xs = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_t_xs.memview)) __PYX_ERR(0, 38, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("maximum_path_c", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error) - __pyx_L3_error:; - __PYX_XCLEAR_MEMVIEW(&__pyx_v_paths, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_values, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_ys, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_xs, 1); - __Pyx_AddTraceback("monotonic_align.core.maximum_path_c", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15monotonic_align_4core_maximum_path_c(__pyx_self, __pyx_v_paths, __pyx_v_values, __pyx_v_t_ys, __pyx_v_t_xs); - - /* function exit code */ - __PYX_XCLEAR_MEMVIEW(&__pyx_v_paths, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_values, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_ys, 1); - __PYX_XCLEAR_MEMVIEW(&__pyx_v_t_xs, 1); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15monotonic_align_4core_maximum_path_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("maximum_path_c", 0); - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_paths.memview)) { __Pyx_RaiseUnboundLocalError("paths"); __PYX_ERR(0, 38, __pyx_L1_error) } - if (unlikely(!__pyx_v_values.memview)) { __Pyx_RaiseUnboundLocalError("values"); __PYX_ERR(0, 38, __pyx_L1_error) } - if (unlikely(!__pyx_v_t_ys.memview)) { __Pyx_RaiseUnboundLocalError("t_ys"); __PYX_ERR(0, 38, __pyx_L1_error) } - if (unlikely(!__pyx_v_t_xs.memview)) { __Pyx_RaiseUnboundLocalError("t_xs"); __PYX_ERR(0, 38, __pyx_L1_error) } - __pyx_f_15monotonic_align_4core_maximum_path_c(__pyx_v_paths, __pyx_v_values, __pyx_v_t_ys, __pyx_v_t_xs, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("monotonic_align.core.maximum_path_c", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_array __pyx_vtable_array; - -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_array___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); - } - else { - __Pyx_TypeName o_type_name; - o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); - __Pyx_DECREF_TypeName(o_type_name); - return -1; - } -} - -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); - } - return v; -} - -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); -} - -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -#if !CYTHON_COMPILING_IN_LIMITED_API - -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; -#endif -static PyType_Slot __pyx_type___pyx_array_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, - {Py_sq_length, (void *)__pyx_array___len__}, - {Py_sq_item, (void *)__pyx_sq_item_array}, - {Py_mp_length, (void *)__pyx_array___len__}, - {Py_mp_subscript, (void *)__pyx_array___getitem__}, - {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, - {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, - #if defined(Py_bf_getbuffer) - {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, - #endif - {Py_tp_methods, (void *)__pyx_methods_array}, - {Py_tp_getset, (void *)__pyx_getsets_array}, - {Py_tp_new, (void *)__pyx_tp_new_array}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_array_spec = { - "monotonic_align.core.array", - sizeof(struct __pyx_array_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, - __pyx_type___pyx_array_slots, -}; -#else - -static PySequenceMethods __pyx_tp_as_sequence_array = { - __pyx_array___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_array = { - __pyx_array___len__, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; - -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""array", /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - __pyx_tp_getattro_array, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_array, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_array, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_array, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif - -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_MemviewEnum_obj *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_MemviewEnum_obj *)o); - p->name = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - if (p->name) { - e = (*v)(p->name, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_Enum(PyObject *o) { - PyObject* tmp; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - tmp = ((PyObject*)p->name); - p->name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { - return __pyx_MemviewEnum___repr__(self); -} - -static PyMethodDef __pyx_methods_Enum[] = { - {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, - {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, - {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, - {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, - {Py_tp_methods, (void *)__pyx_methods_Enum}, - {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, - {Py_tp_new, (void *)__pyx_tp_new_Enum}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { - "monotonic_align.core.Enum", - sizeof(struct __pyx_MemviewEnum_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, - __pyx_type___pyx_MemviewEnum_slots, -}; -#else - -static PyTypeObject __pyx_type___pyx_MemviewEnum = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""Enum", /*tp_name*/ - sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_Enum, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_MemviewEnum___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_Enum, /*tp_traverse*/ - __pyx_tp_clear_Enum, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_Enum, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - __pyx_MemviewEnum___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_Enum, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif -static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; - -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryview_obj *p; - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - p = ((struct __pyx_memoryview_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_memoryview; - p->obj = Py_None; Py_INCREF(Py_None); - p->_size = Py_None; Py_INCREF(Py_None); - p->_array_interface = Py_None; Py_INCREF(Py_None); - p->view.obj = NULL; - if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryview___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->obj); - Py_CLEAR(p->_size); - Py_CLEAR(p->_array_interface); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - if (p->obj) { - e = (*v)(p->obj, a); if (e) return e; - } - if (p->_size) { - e = (*v)(p->_size, a); if (e) return e; - } - if (p->_array_interface) { - e = (*v)(p->_array_interface, a); if (e) return e; - } - if (p->view.obj) { - e = (*v)(p->view.obj, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_memoryview(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - tmp = ((PyObject*)p->obj); - p->obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_size); - p->_size = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_array_interface); - p->_array_interface = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - Py_CLEAR(p->view.obj); - return 0; -} -static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_memoryview___setitem__(o, i, v); - } - else { - __Pyx_TypeName o_type_name; - o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); - __Pyx_DECREF_TypeName(o_type_name); - return -1; - } -} - -static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); -} - -static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { - return __pyx_memoryview___repr__(self); -} - -static PyMethodDef __pyx_methods_memoryview[] = { - {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, - {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_memoryview[] = { - {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, - {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, - {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, - {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, - {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, - {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, - {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, - {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, - {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -#if !CYTHON_COMPILING_IN_LIMITED_API - -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; -#endif -static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, - {Py_tp_repr, (void *)__pyx_memoryview___repr__}, - {Py_sq_length, (void *)__pyx_memoryview___len__}, - {Py_sq_item, (void *)__pyx_sq_item_memoryview}, - {Py_mp_length, (void *)__pyx_memoryview___len__}, - {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, - {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, - {Py_tp_str, (void *)__pyx_memoryview___str__}, - #if defined(Py_bf_getbuffer) - {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, - #endif - {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, - {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, - {Py_tp_methods, (void *)__pyx_methods_memoryview}, - {Py_tp_getset, (void *)__pyx_getsets_memoryview}, - {Py_tp_new, (void *)__pyx_tp_new_memoryview}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_memoryview_spec = { - "monotonic_align.core.memoryview", - sizeof(struct __pyx_memoryview_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, - __pyx_type___pyx_memoryview_slots, -}; -#else - -static PySequenceMethods __pyx_tp_as_sequence_memoryview = { - __pyx_memoryview___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_memoryview, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_memoryview = { - __pyx_memoryview___len__, /*mp_length*/ - __pyx_memoryview___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; - -static PyTypeObject __pyx_type___pyx_memoryview = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""memoryview", /*tp_name*/ - sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_memoryview___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_memoryview___str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_memoryview, /*tp_traverse*/ - __pyx_tp_clear_memoryview, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_memoryview, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_memoryview, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_memoryview, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif -static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; - -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryviewslice_obj *p; - PyObject *o = __pyx_tp_new_memoryview(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryviewslice_obj *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; - p->from_object = Py_None; Py_INCREF(Py_None); - p->from_slice.memview = NULL; - return o; -} - -static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { - if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryviewslice___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->from_object); - PyObject_GC_Track(o); - __pyx_tp_dealloc_memoryview(o); -} - -static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; - if (p->from_object) { - e = (*v)(p->from_object, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - __pyx_tp_clear_memoryview(o); - tmp = ((PyObject*)p->from_object); - p->from_object = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); - return 0; -} - -static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, - {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, - {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, - {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, - {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, - {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, - {0, 0}, -}; -static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { - "monotonic_align.core._memoryviewslice", - sizeof(struct __pyx_memoryviewslice_obj), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, - __pyx_type___pyx_memoryviewslice_slots, -}; -#else - -static PyTypeObject __pyx_type___pyx_memoryviewslice = { - PyVarObject_HEAD_INIT(0, 0) - "monotonic_align.core.""_memoryviewslice", /*tp_name*/ - sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - #if CYTHON_COMPILING_IN_PYPY || 0 - __pyx_memoryview___repr__, /*tp_repr*/ - #else - 0, /*tp_repr*/ - #endif - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY || 0 - __pyx_memoryview___str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ - PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ - __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ - __pyx_tp_clear__memoryviewslice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods__memoryviewslice, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - #if !CYTHON_USE_TYPE_SPECS - 0, /*tp_dictoffset*/ - #endif - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new__memoryviewslice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if __PYX_NEED_TP_PRINT_SLOT == 1 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030C0000 - 0, /*tp_watched*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, /*tp_pypy_flags*/ - #endif -}; -#endif - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif -/* #### Code section: pystring_table ### */ - -static int __Pyx_CreateStringTabAndInitStrings(void) { - __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, - {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, - {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, - {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, - {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, - {&__pyx_n_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 1}, - {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, - {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, - {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, - {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, - {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, - {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_core_pyx, __pyx_k_core_pyx, sizeof(__pyx_k_core_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, - {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, - {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, - {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maximum_path_c, __pyx_k_maximum_path_c, sizeof(__pyx_k_maximum_path_c), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_monotonic_align_core, __pyx_k_monotonic_align_core, sizeof(__pyx_k_monotonic_align_core), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_paths, __pyx_k_paths, sizeof(__pyx_k_paths), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_t_xs, __pyx_k_t_xs, sizeof(__pyx_k_t_xs), 0, 0, 1, 1}, - {&__pyx_n_s_t_ys, __pyx_k_t_ys, sizeof(__pyx_k_t_ys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, - {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} - }; - return __Pyx_InitStrings(__pyx_string_tab); -} -/* #### Code section: cached_builtins ### */ -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 15, __pyx_L1_error) - __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) - __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: cached_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "View.MemoryView":582 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "View.MemoryView":679 - * tup = index if isinstance(index, tuple) else (index,) - * - * result = [slice(None)] * ndim # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__5); - __Pyx_GIVEREF(__pyx_slice__5); - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum - */ - __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "View.MemoryView":100 - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: - * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "View.MemoryView":101 - * try: - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "View.MemoryView":103 - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< - * except: - * - */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "View.MemoryView":309 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "View.MemoryView":310 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "View.MemoryView":311 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "View.MemoryView":314 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "View.MemoryView":315 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__19 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(1, 1, __pyx_L1_error) - - /* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - __pyx_tuple__21 = PyTuple_Pack(4, __pyx_n_s_paths, __pyx_n_s_values, __pyx_n_s_t_ys, __pyx_n_s_t_xs); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_core_pyx, __pyx_n_s_maximum_path_c, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -/* #### Code section: init_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { - if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_globals ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* AssertionsEnabled.init */ - __Pyx_init_assertions_enabled(); - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_module ### */ - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); - generic = Py_None; Py_INCREF(Py_None); - strided = Py_None; Py_INCREF(Py_None); - indirect = Py_None; Py_INCREF(Py_None); - contiguous = Py_None; Py_INCREF(Py_None); - indirect_contiguous = Py_None; Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_array = &__pyx_vtable_array; - __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - #if CYTHON_USE_TYPE_SPECS - __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; - if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { - __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; - } - #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) - /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ - #elif defined(_MSC_VER) - #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") - #else - #warning "The buffer protocol is not supported in the Limited C-API < 3.11." - #endif - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #else - __pyx_array_type = &__pyx_type___pyx_array; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_array_type->tp_print = 0; - #endif - if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - #endif - #if CYTHON_USE_TYPE_SPECS - __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) - #else - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_MemviewEnum_type->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) - #endif - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; - #if CYTHON_USE_TYPE_SPECS - __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; - if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { - __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; - } - #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) - /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ - #elif defined(_MSC_VER) - #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") - #else - #warning "The buffer protocol is not supported in the Limited C-API < 3.11." - #endif - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #else - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_memoryview_type->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) - #endif - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; - #if CYTHON_USE_TYPE_SPECS - __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #else - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_memoryviewslice_type->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) - #endif - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_core(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_core}, - {0, NULL} -}; -#endif - -#ifdef __cplusplus -namespace { - struct PyModuleDef __pyx_moduledef = - #else - static struct PyModuleDef __pyx_moduledef = - #endif - { - PyModuleDef_HEAD_INIT, - "core", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #elif CYTHON_USE_MODULE_STATE - sizeof(__pyx_mstate), /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - #if CYTHON_USE_MODULE_STATE - __pyx_m_traverse, /* m_traverse */ - __pyx_m_clear, /* m_clear */ - NULL /* m_free */ - #else - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ - #endif - }; - #ifdef __cplusplus -} /* anonymous namespace */ -#endif -#endif - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initcore(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initcore(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_core(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_core(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) -#else -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) -#endif -{ - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { -#if CYTHON_COMPILING_IN_LIMITED_API - result = PyModule_AddObject(module, to_name, value); -#else - result = PyDict_SetItemString(moddict, to_name, value); -#endif - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - CYTHON_UNUSED_VAR(def); - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - moddict = module; -#else - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; -#endif - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_core(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - int stringtab_initialized = 0; - #if CYTHON_USE_MODULE_STATE - int pystate_addmodule_run = 0; - #endif - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - static PyThread_type_lock __pyx_t_8[8]; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'core' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("core", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #elif CYTHON_USE_MODULE_STATE - __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - { - int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to core pseudovariable */ - if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - pystate_addmodule_run = 1; - } - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #endif - CYTHON_UNUSED_VAR(__pyx_t_1); - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_core(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_monotonic_align__core) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "monotonic_align.core")) { - if (unlikely((PyDict_SetItemString(modules, "monotonic_align.core", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "View.MemoryView":99 - * - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: # <<<<<<<<<<<<<< - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "View.MemoryView":100 - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: - * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__11, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - - /* "View.MemoryView":101 - * try: - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_collections_abc_Sequence); - __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":100 - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: - * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":103 - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< - * except: - * - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_collections_abc_Sequence); - __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - } - __pyx_L8:; - - /* "View.MemoryView":99 - * - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: # <<<<<<<<<<<<<< - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7_try_end; - __pyx_L2_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "View.MemoryView":104 - * else: - * __pyx_collections_abc_Sequence = __import__("collections").Sequence - * except: # <<<<<<<<<<<<<< - * - * __pyx_collections_abc_Sequence = None - */ - /*except:*/ { - __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_7); - - /* "View.MemoryView":106 - * except: - * - * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF(Py_None); - __Pyx_XGOTREF(__pyx_collections_abc_Sequence); - __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L3_exception_handled; - } - - /* "View.MemoryView":99 - * - * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" - * try: # <<<<<<<<<<<<<< - * if __import__("sys").version_info >= (3, 3): - * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence - */ - __pyx_L4_except_error:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L3_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_L7_try_end:; - } - - /* "View.MemoryView":241 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_1); - /*try:*/ { - - /* "View.MemoryView":242 - * - * try: - * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< - * index = __pyx_collections_abc_Sequence.index - * except: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_array_type); - - /* "View.MemoryView":243 - * try: - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< - * except: - * pass - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_array_type); - - /* "View.MemoryView":241 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L16_try_end; - __pyx_L11_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":244 - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - * except: # <<<<<<<<<<<<<< - * pass - * - */ - /*except:*/ { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L12_exception_handled; - } - __pyx_L12_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); - __pyx_L16_try_end:; - } - - /* "View.MemoryView":309 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":310 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":311 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":314 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":315 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":323 - * - * - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; - - /* "View.MemoryView":324 - * - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), - */ - __pyx_t_8[0] = PyThread_allocate_lock(); - __pyx_t_8[1] = PyThread_allocate_lock(); - __pyx_t_8[2] = PyThread_allocate_lock(); - __pyx_t_8[3] = PyThread_allocate_lock(); - __pyx_t_8[4] = PyThread_allocate_lock(); - __pyx_t_8[5] = PyThread_allocate_lock(); - __pyx_t_8[6] = PyThread_allocate_lock(); - __pyx_t_8[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - - /* "View.MemoryView":982 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "View.MemoryView":983 - * - * try: - * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< - * index = __pyx_collections_abc_Sequence.index - * except: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "View.MemoryView":984 - * try: - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< - * except: - * pass - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "View.MemoryView":982 - * - * - * try: # <<<<<<<<<<<<<< - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L22_try_end; - __pyx_L17_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":985 - * count = __pyx_collections_abc_Sequence.count - * index = __pyx_collections_abc_Sequence.index - * except: # <<<<<<<<<<<<<< - * pass - * - */ - /*except:*/ { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L18_exception_handled; - } - __pyx_L18_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_L22_try_end:; - } - - /* "View.MemoryView":988 - * pass - * - * try: # <<<<<<<<<<<<<< - * if __pyx_collections_abc_Sequence: - * - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_1); - /*try:*/ { - - /* "View.MemoryView":989 - * - * try: - * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) - if (__pyx_t_6) { - - /* "View.MemoryView":993 - * - * - * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< - * __pyx_collections_abc_Sequence.register(array) - * except: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":994 - * - * __pyx_collections_abc_Sequence.register(_memoryviewslice) - * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< - * except: - * pass # ignore failure, it's a minor issue - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":989 - * - * try: - * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":988 - * pass - * - * try: # <<<<<<<<<<<<<< - * if __pyx_collections_abc_Sequence: - * - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L28_try_end; - __pyx_L23_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":995 - * __pyx_collections_abc_Sequence.register(_memoryviewslice) - * __pyx_collections_abc_Sequence.register(array) - * except: # <<<<<<<<<<<<<< - * pass # ignore failure, it's a minor issue - * - */ - /*except:*/ { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L24_exception_handled; - } - __pyx_L24_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); - __pyx_L28_try_end:; - } - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "monotonic_align/core.pyx":7 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< - * cdef int x - * cdef int y - */ - __pyx_k__9 = (-1e9); - - /* "monotonic_align/core.pyx":38 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil: # <<<<<<<<<<<<<< - * cdef int b = paths.shape[0] - * cdef int i - */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_15monotonic_align_4core_1maximum_path_c, 0, __pyx_n_s_maximum_path_c, NULL, __pyx_n_s_monotonic_align_core, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_maximum_path_c, __pyx_t_7) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "monotonic_align/core.pyx":1 - * cimport cython # <<<<<<<<<<<<<< - * from cython.parallel import prange - * - */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init monotonic_align.core", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - #if !CYTHON_USE_MODULE_STATE - Py_CLEAR(__pyx_m); - #else - Py_DECREF(__pyx_m); - if (pystate_addmodule_run) { - PyObject *tp, *value, *tb; - PyErr_Fetch(&tp, &value, &tb); - PyState_RemoveModule(&__pyx_moduledef); - PyErr_Restore(tp, value, tb); - } - #endif - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init monotonic_align.core"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} -/* #### Code section: cleanup_globals ### */ -/* #### Code section: cleanup_module ### */ -/* #### Code section: main_method ### */ -/* #### Code section: utility_code_pragmas ### */ -#ifdef _MSC_VER -#pragma warning( push ) -/* Warning 4127: conditional expression is constant - * Cython uses constant conditional expressions to allow in inline functions to be optimized at - * compile-time, so this warning is not useful - */ -#pragma warning( disable : 4127 ) -#endif - - - -/* #### Code section: utility_code_def ### */ - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); - } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif - } -#else - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#endif -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -} - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* TupleAndListFromArray */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { - PyObject *v; - Py_ssize_t i; - for (i = 0; i < length; i++) { - v = dest[i] = src[i]; - Py_INCREF(v); - } -} -static CYTHON_INLINE PyObject * -__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - Py_INCREF(__pyx_empty_tuple); - return __pyx_empty_tuple; - } - res = PyTuple_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); - return res; -} -static CYTHON_INLINE PyObject * -__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) -{ - PyObject *res; - if (n <= 0) { - return PyList_New(0); - } - res = PyList_New(n); - if (unlikely(res == NULL)) return NULL; - __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); - return res; -} -#endif - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* fastcall */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) -{ - Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); - for (i = 0; i < n; i++) - { - if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; - } - for (i = 0; i < n; i++) - { - int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); - if (unlikely(eq != 0)) { - if (unlikely(eq < 0)) return NULL; // error - return kwvalues[i]; - } - } - return NULL; // not found (no exception set) -} -#endif - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); - while (1) { - if (kwds_is_tuple) { - if (pos >= PyTuple_GET_SIZE(kwds)) break; - key = PyTuple_GET_ITEM(kwds, pos); - value = kwvalues[pos]; - pos++; - } - else - { - if (!PyDict_Next(kwds, &pos, &key, &value)) break; - } - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = ( - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key) - ); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - __Pyx_TypeName type_name; - __Pyx_TypeName obj_type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - type_name = __Pyx_PyType_GetName(type); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME - ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); - __Pyx_DECREF_TypeName(type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - __Pyx_PyThreadState_declare - CYTHON_UNUSED_VAR(cause); - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { - #if PY_VERSION_HEX >= 0x030C00A6 - PyException_SetTraceback(value, tb); - #elif CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectFastCall */ -static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { - PyObject *argstuple; - PyObject *result; - size_t i; - argstuple = PyTuple_New((Py_ssize_t)nargs); - if (unlikely(!argstuple)) return NULL; - for (i = 0; i < nargs; i++) { - Py_INCREF(args[i]); - PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); - } - result = __Pyx_PyObject_Call(func, argstuple, kwargs); - Py_DECREF(argstuple); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { - Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); -#if CYTHON_COMPILING_IN_CPYTHON - if (nargs == 0 && kwargs == NULL) { -#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) - if (__Pyx_IsCyOrPyCFunction(func)) -#else - if (PyCFunction_Check(func)) -#endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - } - else if (nargs == 1 && kwargs == NULL) { - if (PyCFunction_Check(func)) - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, args[0]); - } - } - } -#endif - #if PY_VERSION_HEX < 0x030800B1 - #if CYTHON_FAST_PYCCALL - if (PyCFunction_Check(func)) { - if (kwargs) { - return _PyCFunction_FastCallDict(func, args, nargs, kwargs); - } else { - return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); - } - } - #if PY_VERSION_HEX >= 0x030700A1 - if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { - return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); - } - #endif - #endif - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); - } - #endif - #endif - #if CYTHON_VECTORCALL - vectorcallfunc f = _PyVectorcall_Function(func); - if (f) { - return f(func, args, (size_t)nargs, kwargs); - } - #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL - if (__Pyx_CyFunction_CheckExact(func)) { - __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); - if (f) return f(func, args, (size_t)nargs, kwargs); - } - #endif - if (nargs == 0) { - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); - } - return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); -} - -/* RaiseUnexpectedTypeError */ -static int -__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) -{ - __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, - expected, obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* CIntToDigits */ -static const char DIGIT_PAIRS_10[2*10*10+1] = { - "00010203040506070809" - "10111213141516171819" - "20212223242526272829" - "30313233343536373839" - "40414243444546474849" - "50515253545556575859" - "60616263646566676869" - "70717273747576777879" - "80818283848586878889" - "90919293949596979899" -}; -static const char DIGIT_PAIRS_8[2*8*8+1] = { - "0001020304050607" - "1011121314151617" - "2021222324252627" - "3031323334353637" - "4041424344454647" - "5051525354555657" - "6061626364656667" - "7071727374757677" -}; -static const char DIGITS_HEX[2*16+1] = { - "0123456789abcdef" - "0123456789ABCDEF" -}; - -/* BuildPyUnicode */ -static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, - int prepend_sign, char padding_char) { - PyObject *uval; - Py_ssize_t uoffset = ulength - clength; -#if CYTHON_USE_UNICODE_INTERNALS - Py_ssize_t i; -#if CYTHON_PEP393_ENABLED - void *udata; - uval = PyUnicode_New(ulength, 127); - if (unlikely(!uval)) return NULL; - udata = PyUnicode_DATA(uval); -#else - Py_UNICODE *udata; - uval = PyUnicode_FromUnicode(NULL, ulength); - if (unlikely(!uval)) return NULL; - udata = PyUnicode_AS_UNICODE(uval); -#endif - if (uoffset > 0) { - i = 0; - if (prepend_sign) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); - i++; - } - for (; i < uoffset; i++) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); - } - } - for (i=0; i < clength; i++) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); - } -#else - { - PyObject *sign = NULL, *padding = NULL; - uval = NULL; - if (uoffset > 0) { - prepend_sign = !!prepend_sign; - if (uoffset > prepend_sign) { - padding = PyUnicode_FromOrdinal(padding_char); - if (likely(padding) && uoffset > prepend_sign + 1) { - PyObject *tmp; - PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); - if (unlikely(!repeat)) goto done_or_error; - tmp = PyNumber_Multiply(padding, repeat); - Py_DECREF(repeat); - Py_DECREF(padding); - padding = tmp; - } - if (unlikely(!padding)) goto done_or_error; - } - if (prepend_sign) { - sign = PyUnicode_FromOrdinal('-'); - if (unlikely(!sign)) goto done_or_error; - } - } - uval = PyUnicode_DecodeASCII(chars, clength, NULL); - if (likely(uval) && padding) { - PyObject *tmp = PyNumber_Add(padding, uval); - Py_DECREF(uval); - uval = tmp; - } - if (likely(uval) && sign) { - PyObject *tmp = PyNumber_Add(sign, uval); - Py_DECREF(uval); - uval = tmp; - } -done_or_error: - Py_XDECREF(padding); - Py_XDECREF(sign); - } -#endif - return uval; -} - -/* CIntToPyUnicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { - char digits[sizeof(int)*3+2]; - char *dpos, *end = digits + sizeof(int)*3+2; - const char *hex_digits = DIGITS_HEX; - Py_ssize_t length, ulength; - int prepend_sign, last_one_off; - int remaining; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (format_char == 'X') { - hex_digits += 16; - format_char = 'x'; - } - remaining = value; - last_one_off = 0; - dpos = end; - do { - int digit_pos; - switch (format_char) { - case 'o': - digit_pos = abs((int)(remaining % (8*8))); - remaining = (int) (remaining / (8*8)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); - last_one_off = (digit_pos < 8); - break; - case 'd': - digit_pos = abs((int)(remaining % (10*10))); - remaining = (int) (remaining / (10*10)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); - last_one_off = (digit_pos < 10); - break; - case 'x': - *(--dpos) = hex_digits[abs((int)(remaining % 16))]; - remaining = (int) (remaining / 16); - break; - default: - assert(0); - break; - } - } while (unlikely(remaining != 0)); - assert(!last_one_off || *dpos == '0'); - dpos += last_one_off; - length = end - dpos; - ulength = length; - prepend_sign = 0; - if (!is_unsigned && value <= neg_one) { - if (padding_char == ' ' || width <= length + 1) { - *(--dpos) = '-'; - ++length; - } else { - prepend_sign = 1; - } - ++ulength; - } - if (width > ulength) { - ulength = width; - } - if (ulength == 1) { - return PyUnicode_FromOrdinal(*dpos); - } - return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); -} - -/* CIntToPyUnicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { - char digits[sizeof(Py_ssize_t)*3+2]; - char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; - const char *hex_digits = DIGITS_HEX; - Py_ssize_t length, ulength; - int prepend_sign, last_one_off; - Py_ssize_t remaining; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (format_char == 'X') { - hex_digits += 16; - format_char = 'x'; - } - remaining = value; - last_one_off = 0; - dpos = end; - do { - int digit_pos; - switch (format_char) { - case 'o': - digit_pos = abs((int)(remaining % (8*8))); - remaining = (Py_ssize_t) (remaining / (8*8)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); - last_one_off = (digit_pos < 8); - break; - case 'd': - digit_pos = abs((int)(remaining % (10*10))); - remaining = (Py_ssize_t) (remaining / (10*10)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); - last_one_off = (digit_pos < 10); - break; - case 'x': - *(--dpos) = hex_digits[abs((int)(remaining % 16))]; - remaining = (Py_ssize_t) (remaining / 16); - break; - default: - assert(0); - break; - } - } while (unlikely(remaining != 0)); - assert(!last_one_off || *dpos == '0'); - dpos += last_one_off; - length = end - dpos; - ulength = length; - prepend_sign = 0; - if (!is_unsigned && value <= neg_one) { - if (padding_char == ' ' || width <= length + 1) { - *(--dpos) = '-'; - ++length; - } else { - prepend_sign = 1; - } - ++ulength; - } - if (width > ulength) { - ulength = width; - } - if (ulength == 1) { - return PyUnicode_FromOrdinal(*dpos); - } - return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); -} - -/* JoinPyUnicode */ -static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, - Py_UCS4 max_char) { -#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - PyObject *result_uval; - int result_ukind, kind_shift; - Py_ssize_t i, char_pos; - void *result_udata; - CYTHON_MAYBE_UNUSED_VAR(max_char); -#if CYTHON_PEP393_ENABLED - result_uval = PyUnicode_New(result_ulength, max_char); - if (unlikely(!result_uval)) return NULL; - result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; - kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; - result_udata = PyUnicode_DATA(result_uval); -#else - result_uval = PyUnicode_FromUnicode(NULL, result_ulength); - if (unlikely(!result_uval)) return NULL; - result_ukind = sizeof(Py_UNICODE); - kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; - result_udata = PyUnicode_AS_UNICODE(result_uval); -#endif - assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); - char_pos = 0; - for (i=0; i < value_count; i++) { - int ukind; - Py_ssize_t ulength; - void *udata; - PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); - if (unlikely(__Pyx_PyUnicode_READY(uval))) - goto bad; - ulength = __Pyx_PyUnicode_GET_LENGTH(uval); - if (unlikely(!ulength)) - continue; - if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) - goto overflow; - ukind = __Pyx_PyUnicode_KIND(uval); - udata = __Pyx_PyUnicode_DATA(uval); - if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { - memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); - } else { - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) - _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); - #else - Py_ssize_t j; - for (j=0; j < ulength; j++) { - Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); - __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); - } - #endif - } - char_pos += ulength; - } - return result_uval; -overflow: - PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); -bad: - Py_DECREF(result_uval); - return NULL; -#else - CYTHON_UNUSED_VAR(max_char); - CYTHON_UNUSED_VAR(result_ulength); - CYTHON_UNUSED_VAR(value_count); - return PyUnicode_Join(__pyx_empty_unicode, value_tuple); -#endif -} - -/* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); -} - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (unlikely(!j)) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; - PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; - if (mm && mm->mp_subscript) { - PyObject *r, *key = PyInt_FromSsize_t(i); - if (unlikely(!key)) return NULL; - r = mm->mp_subscript(o, key); - Py_DECREF(key); - return r; - } - if (likely(sm && sm->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { - Py_ssize_t l = sm->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return sm->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* PyObjectCallOneArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *args[2] = {NULL, arg}; - return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, - "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); - __Pyx_DECREF_TypeName(index_type_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { - __Pyx_TypeName obj_type_name; - if (likely(PyType_Check(obj))) { - PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); - if (meth) { - PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); - Py_DECREF(meth); - return result; - } - } - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { - PyTypeObject *tp = Py_TYPE(obj); - PyMappingMethods *mm = tp->tp_as_mapping; - PySequenceMethods *sm = tp->tp_as_sequence; - if (likely(mm && mm->mp_subscript)) { - return mm->mp_subscript(obj, key); - } - if (likely(sm && sm->sq_item)) { - return __Pyx_PyObject_GetIndex(obj, key); - } - return __Pyx_PyObject_GetItem_Slow(obj, key); -} -#endif - -/* KeywordStringCheck */ -static int __Pyx_CheckKeywordStrings( - PyObject *kw, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { - if (unlikely(PyTuple_GET_SIZE(kw) == 0)) - return 1; - if (!kw_allowed) { - key = PyTuple_GET_ITEM(kw, 0); - goto invalid_keyword; - } -#if PY_VERSION_HEX < 0x03090000 - for (pos = 0; pos < PyTuple_GET_SIZE(kw); pos++) { - key = PyTuple_GET_ITEM(kw, pos); - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } -#endif - return 1; - } - while (PyDict_Next(kw, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if (!kw_allowed && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* DivInt[Py_ssize_t] */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* GetAttr3 */ -static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r; -#if CYTHON_USE_TYPE_SLOTS - if (likely(PyString_Check(n))) { - r = __Pyx_PyObject_GetAttrStrNoError(o, n); - if (unlikely(!r) && likely(!PyErr_Occurred())) { - r = __Pyx_NewRef(d); - } - return r; - } -#endif - r = PyObject_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#elif CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(!__pyx_m)) { - return NULL; - } - result = PyObject_GetAttr(__pyx_m, name); - if (likely(result)) { - return result; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* RaiseTooManyValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* ExtTypeTest */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - __Pyx_TypeName obj_type_name; - __Pyx_TypeName type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - type_name = __Pyx_PyType_GetName(type); - PyErr_Format(PyExc_TypeError, - "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, - obj_type_name, type_name); - __Pyx_DECREF_TypeName(obj_type_name); - __Pyx_DECREF_TypeName(type_name); - return 0; -} - -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - PyObject *exc_value = exc_info->exc_value; - if (exc_value == NULL || exc_value == Py_None) { - *value = NULL; - *type = NULL; - *tb = NULL; - } else { - *value = exc_value; - Py_INCREF(*value); - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - *tb = PyException_GetTraceback(exc_value); - } - #elif CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #endif -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = tstate->exc_info; - PyObject *tmp_value = exc_info->exc_value; - exc_info->exc_value = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); - #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - #endif -} -#endif - -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type = NULL, *local_value, *local_tb = NULL; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030C00A6 - local_value = tstate->current_exception; - tstate->current_exception = 0; - if (likely(local_value)) { - local_type = (PyObject*) Py_TYPE(local_value); - Py_INCREF(local_type); - local_tb = PyException_GetTraceback(local_value); - } - #else - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - #endif -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 - if (unlikely(tstate->current_exception)) -#elif CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - #if PY_VERSION_HEX >= 0x030B00a4 - tmp_value = exc_info->exc_value; - exc_info->exc_value = local_value; - tmp_type = NULL; - tmp_tb = NULL; - Py_XDECREF(local_type); - Py_XDECREF(local_tb); - #else - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - #endif - } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* SwapException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_value = exc_info->exc_value; - exc_info->exc_value = *value; - if (tmp_value == NULL || tmp_value == Py_None) { - Py_XDECREF(tmp_value); - tmp_value = NULL; - tmp_type = NULL; - tmp_tb = NULL; - } else { - tmp_type = (PyObject*) Py_TYPE(tmp_value); - Py_INCREF(tmp_type); - #if CYTHON_COMPILING_IN_CPYTHON - tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; - Py_XINCREF(tmp_tb); - #else - tmp_tb = PyException_GetTraceback(tmp_value); - #endif - } - #elif CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *module = 0; - PyObject *empty_dict = 0; - PyObject *empty_list = 0; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (unlikely(!py_import)) - goto bad; - if (!from_list) { - empty_list = PyList_New(0); - if (unlikely(!empty_list)) - goto bad; - from_list = empty_list; - } - #endif - empty_dict = PyDict_New(); - if (unlikely(!empty_dict)) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - #if CYTHON_COMPILING_IN_LIMITED_API - module = PyImport_ImportModuleLevelObject( - name, empty_dict, empty_dict, from_list, 1); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, 1); - #endif - if (unlikely(!module)) { - if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (unlikely(!py_level)) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - #if CYTHON_COMPILING_IN_LIMITED_API - module = PyImport_ImportModuleLevelObject( - name, empty_dict, empty_dict, from_list, level); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, level); - #endif - #endif - } - } -bad: - Py_XDECREF(empty_dict); - Py_XDECREF(empty_list); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - return module; -} - -/* ImportDottedModule */ -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { - PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; - if (unlikely(PyErr_Occurred())) { - PyErr_Clear(); - } - if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { - partial_name = name; - } else { - slice = PySequence_GetSlice(parts_tuple, 0, count); - if (unlikely(!slice)) - goto bad; - sep = PyUnicode_FromStringAndSize(".", 1); - if (unlikely(!sep)) - goto bad; - partial_name = PyUnicode_Join(sep, slice); - } - PyErr_Format( -#if PY_MAJOR_VERSION < 3 - PyExc_ImportError, - "No module named '%s'", PyString_AS_STRING(partial_name)); -#else -#if PY_VERSION_HEX >= 0x030600B1 - PyExc_ModuleNotFoundError, -#else - PyExc_ImportError, -#endif - "No module named '%U'", partial_name); -#endif -bad: - Py_XDECREF(sep); - Py_XDECREF(slice); - Py_XDECREF(partial_name); - return NULL; -} -#endif -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { - PyObject *imported_module; -#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) - PyObject *modules = PyImport_GetModuleDict(); - if (unlikely(!modules)) - return NULL; - imported_module = __Pyx_PyDict_GetItemStr(modules, name); - Py_XINCREF(imported_module); -#else - imported_module = PyImport_GetModule(name); -#endif - return imported_module; -} -#endif -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { - Py_ssize_t i, nparts; - nparts = PyTuple_GET_SIZE(parts_tuple); - for (i=1; i < nparts && module; i++) { - PyObject *part, *submodule; -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - part = PyTuple_GET_ITEM(parts_tuple, i); -#else - part = PySequence_ITEM(parts_tuple, i); -#endif - submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); -#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(part); -#endif - Py_DECREF(module); - module = submodule; - } - if (unlikely(!module)) { - return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); - } - return module; -} -#endif -static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { -#if PY_MAJOR_VERSION < 3 - PyObject *module, *from_list, *star = __pyx_n_s__3; - CYTHON_UNUSED_VAR(parts_tuple); - from_list = PyList_New(1); - if (unlikely(!from_list)) - return NULL; - Py_INCREF(star); - PyList_SET_ITEM(from_list, 0, star); - module = __Pyx_Import(name, from_list, 0); - Py_DECREF(from_list); - return module; -#else - PyObject *imported_module; - PyObject *module = __Pyx_Import(name, NULL, 0); - if (!parts_tuple || unlikely(!module)) - return module; - imported_module = __Pyx__ImportDottedModule_Lookup(name); - if (likely(imported_module)) { - Py_DECREF(module); - return imported_module; - } - PyErr_Clear(); - return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); -#endif -} -static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 - PyObject *module = __Pyx__ImportDottedModule_Lookup(name); - if (likely(module)) { - PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); - if (likely(spec)) { - PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); - if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { - Py_DECREF(spec); - spec = NULL; - } - Py_XDECREF(unsafe); - } - if (likely(!spec)) { - PyErr_Clear(); - return module; - } - Py_DECREF(spec); - Py_DECREF(module); - } else if (PyErr_Occurred()) { - PyErr_Clear(); - } -#endif - return __Pyx__ImportDottedModule(name, parts_tuple); -} - -/* ssize_strlen */ -static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { - size_t len = strlen(s); - if (unlikely(len > PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, "byte string is too long"); - return -1; - } - return (Py_ssize_t) len; -} - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (cls == a || cls == b) return 1; - mro = cls->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - PyObject *base = PyTuple_GET_ITEM(mro, i); - if (base == (PyObject *)a || base == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { - return type->tp_as_sequence->sq_repeat(seq, mul); - } else -#endif - { - return __Pyx_PySequence_Multiply_Generic(seq, mul); - } -} - -/* SetItemInt */ -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (unlikely(!j)) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; - PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; - if (mm && mm->mp_ass_subscript) { - int r; - PyObject *key = PyInt_FromSsize_t(i); - if (unlikely(!key)) return -1; - r = mm->mp_ass_subscript(o, key, v); - Py_DECREF(key); - return r; - } - if (likely(sm && sm->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { - Py_ssize_t l = sm->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return sm->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) -#else - if (is_list || PySequence_Check(o)) -#endif - { - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -/* RaiseUnboundLocalError */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* DivInt[long] */ -static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - const char* module_name_str = 0; - PyObject* module_name = 0; - PyObject* module_dot = 0; - PyObject* full_name = 0; - PyErr_Clear(); - module_name_str = PyModule_GetName(module); - if (unlikely(!module_name_str)) { goto modbad; } - module_name = PyUnicode_FromString(module_name_str); - if (unlikely(!module_name)) { goto modbad; } - module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); - if (unlikely(!module_dot)) { goto modbad; } - full_name = PyUnicode_Concat(module_dot, name); - if (unlikely(!full_name)) { goto modbad; } - #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) - { - PyObject *modules = PyImport_GetModuleDict(); - if (unlikely(!modules)) - goto modbad; - value = PyObject_GetItem(modules, full_name); - } - #else - value = PyImport_GetModule(full_name); - #endif - modbad: - Py_XDECREF(full_name); - Py_XDECREF(module_dot); - Py_XDECREF(module_name); - } - if (unlikely(!value)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* HasAttr */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (!r) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; - } -} - -/* ErrOccurredWithGIL */ -static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { - int err; - #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); - #endif - err = !!PyErr_Occurred(); - #ifdef WITH_THREAD - PyGILState_Release(_save); - #endif - return err; -} - -/* PyObject_GenericGetAttrNoDict */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, attr_name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(attr_name)); -#endif - __Pyx_DECREF_TypeName(type_name); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; - } - } - return descr; -} -#endif - -/* PyObject_GenericGetAttr */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); - } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); -} -#endif - -/* FixUpExtensionType */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { -#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - CYTHON_UNUSED_VAR(spec); - CYTHON_UNUSED_VAR(type); -#else - const PyType_Slot *slot = spec->slots; - while (slot && slot->slot && slot->slot != Py_tp_members) - slot++; - if (slot && slot->slot == Py_tp_members) { - int changed = 0; -#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) - const -#endif - PyMemberDef *memb = (PyMemberDef*) slot->pfunc; - while (memb && memb->name) { - if (memb->name[0] == '_' && memb->name[1] == '_') { -#if PY_VERSION_HEX < 0x030900b1 - if (strcmp(memb->name, "__weaklistoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_weaklistoffset = memb->offset; - changed = 1; - } - else if (strcmp(memb->name, "__dictoffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); - type->tp_dictoffset = memb->offset; - changed = 1; - } -#if CYTHON_METH_FASTCALL - else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { - assert(memb->type == T_PYSSIZET); - assert(memb->flags == READONLY); -#if PY_VERSION_HEX >= 0x030800b4 - type->tp_vectorcall_offset = memb->offset; -#else - type->tp_print = (printfunc) memb->offset; -#endif - changed = 1; - } -#endif -#else - if ((0)); -#endif -#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON - else if (strcmp(memb->name, "__module__") == 0) { - PyObject *descr; - assert(memb->type == T_OBJECT); - assert(memb->flags == 0 || memb->flags == READONLY); - descr = PyDescr_NewMember(type, memb); - if (unlikely(!descr)) - return -1; - if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { - Py_DECREF(descr); - return -1; - } - Py_DECREF(descr); - changed = 1; - } -#endif - } - memb++; - } - if (changed) - PyType_Modified(type); - } -#endif - return 0; -} -#endif - -/* PyObjectCallNoArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { - PyObject *arg = NULL; - return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - -/* PyObjectGetMethod */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { - PyObject *attr; -#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP - __Pyx_TypeName type_name; - PyTypeObject *tp = Py_TYPE(obj); - PyObject *descr; - descrgetfunc f = NULL; - PyObject **dictptr, *dict; - int meth_found = 0; - assert (*method == NULL); - if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; - } - if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { - return 0; - } - descr = _PyType_Lookup(tp, name); - if (likely(descr != NULL)) { - Py_INCREF(descr); -#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR - if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) -#elif PY_MAJOR_VERSION >= 3 - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) - #endif -#else - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr))) - #endif -#endif - { - meth_found = 1; - } else { - f = Py_TYPE(descr)->tp_descr_get; - if (f != NULL && PyDescr_IsData(descr)) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - } - } - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr != NULL && (dict = *dictptr) != NULL) { - Py_INCREF(dict); - attr = __Pyx_PyDict_GetItemStr(dict, name); - if (attr != NULL) { - Py_INCREF(attr); - Py_DECREF(dict); - Py_XDECREF(descr); - goto try_unpack; - } - Py_DECREF(dict); - } - if (meth_found) { - *method = descr; - return 1; - } - if (f != NULL) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - if (likely(descr != NULL)) { - *method = descr; - return 0; - } - type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(name)); -#endif - __Pyx_DECREF_TypeName(type_name); - return 0; -#else - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; -#endif -try_unpack: -#if CYTHON_UNPACK_METHODS - if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { - PyObject *function = PyMethod_GET_FUNCTION(attr); - Py_INCREF(function); - Py_DECREF(attr); - *method = function; - return 1; - } -#endif - *method = attr; - return 0; -} - -/* PyObjectCallMethod0 */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { - PyObject *method = NULL, *result = NULL; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_CallOneArg(method, obj); - Py_DECREF(method); - return result; - } - if (unlikely(!method)) goto bad; - result = __Pyx_PyObject_CallNoArg(method); - Py_DECREF(method); -bad: - return result; -} - -/* ValidateBasesTuple */ -#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS -static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { - Py_ssize_t i, n = PyTuple_GET_SIZE(bases); - for (i = 1; i < n; i++) - { - PyObject *b0 = PyTuple_GET_ITEM(bases, i); - PyTypeObject *b; -#if PY_MAJOR_VERSION < 3 - if (PyClass_Check(b0)) - { - PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", - PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); - return -1; - } -#endif - b = (PyTypeObject*) b0; - if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) - { - __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); - PyErr_Format(PyExc_TypeError, - "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); - __Pyx_DECREF_TypeName(b_name); - return -1; - } - if (dictoffset == 0 && b->tp_dictoffset) - { - __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); - PyErr_Format(PyExc_TypeError, - "extension type '%.200s' has no __dict__ slot, " - "but base type '" __Pyx_FMT_TYPENAME "' has: " - "either add 'cdef dict __dict__' to the extension type " - "or add '__slots__ = [...]' to the base type", - type_name, b_name); - __Pyx_DECREF_TypeName(b_name); - return -1; - } - } - return 0; -} -#endif - -/* PyType_Ready */ -static int __Pyx_PyType_Ready(PyTypeObject *t) { -#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) - (void)__Pyx_PyObject_CallMethod0; -#if CYTHON_USE_TYPE_SPECS - (void)__Pyx_validate_bases_tuple; -#endif - return PyType_Ready(t); -#else - int r; - PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); - if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) - return -1; -#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) - { - int gc_was_enabled; - #if PY_VERSION_HEX >= 0x030A00b1 - gc_was_enabled = PyGC_Disable(); - (void)__Pyx_PyObject_CallMethod0; - #else - PyObject *ret, *py_status; - PyObject *gc = NULL; - #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) - gc = PyImport_GetModule(__pyx_kp_u_gc); - #endif - if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); - if (unlikely(!gc)) return -1; - py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); - if (unlikely(!py_status)) { - Py_DECREF(gc); - return -1; - } - gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); - Py_DECREF(py_status); - if (gc_was_enabled > 0) { - ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); - if (unlikely(!ret)) { - Py_DECREF(gc); - return -1; - } - Py_DECREF(ret); - } else if (unlikely(gc_was_enabled == -1)) { - Py_DECREF(gc); - return -1; - } - #endif - t->tp_flags |= Py_TPFLAGS_HEAPTYPE; -#if PY_VERSION_HEX >= 0x030A0000 - t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; -#endif -#else - (void)__Pyx_PyObject_CallMethod0; -#endif - r = PyType_Ready(t); -#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) - t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; - #if PY_VERSION_HEX >= 0x030A00b1 - if (gc_was_enabled) - PyGC_Enable(); - #else - if (gc_was_enabled) { - PyObject *tp, *v, *tb; - PyErr_Fetch(&tp, &v, &tb); - ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); - if (likely(ret || r == -1)) { - Py_XDECREF(ret); - PyErr_Restore(tp, v, tb); - } else { - Py_XDECREF(tp); - Py_XDECREF(v); - Py_XDECREF(tb); - r = -1; - } - } - Py_DECREF(gc); - #endif - } -#endif - return r; -#endif -} - -/* SetVTable */ -static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { - PyObject *ob = PyCapsule_New(vtable, 0, 0); - if (unlikely(!ob)) - goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) -#else - if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) -#endif - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* GetVTable */ -static void* __Pyx_GetVtable(PyTypeObject *type) { - void* ptr; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); -#else - PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); -#endif - if (!ob) - goto bad; - ptr = PyCapsule_GetPointer(ob, 0); - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* MergeVTables */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_MergeVtables(PyTypeObject *type) { - int i; - void** base_vtables; - __Pyx_TypeName tp_base_name; - __Pyx_TypeName base_name; - void* unknown = (void*)-1; - PyObject* bases = type->tp_bases; - int base_depth = 0; - { - PyTypeObject* base = type->tp_base; - while (base) { - base_depth += 1; - base = base->tp_base; - } - } - base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); - base_vtables[0] = unknown; - for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { - void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); - if (base_vtable != NULL) { - int j; - PyTypeObject* base = type->tp_base; - for (j = 0; j < base_depth; j++) { - if (base_vtables[j] == unknown) { - base_vtables[j] = __Pyx_GetVtable(base); - base_vtables[j + 1] = unknown; - } - if (base_vtables[j] == base_vtable) { - break; - } else if (base_vtables[j] == NULL) { - goto bad; - } - base = base->tp_base; - } - } - } - PyErr_Clear(); - free(base_vtables); - return 0; -bad: - tp_base_name = __Pyx_PyType_GetName(type->tp_base); - base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); - PyErr_Format(PyExc_TypeError, - "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); - __Pyx_DECREF_TypeName(tp_base_name); - __Pyx_DECREF_TypeName(base_name); - free(base_vtables); - return -1; -} -#endif - -/* SetupReduce */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; -} -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); -#else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } -#endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); -#else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } -#endif - if (object_getstate != getstate) { - goto __PYX_GOOD; - } - } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; -#else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; -#endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); - } - } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) { - __Pyx_TypeName type_obj_name = - __Pyx_PyType_GetName((PyTypeObject*)type_obj); - PyErr_Format(PyExc_RuntimeError, - "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); - __Pyx_DECREF_TypeName(type_obj_name); - } - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); - Py_XDECREF(object_getstate); - Py_XDECREF(getstate); -#endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); - return ret; -} -#endif - -/* FetchSharedCythonModule */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void) { - PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); - if (unlikely(!abi_module)) return NULL; - Py_INCREF(abi_module); - return abi_module; -} - -/* FetchCommonType */ -static int __Pyx_VerifyCachedType(PyObject *cached_type, - const char *name, - Py_ssize_t basicsize, - Py_ssize_t expected_basicsize) { - if (!PyType_Check(cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", name); - return -1; - } - if (basicsize != expected_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - name); - return -1; - } - return 0; -} -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* abi_module; - const char* object_name; - PyTypeObject *cached_type = NULL; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - object_name = strrchr(type->tp_name, '.'); - object_name = object_name ? object_name+1 : type->tp_name; - cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - if (__Pyx_VerifyCachedType( - (PyObject *)cached_type, - object_name, - cached_type->tp_basicsize, - type->tp_basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; -done: - Py_DECREF(abi_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#else -static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { - PyObject *abi_module, *cached_type = NULL; - const char* object_name = strrchr(spec->name, '.'); - object_name = object_name ? object_name+1 : spec->name; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - cached_type = PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - Py_ssize_t basicsize; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *py_basicsize; - py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); - if (unlikely(!py_basicsize)) goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; -#else - basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; -#endif - if (__Pyx_VerifyCachedType( - cached_type, - object_name, - basicsize, - spec->basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - CYTHON_UNUSED_VAR(module); - cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); - if (unlikely(!cached_type)) goto bad; - if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; -done: - Py_DECREF(abi_module); - assert(cached_type == NULL || PyType_Check(cached_type)); - return (PyTypeObject *) cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#endif - -/* PyVectorcallFastCallDict */ -#if CYTHON_METH_FASTCALL -static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) -{ - PyObject *res = NULL; - PyObject *kwnames; - PyObject **newargs; - PyObject **kwvalues; - Py_ssize_t i, pos; - size_t j; - PyObject *key, *value; - unsigned long keys_are_strings; - Py_ssize_t nkw = PyDict_GET_SIZE(kw); - newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); - if (unlikely(newargs == NULL)) { - PyErr_NoMemory(); - return NULL; - } - for (j = 0; j < nargs; j++) newargs[j] = args[j]; - kwnames = PyTuple_New(nkw); - if (unlikely(kwnames == NULL)) { - PyMem_Free(newargs); - return NULL; - } - kwvalues = newargs + nargs; - pos = i = 0; - keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; - while (PyDict_Next(kw, &pos, &key, &value)) { - keys_are_strings &= Py_TYPE(key)->tp_flags; - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(kwnames, i, key); - kwvalues[i] = value; - i++; - } - if (unlikely(!keys_are_strings)) { - PyErr_SetString(PyExc_TypeError, "keywords must be strings"); - goto cleanup; - } - res = vc(func, newargs, nargs, kwnames); -cleanup: - Py_DECREF(kwnames); - for (i = 0; i < nkw; i++) - Py_DECREF(kwvalues[i]); - PyMem_Free(newargs); - return res; -} -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) -{ - if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { - return vc(func, args, nargs, NULL); - } - return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); -} -#endif - -/* CythonFunctionShared */ -static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { -#if PY_VERSION_HEX < 0x030900B1 - __Pyx_Py_XDECREF_SET( - __Pyx_CyFunction_GetClassObj(f), - ((classobj) ? __Pyx_NewRef(classobj) : NULL)); -#else - __Pyx_Py_XDECREF_SET( - ((PyCMethodObject *) (f))->mm_class, - (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); -#endif -} -static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) -{ - CYTHON_UNUSED_VAR(closure); - if (unlikely(op->func_doc == NULL)) { - if (((PyCFunctionObject*)op)->m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_doc, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_name, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_qualname, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_dict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(op); - CYTHON_UNUSED_VAR(context); - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - CYTHON_UNUSED_VAR(context); - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value) { - value = Py_None; - } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " - "currently affect the values used in function calls", 1); - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_tuple; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - if (op->defaults_getter) { - if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value) { - value = Py_None; - } else if (unlikely(value != Py_None && !PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " - "currently affect the values used in function calls", 1); - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_kwdict; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - if (op->defaults_getter) { - if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { - CYTHON_UNUSED_VAR(context); - if (!value || value == Py_None) { - value = NULL; - } else if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - __Pyx_Py_XDECREF_SET(op->func_annotations, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->func_annotations; - CYTHON_UNUSED_VAR(context); - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyObject * -__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { - int is_coroutine; - CYTHON_UNUSED_VAR(context); - if (op->func_is_coroutine) { - return __Pyx_NewRef(op->func_is_coroutine); - } - is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; -#if PY_VERSION_HEX >= 0x03050000 - if (is_coroutine) { - PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; - fromlist = PyList_New(1); - if (unlikely(!fromlist)) return NULL; - Py_INCREF(marker); - PyList_SET_ITEM(fromlist, 0, marker); - module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); - Py_DECREF(fromlist); - if (unlikely(!module)) goto ignore; - op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); - Py_DECREF(module); - if (likely(op->func_is_coroutine)) { - return __Pyx_NewRef(op->func_is_coroutine); - } -ignore: - PyErr_Clear(); - } -#endif - op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); - return __Pyx_NewRef(op->func_is_coroutine); -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, -#if CYTHON_USE_TYPE_SPECS - {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, -#if CYTHON_METH_FASTCALL -#if CYTHON_BACKPORT_VECTORCALL - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, -#else - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, -#endif -#endif -#if PY_VERSION_HEX < 0x030500A0 - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, -#else - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, -#endif -#endif - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) -{ - CYTHON_UNUSED_VAR(args); -#if PY_MAJOR_VERSION >= 3 - Py_INCREF(m->func_qualname); - return m->func_qualname; -#else - return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyCFunctionObject *cf = (PyCFunctionObject*) op; - if (unlikely(op == NULL)) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - cf->m_ml = ml; - cf->m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - cf->m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; -#if PY_VERSION_HEX < 0x030900B1 - op->func_classobj = NULL; -#else - ((PyCMethodObject*)op)->mm_class = NULL; -#endif - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults_size = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - op->func_is_coroutine = NULL; -#if CYTHON_METH_FASTCALL - switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { - case METH_NOARGS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; - break; - case METH_O: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; - break; - case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; - break; - case METH_FASTCALL | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; - break; - case METH_VARARGS | METH_KEYWORDS: - __Pyx_CyFunction_func_vectorcall(op) = NULL; - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - Py_DECREF(op); - return NULL; - } -#endif - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(((PyCFunctionObject*)m)->m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); -#if PY_VERSION_HEX < 0x030900B1 - Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); -#else - { - PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; - ((PyCMethodObject *) (m))->mm_class = NULL; - Py_XDECREF(cls); - } -#endif - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - Py_CLEAR(m->func_is_coroutine); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - __Pyx_PyHeapTypeObject_GC_Del(m); -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - __Pyx__CyFunction_dealloc(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(((PyCFunctionObject*)m)->m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - Py_VISIT(m->func_is_coroutine); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; -#if CYTHON_METH_FASTCALL - __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); - if (vc) { -#if CYTHON_ASSUME_SAFE_MACROS - return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); -#else - (void) &__Pyx_PyVectorcall_FastCallDict; - return PyVectorcall_Call(func, args, kw); -#endif - } -#endif - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); -#if PY_MAJOR_VERSION > 2 - PyErr_Format(PyExc_TypeError, - "unbound method %.200S() needs an argument", - cyfunc->func_qualname); -#else - PyErr_SetString(PyExc_TypeError, - "unbound method needs an argument"); -#endif - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) -{ - int ret = 0; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - if (unlikely(nargs < 1)) { - PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", - ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - ret = 1; - } - if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - return ret; -} -static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 0)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_meth(self, NULL); -} -static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 1)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_meth(self, args[0]); -} -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); -} -static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) -{ - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; - PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); -} -#endif -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_CyFunctionType_slots[] = { - {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, - {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, - {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, - {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, - {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, - {Py_tp_methods, (void *)__pyx_CyFunction_methods}, - {Py_tp_members, (void *)__pyx_CyFunction_members}, - {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, - {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, - {0, 0}, -}; -static PyType_Spec __pyx_CyFunctionType_spec = { - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - __pyx_CyFunctionType_slots -}; -#else -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, -#if !CYTHON_METH_FASTCALL - 0, -#elif CYTHON_BACKPORT_VECTORCALL - (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), -#else - offsetof(PyCFunctionObject, vectorcall), -#endif - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#ifdef _Py_TPFLAGS_HAVE_VECTORCALL - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_PyMethod_New, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, -#endif -#if __PYX_NEED_TP_PRINT_SLOT - 0, -#endif -#if PY_VERSION_HEX >= 0x030C0000 - 0, -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, -#endif -}; -#endif -static int __pyx_CyFunction_init(PyObject *module) { -#if CYTHON_USE_TYPE_SPECS - __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); -#else - CYTHON_UNUSED_VAR(module); - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); -#endif - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - m->defaults_size = size; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); - } - return op; -} - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - CYTHON_MAYBE_UNUSED_VAR(tstate); - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} -#endif - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - if (c_line) { - (void) __pyx_cfilenm; - (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); - } - _PyTraceback_Add(funcname, filename, py_line); -} -#else -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = NULL; - PyObject *py_funcname = NULL; - #if PY_MAJOR_VERSION < 3 - PyObject *py_srcfile = NULL; - py_srcfile = PyString_FromString(filename); - if (!py_srcfile) goto bad; - #endif - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - funcname = PyUnicode_AsUTF8(py_funcname); - if (!funcname) goto bad; - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - if (!py_funcname) goto bad; - #endif - } - #if PY_MAJOR_VERSION < 3 - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - #else - py_code = PyCode_NewEmpty(filename, funcname, py_line); - #endif - Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline - return py_code; -bad: - Py_XDECREF(py_funcname); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_srcfile); - #endif - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject *ptype, *pvalue, *ptraceback; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) { - /* If the code object creation fails, then we should clear the - fetched exception references and propagate the new exception */ - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - goto bad; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} -#endif - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - __Pyx_TypeName obj_type_name; - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); - if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); - if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", - obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return -1; -} -static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject *obj = view->obj; - if (!obj) return; - if (PyObject_CheckBuffer(obj)) { - PyBuffer_Release(view); - return; - } - if ((0)) {} - view->obj = NULL; - Py_DECREF(obj); -} -#endif - - -/* MemviewSliceIsContig */ -static int -__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) -{ - int i, index, step, start; - Py_ssize_t itemsize = mvs.memview->view.itemsize; - if (order == 'F') { - step = 1; - start = 0; - } else { - step = -1; - start = ndim - 1; - } - for (i = 0; i < ndim; i++) { - index = start + step * i; - if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) - return 0; - itemsize *= mvs.shape[index]; - } - return 1; -} - -/* OverlappingSlices */ -static void -__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, - void **out_start, void **out_end, - int ndim, size_t itemsize) -{ - char *start, *end; - int i; - start = end = slice->data; - for (i = 0; i < ndim; i++) { - Py_ssize_t stride = slice->strides[i]; - Py_ssize_t extent = slice->shape[i]; - if (extent == 0) { - *out_start = *out_end = start; - return; - } else { - if (stride > 0) - end += stride * (extent - 1); - else - start += stride * (extent - 1); - } - } - *out_start = start; - *out_end = end + itemsize; -} -static int -__pyx_slices_overlap(__Pyx_memviewslice *slice1, - __Pyx_memviewslice *slice2, - int ndim, size_t itemsize) -{ - void *start1, *end1, *start2, *end2; - __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); - __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); - return (start1 < end2) && (start2 < end1); -} - -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; -} - -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; - } - } - *ts = t; - return count; -} -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; -} -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); -} -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparsable format string"; - } -} -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; - } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { - CYTHON_UNUSED_VAR(is_complex); - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { - CYTHON_UNUSED_VAR(is_complex); - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } -} -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; - } - } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; - } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; - } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); - } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; - } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } - } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; -} -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) -{ - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; - } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; - } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; -} -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; - } - } - } -} - -/* TypeInfoCompare */ - static int -__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) -{ - int i; - if (!a || !b) - return 0; - if (a == b) - return 1; - if (a->size != b->size || a->typegroup != b->typegroup || - a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) { - if (a->typegroup == 'H' || b->typegroup == 'H') { - return a->size == b->size; - } else { - return 0; - } - } - if (a->ndim) { - for (i = 0; i < a->ndim; i++) - if (a->arraysize[i] != b->arraysize[i]) - return 0; - } - if (a->typegroup == 'S') { - if (a->flags != b->flags) - return 0; - if (a->fields || b->fields) { - if (!(a->fields && b->fields)) - return 0; - for (i = 0; a->fields[i].type && b->fields[i].type; i++) { - __Pyx_StructField *field_a = a->fields + i; - __Pyx_StructField *field_b = b->fields + i; - if (field_a->offset != field_b->offset || - !__pyx_typeinfo_cmp(field_a->type, field_b->type)) - return 0; - } - return !a->fields[i].type && !b->fields[i].type; - } - } - return 1; -} - -/* MemviewSliceValidateAndInit */ - static int -__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) -{ - if (buf->shape[dim] <= 1) - return 1; - if (buf->strides) { - if (spec & __Pyx_MEMVIEW_CONTIG) { - if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) { - if (unlikely(buf->strides[dim] != sizeof(void *))) { - PyErr_Format(PyExc_ValueError, - "Buffer is not indirectly contiguous " - "in dimension %d.", dim); - goto fail; - } - } else if (unlikely(buf->strides[dim] != buf->itemsize)) { - PyErr_SetString(PyExc_ValueError, - "Buffer and memoryview are not contiguous " - "in the same dimension."); - goto fail; - } - } - if (spec & __Pyx_MEMVIEW_FOLLOW) { - Py_ssize_t stride = buf->strides[dim]; - if (stride < 0) - stride = -stride; - if (unlikely(stride < buf->itemsize)) { - PyErr_SetString(PyExc_ValueError, - "Buffer and memoryview are not contiguous " - "in the same dimension."); - goto fail; - } - } - } else { - if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) { - PyErr_Format(PyExc_ValueError, - "C-contiguous buffer is not contiguous in " - "dimension %d", dim); - goto fail; - } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) { - PyErr_Format(PyExc_ValueError, - "C-contiguous buffer is not indirect in " - "dimension %d", dim); - goto fail; - } else if (unlikely(buf->suboffsets)) { - PyErr_SetString(PyExc_ValueError, - "Buffer exposes suboffsets but no strides"); - goto fail; - } - } - return 1; -fail: - return 0; -} -static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) -{ - CYTHON_UNUSED_VAR(ndim); - if (spec & __Pyx_MEMVIEW_DIRECT) { - if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { - PyErr_Format(PyExc_ValueError, - "Buffer not compatible with direct access " - "in dimension %d.", dim); - goto fail; - } - } - if (spec & __Pyx_MEMVIEW_PTR) { - if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) { - PyErr_Format(PyExc_ValueError, - "Buffer is not indirectly accessible " - "in dimension %d.", dim); - goto fail; - } - } - return 1; -fail: - return 0; -} -static int -__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) -{ - int i; - if (c_or_f_flag & __Pyx_IS_F_CONTIG) { - Py_ssize_t stride = 1; - for (i = 0; i < ndim; i++) { - if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { - PyErr_SetString(PyExc_ValueError, - "Buffer not fortran contiguous."); - goto fail; - } - stride = stride * buf->shape[i]; - } - } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) { - Py_ssize_t stride = 1; - for (i = ndim - 1; i >- 1; i--) { - if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { - PyErr_SetString(PyExc_ValueError, - "Buffer not C contiguous."); - goto fail; - } - stride = stride * buf->shape[i]; - } - } - return 1; -fail: - return 0; -} -static int __Pyx_ValidateAndInit_memviewslice( - int *axes_specs, - int c_or_f_flag, - int buf_flags, - int ndim, - __Pyx_TypeInfo *dtype, - __Pyx_BufFmt_StackElem stack[], - __Pyx_memviewslice *memviewslice, - PyObject *original_obj) -{ - struct __pyx_memoryview_obj *memview, *new_memview; - __Pyx_RefNannyDeclarations - Py_buffer *buf; - int i, spec = 0, retval = -1; - __Pyx_BufFmt_Context ctx; - int from_memoryview = __pyx_memoryview_check(original_obj); - __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0); - if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *) - original_obj)->typeinfo)) { - memview = (struct __pyx_memoryview_obj *) original_obj; - new_memview = NULL; - } else { - memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( - original_obj, buf_flags, 0, dtype); - new_memview = memview; - if (unlikely(!memview)) - goto fail; - } - buf = &memview->view; - if (unlikely(buf->ndim != ndim)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - ndim, buf->ndim); - goto fail; - } - if (new_memview) { - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail; - } - if (unlikely((unsigned) buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) " - "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)", - buf->itemsize, - (buf->itemsize > 1) ? "s" : "", - dtype->name, - dtype->size, - (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->len > 0) { - for (i = 0; i < ndim; i++) { - spec = axes_specs[i]; - if (unlikely(!__pyx_check_strides(buf, i, ndim, spec))) - goto fail; - if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec))) - goto fail; - } - if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))) - goto fail; - } - if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice, - new_memview != NULL) == -1)) { - goto fail; - } - retval = 0; - goto no_fail; -fail: - Py_XDECREF(new_memview); - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} - -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_int(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 3, - &__Pyx_TypeInfo_int, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 3, - &__Pyx_TypeInfo_float, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, - &__Pyx_TypeInfo_int, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice -__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, - const char *mode, int ndim, - size_t sizeof_dtype, int contig_flag, - int dtype_is_object) -{ - __Pyx_RefNannyDeclarations - int i; - __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } }; - struct __pyx_memoryview_obj *from_memview = from_mvs->memview; - Py_buffer *buf = &from_memview->view; - PyObject *shape_tuple = NULL; - PyObject *temp_int = NULL; - struct __pyx_array_obj *array_obj = NULL; - struct __pyx_memoryview_obj *memview_obj = NULL; - __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); - for (i = 0; i < ndim; i++) { - if (unlikely(from_mvs->suboffsets[i] >= 0)) { - PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " - "indirect dimensions (axis %d)", i); - goto fail; - } - } - shape_tuple = PyTuple_New(ndim); - if (unlikely(!shape_tuple)) { - goto fail; - } - __Pyx_GOTREF(shape_tuple); - for(i = 0; i < ndim; i++) { - temp_int = PyInt_FromSsize_t(from_mvs->shape[i]); - if(unlikely(!temp_int)) { - goto fail; - } else { - PyTuple_SET_ITEM(shape_tuple, i, temp_int); - temp_int = NULL; - } - } - array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL); - if (unlikely(!array_obj)) { - goto fail; - } - __Pyx_GOTREF(array_obj); - memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( - (PyObject *) array_obj, contig_flag, - dtype_is_object, - from_mvs->memview->typeinfo); - if (unlikely(!memview_obj)) - goto fail; - if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) - goto fail; - if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, - dtype_is_object) < 0)) - goto fail; - goto no_fail; -fail: - __Pyx_XDECREF(new_mvs.memview); - new_mvs.memview = NULL; - new_mvs.data = NULL; -no_fail: - __Pyx_XDECREF(shape_tuple); - __Pyx_XDECREF(temp_int); - __Pyx_XDECREF(array_obj); - __Pyx_RefNannyFinishContext(); - return new_mvs; -} - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; - } - } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; - } - } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - __pyx_nonatomic_int_type old_acquisition_count; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - return; - } - old_acquisition_count = __pyx_add_acquisition_count(memview); - if (unlikely(old_acquisition_count <= 0)) { - if (likely(old_acquisition_count == 0)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } else { - __pyx_fatalerror("Acquisition count is %d (line %d)", - old_acquisition_count+1, lineno); - } - } -} -static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - __pyx_nonatomic_int_type old_acquisition_count; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - old_acquisition_count = __pyx_sub_acquisition_count(memview); - memslice->data = NULL; - if (likely(old_acquisition_count > 1)) { - memslice->memview = NULL; - } else if (likely(old_acquisition_count == 1)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - __pyx_fatalerror("Acquisition count is %d (line %d)", - old_acquisition_count-1, lineno); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(int) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(int) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (int) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (int) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (int) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (int) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(long) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(long) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (long) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (long) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (long) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (long) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const char neg_one = (char) -1, const_zero = (char) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(char) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (char) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (char) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(char) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(char) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - char val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (char) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (char) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (char) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (char) -1; - } else { - stepval = __Pyx_NewRef(v); - } - val = (char) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((char) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((char) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - if (!is_unsigned) { - if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (char) -1; - } - } else { - char val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (char) -1; - val = __Pyx_PyInt_As_char(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to char"); - return (char) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to char"); - return (char) -1; -} - -/* FormatTypeName */ - #if CYTHON_COMPILING_IN_LIMITED_API -static __Pyx_TypeName -__Pyx_PyType_GetName(PyTypeObject* tp) -{ - PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_n_s_name_2); - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { - PyErr_Clear(); - Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__23)); - } - return name; -} -#endif - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[5]; - int same=1, i, found_dot; - const char* rt_from_call = Py_GetVersion(); - PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - found_dot = 0; - for (i = 0; i < 4; i++) { - if (!ctversion[i]) { - same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); - break; - } - if (rt_from_call[i] != ctversion[i]) { - same = 0; - break; - } - } - if (!same) { - char rtversion[5] = {'\0'}; - char message[200]; - for (i=0; i<4; ++i) { - if (rt_from_call[i] == '.') { - if (found_dot) break; - found_dot = 1; - } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { - break; - } - rtversion[i] = rt_from_call[i]; - } - PyOS_snprintf(message, sizeof(message), - "compile time version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* InitStrings */ - #if PY_MAJOR_VERSION >= 3 -static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { - if (t.is_unicode | t.is_str) { - if (t.intern) { - *str = PyUnicode_InternFromString(t.s); - } else if (t.encoding) { - *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); - } else { - *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); - } - } else { - *str = PyBytes_FromStringAndSize(t.s, t.n - 1); - } - if (!*str) - return -1; - if (PyObject_Hash(*str) == -1) - return -1; - return 0; -} -#endif -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION >= 3 - __Pyx_InitString(*t, t->p); - #else - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - #endif - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { - __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " - "The ability to return an instance of a strict subclass of int is deprecated, " - "and may be removed in a future version of Python.", - result_type_name)) { - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; - } - __Pyx_DECREF_TypeName(result_type_name); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", - type_name, type_name, result_type_name); - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(__Pyx_PyLong_IsCompact(b))) { - return __Pyx_PyLong_CompactValue(b); - } else { - const digit* digits = __Pyx_PyLong_Digits(b); - const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { - if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { - return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); -#if PY_MAJOR_VERSION < 3 - } else if (likely(PyInt_CheckExact(o))) { - return PyInt_AS_LONG(o); -#endif - } else { - Py_ssize_t ival; - PyObject *x; - x = PyNumber_Index(o); - if (!x) return -1; - ival = PyInt_AsLong(x); - Py_DECREF(x); - return ival; - } -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -/* #### Code section: utility_code_pragmas_end ### */ -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - - - -/* #### Code section: end ### */ -#endif /* Py_PYTHON_H */ diff --git a/spaces/doevent/prompt-generator/README.md b/spaces/doevent/prompt-generator/README.md deleted file mode 100644 index cf296c22505151c67ad0387e7c072d1e8585897d..0000000000000000000000000000000000000000 --- a/spaces/doevent/prompt-generator/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Midjourney Prompt Generator -emoji: 🌍 -colorFrom: pink -colorTo: gray -sdk: gradio -sdk_version: 3.28.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/dteam/chatgpt-dteam/bin_public/app/app.py b/spaces/dteam/chatgpt-dteam/bin_public/app/app.py deleted file mode 100644 index 4542b37a4fd8708378ce259ae369856c47b94152..0000000000000000000000000000000000000000 --- a/spaces/dteam/chatgpt-dteam/bin_public/app/app.py +++ /dev/null @@ -1,287 +0,0 @@ -# -*- coding:utf-8 -*- -import sys -from overwrites import * -from chat_func import * -from bin_public.utils.tools import * -from bin_public.utils.utils_db import * -from bin_public.config.presets import * - -my_api_key = "" - -# if we are running in Docker -if os.environ.get('dockerrun') == 'yes': - dockerflag = True -else: - dockerflag = False - -authflag = False - -if dockerflag: - my_api_key = os.environ.get('my_api_key') - if my_api_key == "empty": - print("Please give a api key!") - sys.exit(1) - # auth - username = os.environ.get('USERNAME') - password = os.environ.get('PASSWORD') - if not (isinstance(username, type(None)) or isinstance(password, type(None))): - authflag = True -else: - '''if not my_api_key and os.path.exists("api_key.txt") and os.path.getsize("api_key.txt"): # API key 所在的文件 - with open("api_key.txt", "r") as f: - my_api_key = f.read().strip()''' - - - - if os.path.exists("auth.json"): - with open("auth.json", "r") as f: - auth = json.load(f) - username = auth["username"] - password = auth["password"] - if username != "" and password != "": - authflag = True - -gr.Chatbot.postprocess = postprocess -PromptHelper.compact_text_chunks = compact_text_chunks - -with gr.Blocks(css=customCSS) as demo: - history = gr.State([]) - token_count = gr.State([]) - invite_code = gr.State() - promptTemplates = gr.State(load_template(get_template_names(plain=True)[0], mode=2)) - TRUECOMSTANT = gr.State(True) - FALSECONSTANT = gr.State(False) - topic = gr.State("未命名对话历史记录") - - # gr.HTML(""" - #
          - # """) - gr.HTML(title) - - with gr.Row(scale=1).style(equal_height=True): - with gr.Column(scale=5): - with gr.Row(scale=1): - chatbot = gr.Chatbot().style(height=600) # .style(color_map=("#1D51EE", "#585A5B")) - with gr.Row(scale=1): - with gr.Column(scale=12): - user_input = gr.Textbox(show_label=False, placeholder="在这里输入").style( - container=False) - with gr.Column(min_width=50, scale=1): - submitBtn = gr.Button("🚀", variant="primary") - with gr.Row(scale=1): - emptyBtn = gr.Button("🧹 新的对话", ) - retryBtn = gr.Button("🔄 重新生成") - delLastBtn = gr.Button("🗑️ 删除一条对话") - reduceTokenBtn = gr.Button("♻️ 总结对话") - - with gr.Column(): - with gr.Column(min_width=50, scale=1): - status_display = gr.Markdown("status: ready") - with gr.Tab(label="ChatGPT"): - keyTXT = gr.Textbox(show_label=True, placeholder=f"OpenAI API-key...", - type="password", visible=not HIDE_MY_KEY, label="API-Key/Invite-Code") - - keyTxt = gr.Textbox(visible=False) - - key_button = gr.Button("Enter") - - model_select_dropdown = gr.Dropdown(label="选择模型", choices=MODELS, multiselect=False, - value=MODELS[0]) - with gr.Accordion("参数", open=False): - temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0, - step=0.1, interactive=True, label="Temperature", ) - top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.05, - interactive=True, label="Top-p (nucleus sampling)", visible=False) - use_streaming_checkbox = gr.Checkbox(label="实时传输回答", value=True, visible=enable_streaming_option) - use_websearch_checkbox = gr.Checkbox(label="使用在线搜索", value=False) - index_files = gr.Files(label="上传索引文件", type="file", multiple=True) - - - with gr.Tab(label="Prompt"): - systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入System Prompt...", - label="System prompt", value=initial_prompt).style(container=True) - with gr.Accordion(label="加载Prompt模板", open=True): - with gr.Column(): - with gr.Row(): - with gr.Column(scale=6): - templateFileSelectDropdown = gr.Dropdown(label="选择Prompt模板集合文件", - choices=get_template_names(plain=True), - multiselect=False, - value=get_template_names(plain=True)[0]) - with gr.Column(scale=1): - templateRefreshBtn = gr.Button("🔄 刷新") - with gr.Row(): - with gr.Column(): - templateSelectDropdown = gr.Dropdown(label="从Prompt模板中加载", choices=load_template( - get_template_names(plain=True)[0], mode=1), multiselect=False, value= - load_template( - get_template_names(plain=True)[0], mode=1)[ - 0]) - - with gr.Tab(label="保存/加载"): - with gr.Accordion(label="保存/加载对话历史记录", open=True): - with gr.Column(): - with gr.Row(): - with gr.Column(scale=6): - historyFileSelectDropdown = gr.Dropdown( - label="从列表中加载对话", - choices=get_history_names(plain=True), - multiselect=False, - value=get_history_names(plain=True)[0], - visible=False - ) - - with gr.Row(): - with gr.Column(scale=6): - saveFileName = gr.Textbox( - show_label=True, - placeholder=f"设置文件名: 默认为.json,可选为.md", - label="设置保存文件名", - value="对话历史记录", - ).style(container=True) - with gr.Column(scale=1): - saveHistoryBtn = gr.Button("💾 保存对话") - exportMarkdownBtn = gr.Button("📝 导出为Markdown") - #gr.Markdown("默认保存于history文件夹") - with gr.Row(): - with gr.Column(): - downloadFile = gr.File(interactive=True) - - with gr.Tab(label="Davinci-003"): - with gr.Column(): - with gr.Row(): - with gr.Column(): - davinci_user_input = gr.Textbox(show_label=False, placeholder="在这里输入").style( - container=False) - temperature_davinci = gr.Slider(minimum=-0, maximum=1.0, value=0.7, - step=0.1, interactive=True, label="Temperature", ) - davinci_submitBtn = gr.Button("🚀", variant="primary") - davinci_output = gr.Textbox(show_label=False, placeholder="output").style( - container=False) - - gr.HTML(""" -
          - """) - gr.Markdown(description) - - # 输入为api key则保持不变,为邀请码则调用中心的api key - key_button.click(key_preprocessing, [keyTXT], [status_display, keyTxt, invite_code]) - - user_input.submit(predict, [ - keyTxt, - invite_code, - systemPromptTxt, - history, - user_input, - chatbot, - token_count, - top_p, - temperature, - use_streaming_checkbox, - model_select_dropdown, - use_websearch_checkbox, - index_files], - [chatbot, history, status_display, token_count], show_progress=True) - user_input.submit(reset_textbox, [], [user_input]) - - submitBtn.click(predict, [ - keyTxt, - invite_code, - systemPromptTxt, - history, - user_input, - chatbot, - token_count, - top_p, - temperature, - use_streaming_checkbox, - model_select_dropdown, - use_websearch_checkbox, - index_files], - [chatbot, history, status_display, token_count], show_progress=True) - - submitBtn.click(reset_textbox, [], [user_input]) - - emptyBtn.click(reset_state, outputs=[chatbot, history, token_count, status_display], show_progress=True) - - retryBtn.click(retry, - [keyTxt, invite_code, systemPromptTxt, history, chatbot, token_count, top_p, temperature, use_streaming_checkbox, - model_select_dropdown], [chatbot, history, status_display, token_count], show_progress=True) - - delLastBtn.click(delete_last_conversation, [chatbot, history, token_count], [ - chatbot, history, token_count, status_display], show_progress=True) - - reduceTokenBtn.click(reduce_token_size, [keyTxt, invite_code, systemPromptTxt, history, chatbot, token_count, top_p, - temperature, use_streaming_checkbox, model_select_dropdown], - [chatbot, history, status_display, token_count], show_progress=True) - # History - saveHistoryBtn.click( - save_chat_history, - [saveFileName, systemPromptTxt, history, chatbot], - downloadFile, - show_progress=True, - ) - saveHistoryBtn.click(get_history_names, None, [historyFileSelectDropdown]) - exportMarkdownBtn.click( - export_markdown, - [saveFileName, systemPromptTxt, history, chatbot], - downloadFile, - show_progress=True, - ) - #historyRefreshBtn.click(get_history_names, None, [historyFileSelectDropdown]) - historyFileSelectDropdown.change( - load_chat_history, - [historyFileSelectDropdown, systemPromptTxt, history, chatbot], - [saveFileName, systemPromptTxt, history, chatbot], - show_progress=True, - ) - downloadFile.change( - load_chat_history, - [downloadFile, systemPromptTxt, history, chatbot], - [saveFileName, systemPromptTxt, history, chatbot], - ) - - - # Template - templateRefreshBtn.click(get_template_names, None, [templateFileSelectDropdown]) - - templateFileSelectDropdown.change(load_template, [templateFileSelectDropdown], - [promptTemplates, templateSelectDropdown], show_progress=True) - - templateSelectDropdown.change(get_template_content, [promptTemplates, templateSelectDropdown, systemPromptTxt], - [systemPromptTxt], show_progress=True) - - # Davinci - davinci_user_input.submit(predict_davinci, - [ - keyTxt, - davinci_user_input, - temperature, - ], - [davinci_output], show_progress=True) - - davinci_submitBtn.click(predict_davinci, - [ - keyTxt, - davinci_user_input, - temperature_davinci, - ], - [davinci_output], show_progress=True) - -logging.info( "\n访问 http://localhost:7860 查看界面") -# 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接 -demo.title = "ChatGPT-长江商学院 🚀" - -if __name__ == "__main__": - #if running in Docker - if dockerflag: - if authflag: - demo.queue().launch(server_name="0.0.0.0", server_port=7860,auth=(username, password)) - else: - demo.queue().launch(server_name="0.0.0.0", server_port=7860, share=False) - #if not running in Docker - else: - if authflag: - demo.queue().launch(share=False, auth=(username, password)) - else: - demo.queue().launch(share=False) # 改为 share=True 可以创建公开分享链接 diff --git a/spaces/eIysia/VITS-Umamusume-voice-synthesizer/text/__init__.py b/spaces/eIysia/VITS-Umamusume-voice-synthesizer/text/__init__.py deleted file mode 100644 index 4e69c354dd24e3243980236eca962cd5945a92fc..0000000000000000000000000000000000000000 --- a/spaces/eIysia/VITS-Umamusume-voice-synthesizer/text/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -""" from https://github.com/keithito/tacotron """ -from text import cleaners - - -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 - - -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/ehristoforu/chat-client/app.py b/spaces/ehristoforu/chat-client/app.py deleted file mode 100644 index 2a51a3b20b95b189c0271b5a5ceca45997df262e..0000000000000000000000000000000000000000 --- a/spaces/ehristoforu/chat-client/app.py +++ /dev/null @@ -1,9 +0,0 @@ -import gradio as gr - -with gr.Blocks() as demo: - with gr.Tab("🐬 DolphinChat"): - gr.load("dolphinchat/dolphinchat-llm-gpt-ui", src="spaces") - with gr.Tab("🦅 FalconChat"): - gr.load("tiiuae/falcon-chat", src="spaces") - -demo.launch() \ No newline at end of file diff --git a/spaces/emre/emre-whisper-medium-turkish-2/README.md b/spaces/emre/emre-whisper-medium-turkish-2/README.md deleted file mode 100644 index ae7f4a48982dfb952c955d835f13f55e57ecb0bb..0000000000000000000000000000000000000000 --- a/spaces/emre/emre-whisper-medium-turkish-2/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Emre Whisper Medium Turkish 2 -emoji: 🔥 -colorFrom: yellow -colorTo: blue -sdk: gradio -sdk_version: 3.15.0 -app_file: app.py -pinned: false -license: openrail ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/ennet/ChatDev/camel/agents/tool_agents/__init__.py b/spaces/ennet/ChatDev/camel/agents/tool_agents/__init__.py deleted file mode 100644 index e47fcf82b3b5195696632fc3200ee9e46f4f2554..0000000000000000000000000000000000000000 --- a/spaces/ennet/ChatDev/camel/agents/tool_agents/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# =========== Copyright 2023 @ CAMEL-AI.org. 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. -# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== -from .base import BaseToolAgent -from .hugging_face_tool_agent import HuggingFaceToolAgent - -__all__ = [ - 'BaseToolAgent', - 'HuggingFaceToolAgent', -] diff --git a/spaces/eson/kplug/kplug/modeling_kplug.py b/spaces/eson/kplug/kplug/modeling_kplug.py deleted file mode 100644 index fbce0222acc8d21ffd4db6f467eb008a33d6c44a..0000000000000000000000000000000000000000 --- a/spaces/eson/kplug/kplug/modeling_kplug.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# author: xusong -# time: 2021/9/17 20:02 - -""" -1. self.embed_scale -2. -""" -import math -import torch -from transformers.models.bert.modeling_bert import BertForMaskedLM, BertEmbeddings, BertModel, BertForMaskedLM, \ - BertEncoder, BertPooler, BertOnlyMLMHead, BertConfig, logger -from transformers import MODEL_FOR_MASKED_LM_MAPPING - - - -class KplugEmbeddings(BertEmbeddings): - - def __init__(self, config): - super().__init__(config) - self.embed_scale = math.sqrt(config.hidden_size) # if config.scale_embedding else 1.0 - - def forward( - self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None, past_key_values_length=0 - ): - if input_ids is not None: - input_shape = input_ids.size() - else: - input_shape = inputs_embeds.size()[:-1] - - seq_length = input_shape[1] - - if position_ids is None: - position_ids = self.position_ids[:, past_key_values_length: seq_length + past_key_values_length] - - # Setting the token_type_ids to the registered buffer in constructor where it is all zeros, which usually occurs - # when its auto-generated, registered buffer helps users when tracing the model without passing token_type_ids, solves - # issue #5664 - if token_type_ids is None: - if hasattr(self, "token_type_ids"): - buffered_token_type_ids = self.token_type_ids[:, :seq_length] - buffered_token_type_ids_expanded = buffered_token_type_ids.expand(input_shape[0], seq_length) - token_type_ids = buffered_token_type_ids_expanded - else: - token_type_ids = torch.zeros(input_shape, dtype=torch.long, device=self.position_ids.device) - - if inputs_embeds is None: - inputs_embeds = self.word_embeddings(input_ids) * self.embed_scale - token_type_embeddings = self.token_type_embeddings(token_type_ids) - - embeddings = inputs_embeds + token_type_embeddings - if self.position_embedding_type == "absolute": - position_embeddings = self.position_embeddings(position_ids) - embeddings += position_embeddings - embeddings = self.LayerNorm(embeddings) - embeddings = self.dropout(embeddings) - return embeddings - - -class KplugModel(BertModel): - - def __init__(self, config, add_pooling_layer=True): - super(BertModel, self).__init__(config) - self.config = config - - self.embeddings = KplugEmbeddings(config) - self.encoder = BertEncoder(config) - - self.pooler = BertPooler(config) if add_pooling_layer else None - - self.init_weights() - - -class KplugForMaskedLM(BertForMaskedLM): - - def __init__(self, config): - super(BertForMaskedLM, self).__init__(config) - - if config.is_decoder: - logger.warning( - "If you want to use `BertForMaskedLM` make sure `config.is_decoder=False` for " - "bi-directional self-attention." - ) - - self.bert = KplugModel(config, add_pooling_layer=False) - self.cls = BertOnlyMLMHead(config) - - self.init_weights() - -MODEL_FOR_MASKED_LM_MAPPING[BertConfig] = KplugForMaskedLM diff --git a/spaces/facebook/ov-seg/open_vocab_seg/data/datasets/register_pascal_context.py b/spaces/facebook/ov-seg/open_vocab_seg/data/datasets/register_pascal_context.py deleted file mode 100644 index e40f87c945da20e78c0a3ea230bc9f36d1800071..0000000000000000000000000000000000000000 --- a/spaces/facebook/ov-seg/open_vocab_seg/data/datasets/register_pascal_context.py +++ /dev/null @@ -1,588 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import os - -from detectron2.data import DatasetCatalog, MetadataCatalog -from detectron2.data.datasets import load_sem_seg - -PASCALCONTEX59_NAMES = ( - "aeroplane", - "bicycle", - "bird", - "boat", - "bottle", - "bus", - "car", - "cat", - "chair", - "cow", - "table", - "dog", - "horse", - "motorbike", - "person", - "pottedplant", - "sheep", - "sofa", - "train", - "tvmonitor", - "bag", - "bed", - "bench", - "book", - "building", - "cabinet", - "ceiling", - "cloth", - "computer", - "cup", - "door", - "fence", - "floor", - "flower", - "food", - "grass", - "ground", - "keyboard", - "light", - "mountain", - "mouse", - "curtain", - "platform", - "sign", - "plate", - "road", - "rock", - "shelves", - "sidewalk", - "sky", - "snow", - "bedclothes", - "track", - "tree", - "truck", - "wall", - "water", - "window", - "wood", -) - -PASCALCONTEX459_NAMES = ( - "accordion", - "aeroplane", - "air conditioner", - "antenna", - "artillery", - "ashtray", - "atrium", - "baby carriage", - "bag", - "ball", - "balloon", - "bamboo weaving", - "barrel", - "baseball bat", - "basket", - "basketball backboard", - "bathtub", - "bed", - "bedclothes", - "beer", - "bell", - "bench", - "bicycle", - "binoculars", - "bird", - "bird cage", - "bird feeder", - "bird nest", - "blackboard", - "board", - "boat", - "bone", - "book", - "bottle", - "bottle opener", - "bowl", - "box", - "bracelet", - "brick", - "bridge", - "broom", - "brush", - "bucket", - "building", - "bus", - "cabinet", - "cabinet door", - "cage", - "cake", - "calculator", - "calendar", - "camel", - "camera", - "camera lens", - "can", - "candle", - "candle holder", - "cap", - "car", - "card", - "cart", - "case", - "casette recorder", - "cash register", - "cat", - "cd", - "cd player", - "ceiling", - "cell phone", - "cello", - "chain", - "chair", - "chessboard", - "chicken", - "chopstick", - "clip", - "clippers", - "clock", - "closet", - "cloth", - "clothes tree", - "coffee", - "coffee machine", - "comb", - "computer", - "concrete", - "cone", - "container", - "control booth", - "controller", - "cooker", - "copying machine", - "coral", - "cork", - "corkscrew", - "counter", - "court", - "cow", - "crabstick", - "crane", - "crate", - "cross", - "crutch", - "cup", - "curtain", - "cushion", - "cutting board", - "dais", - "disc", - "disc case", - "dishwasher", - "dock", - "dog", - "dolphin", - "door", - "drainer", - "dray", - "drink dispenser", - "drinking machine", - "drop", - "drug", - "drum", - "drum kit", - "duck", - "dumbbell", - "earphone", - "earrings", - "egg", - "electric fan", - "electric iron", - "electric pot", - "electric saw", - "electronic keyboard", - "engine", - "envelope", - "equipment", - "escalator", - "exhibition booth", - "extinguisher", - "eyeglass", - "fan", - "faucet", - "fax machine", - "fence", - "ferris wheel", - "fire extinguisher", - "fire hydrant", - "fire place", - "fish", - "fish tank", - "fishbowl", - "fishing net", - "fishing pole", - "flag", - "flagstaff", - "flame", - "flashlight", - "floor", - "flower", - "fly", - "foam", - "food", - "footbridge", - "forceps", - "fork", - "forklift", - "fountain", - "fox", - "frame", - "fridge", - "frog", - "fruit", - "funnel", - "furnace", - "game controller", - "game machine", - "gas cylinder", - "gas hood", - "gas stove", - "gift box", - "glass", - "glass marble", - "globe", - "glove", - "goal", - "grandstand", - "grass", - "gravestone", - "ground", - "guardrail", - "guitar", - "gun", - "hammer", - "hand cart", - "handle", - "handrail", - "hanger", - "hard disk drive", - "hat", - "hay", - "headphone", - "heater", - "helicopter", - "helmet", - "holder", - "hook", - "horse", - "horse-drawn carriage", - "hot-air balloon", - "hydrovalve", - "ice", - "inflator pump", - "ipod", - "iron", - "ironing board", - "jar", - "kart", - "kettle", - "key", - "keyboard", - "kitchen range", - "kite", - "knife", - "knife block", - "ladder", - "ladder truck", - "ladle", - "laptop", - "leaves", - "lid", - "life buoy", - "light", - "light bulb", - "lighter", - "line", - "lion", - "lobster", - "lock", - "machine", - "mailbox", - "mannequin", - "map", - "mask", - "mat", - "match book", - "mattress", - "menu", - "metal", - "meter box", - "microphone", - "microwave", - "mirror", - "missile", - "model", - "money", - "monkey", - "mop", - "motorbike", - "mountain", - "mouse", - "mouse pad", - "musical instrument", - "napkin", - "net", - "newspaper", - "oar", - "ornament", - "outlet", - "oven", - "oxygen bottle", - "pack", - "pan", - "paper", - "paper box", - "paper cutter", - "parachute", - "parasol", - "parterre", - "patio", - "pelage", - "pen", - "pen container", - "pencil", - "person", - "photo", - "piano", - "picture", - "pig", - "pillar", - "pillow", - "pipe", - "pitcher", - "plant", - "plastic", - "plate", - "platform", - "player", - "playground", - "pliers", - "plume", - "poker", - "poker chip", - "pole", - "pool table", - "postcard", - "poster", - "pot", - "pottedplant", - "printer", - "projector", - "pumpkin", - "rabbit", - "racket", - "radiator", - "radio", - "rail", - "rake", - "ramp", - "range hood", - "receiver", - "recorder", - "recreational machines", - "remote control", - "road", - "robot", - "rock", - "rocket", - "rocking horse", - "rope", - "rug", - "ruler", - "runway", - "saddle", - "sand", - "saw", - "scale", - "scanner", - "scissors", - "scoop", - "screen", - "screwdriver", - "sculpture", - "scythe", - "sewer", - "sewing machine", - "shed", - "sheep", - "shell", - "shelves", - "shoe", - "shopping cart", - "shovel", - "sidecar", - "sidewalk", - "sign", - "signal light", - "sink", - "skateboard", - "ski", - "sky", - "sled", - "slippers", - "smoke", - "snail", - "snake", - "snow", - "snowmobiles", - "sofa", - "spanner", - "spatula", - "speaker", - "speed bump", - "spice container", - "spoon", - "sprayer", - "squirrel", - "stage", - "stair", - "stapler", - "stick", - "sticky note", - "stone", - "stool", - "stove", - "straw", - "stretcher", - "sun", - "sunglass", - "sunshade", - "surveillance camera", - "swan", - "sweeper", - "swim ring", - "swimming pool", - "swing", - "switch", - "table", - "tableware", - "tank", - "tap", - "tape", - "tarp", - "telephone", - "telephone booth", - "tent", - "tire", - "toaster", - "toilet", - "tong", - "tool", - "toothbrush", - "towel", - "toy", - "toy car", - "track", - "train", - "trampoline", - "trash bin", - "tray", - "tree", - "tricycle", - "tripod", - "trophy", - "truck", - "tube", - "turtle", - "tvmonitor", - "tweezers", - "typewriter", - "umbrella", - "unknown", - "vacuum cleaner", - "vending machine", - "video camera", - "video game console", - "video player", - "video tape", - "violin", - "wakeboard", - "wall", - "wallet", - "wardrobe", - "washing machine", - "watch", - "water", - "water dispenser", - "water pipe", - "water skate board", - "watermelon", - "whale", - "wharf", - "wheel", - "wheelchair", - "window", - "window blinds", - "wineglass", - "wire", - "wood", - "wool", - -) - - -def _get_voc_meta(cat_list): - ret = { - "stuff_classes": cat_list, - } - return ret - - -def register_pascal_context_59(root): - root = os.path.join(root, "VOCdevkit/VOC2010") - meta = _get_voc_meta(PASCALCONTEX59_NAMES) - for name, image_dirname, sem_seg_dirname in [ - ("val", "JPEGImages", "annotations_detectron2/pc59_val"), - ]: - image_dir = os.path.join(root, image_dirname) - gt_dir = os.path.join(root, sem_seg_dirname) - all_name = f"pascal_context_59_sem_seg_{name}" - DatasetCatalog.register( - all_name, - lambda x=image_dir, y=gt_dir: load_sem_seg( - y, x, gt_ext="png", image_ext="jpg" - ), - ) - MetadataCatalog.get(all_name).set( - image_root=image_dir, - sem_seg_root=gt_dir, - evaluator_type="sem_seg", - ignore_label=255, - **meta, - ) - -def register_pascal_context_459(root): - root = os.path.join(root, "VOCdevkit/VOC2010") - meta = _get_voc_meta(PASCALCONTEX459_NAMES) - for name, image_dirname, sem_seg_dirname in [ - ("val", "JPEGImages", "annotations_detectron2/pc459_val"), - ]: - image_dir = os.path.join(root, image_dirname) - gt_dir = os.path.join(root, sem_seg_dirname) - all_name = f"pascal_context_459_sem_seg_{name}" - DatasetCatalog.register( - all_name, - lambda x=image_dir, y=gt_dir: load_sem_seg( - y, x, gt_ext="tif", image_ext="jpg" - ), - ) - MetadataCatalog.get(all_name).set( - image_root=image_dir, - sem_seg_root=gt_dir, - evaluator_type="sem_seg", - ignore_label=65535, # NOTE: gt is saved in 16-bit TIFF images - **meta, - ) - -_root = os.getenv("DETECTRON2_DATASETS", "datasets") -register_pascal_context_59(_root) -register_pascal_context_459(_root) diff --git a/spaces/falcondai/stego-lm/app.py b/spaces/falcondai/stego-lm/app.py deleted file mode 100644 index 9b35de222a4e20d5282d37d2227be3c42a33b23f..0000000000000000000000000000000000000000 --- a/spaces/falcondai/stego-lm/app.py +++ /dev/null @@ -1,359 +0,0 @@ -#!/usr/bin/env python -# An demo of linguistic steganography with patient-Huffman algorithm. -# We use symmetric key cryptography to en/decrypt. -# -# Reference: -# Dai FZ, Cai Z. Towards Near-imperceptible Steganographic Text. ACL 2019. - -import nacl.secret -import nacl.utils -from transformers import GPT2TokenizerFast, GPT2LMHeadModel -import gradio as gr -import numpy as np -import torch as th - -from huffman import build_min_heap, huffman_tree, tv_huffman, invert_code_tree - -# model_name = 'gpt2-xl' -# XXX Use GPT-2-small for less compute -model_name = 'gpt2' -lm = GPT2LMHeadModel.from_pretrained(model_name) -tokenizer = GPT2TokenizerFast.from_pretrained(model_name) - -def bits_to_recover(max_plaintext_length): - return (max_plaintext_length + 40) * 8 - -def p_next_token(prefix, cache=None, allow_eos=True): - t_prefix = th.as_tensor(prefix) - with th.no_grad(): - if cache: - # Incremental decoding. Input one token at a time with cache. - lm_out = lm.forward(input_ids=t_prefix[-1:], use_cache=True, past_key_values=cache) - else: - lm_out = lm.forward(input_ids=t_prefix, use_cache=True) - if allow_eos: - # Assume EOS is the last token in the vocabulary. - p_next_token = lm_out.logits[-1].softmax(dim=-1) - else: - p_next_token = lm_out.logits[-1, :-1].softmax(dim=-1) - return p_next_token.numpy(), lm_out.past_key_values - -def embed_bits(coin_flips, prefix, tv_threshold=0.1, max_sequence_length=400): - '''We use a sequence of coin flips to control the generation of token - indices from a language model. This returns _a sequence_ as defined by - the language model, e.g. sentence, paragraph.''' - # ind = tokenizer.bos_token_id - # prefix = [ind] - - hidden_prefix_ind = [tokenizer.bos_token_id] + tokenizer.encode(prefix) - n_hidden_prefix_ind = len(hidden_prefix_ind) - done_hiding = False - p, kv = p_next_token(hidden_prefix_ind, allow_eos=done_hiding) - n_skips = 0 - n_bits_encoded = 0 - n_tail_fill = 0 - ind = None - prefix_inds = [] - # Terminate the generation after we generate the EOS token - # XXX to save computation, we terminate as soon as all bits are hidden. - while not done_hiding and n_hidden_prefix_ind + len(prefix_inds) < max_sequence_length and ind != tokenizer.eos_token_id: - # There is still some cipher text to hide - if coin_flips: - # Build Huffman codes for the conditional distribution - heap = build_min_heap(p) - hc = huffman_tree(heap) - # print(hc) - # Check if the total variation is low enough - # print(len(prefix_inds) - 1, tv_huffman(hc, p)) - # print(tv_huffman(hc, p)[0], tv_threshold) - if tv_huffman(hc, p)[0] < tv_threshold: - # Huffman-decode the cipher text into a token - # Consume the cipher text until a token is generated - decoder_state = hc - while type(decoder_state) is tuple: - left, right = decoder_state - try: - bit = coin_flips.pop(0) - n_bits_encoded += 1 - except IndexError: - # No more cipher text. Pad with random bits - bit = np.random.choice(2) - n_tail_fill += 1 - # 0 => left, 1 => right - decoder_state = left if bit == '0' else right - # Decoder settles in a leaf node - ind = decoder_state - prefix_inds.append(ind) - yield prefix_inds - done_hiding = not bool(coin_flips) - p, kv = p_next_token(hidden_prefix_ind + prefix_inds, kv, done_hiding) - continue - # Forward sample according to LM normally - n_skips += 1 if coin_flips else 0 - ind = np.random.choice(tokenizer.vocab_size if done_hiding else tokenizer.vocab_size - 1, p=p) - prefix_inds.append(ind) - yield prefix_inds - p, kv = p_next_token(hidden_prefix_ind + prefix_inds, kv, done_hiding) - # Drop the EOS index - print(prefix_inds) - print(len(prefix_inds), n_skips, n_bits_encoded, n_tail_fill) - if prefix_inds[-1] == tokenizer.eos_token_id: - prefix_inds = prefix_inds[:-1] - yield prefix_inds - -def recover_bits(token_inds, tv_threshold, bits_to_recover, prefix): - remaining_bits = bits_to_recover - hidden_prefix_inds = [tokenizer.bos_token_id] + tokenizer.encode(prefix) - p, kv = p_next_token(hidden_prefix_inds, allow_eos=False) - cipher_text = [] - # Terminate the generation after we have consumed all indices or - # have extracted all bits - while token_inds and 0 < remaining_bits: - # Build Huffman codes for the conditional distribution - heap = build_min_heap(p) - hc = huffman_tree(heap) - # Check if the total variation is low enough - if tv_huffman(hc, p)[0] < tv_threshold: - # We have controlled this step. Some bits are hidden. - code = invert_code_tree(hc) - # Look up the Huffman code for the token. - ind = token_inds.pop(0) - # Convert the Huffman code into bits - # left => 0, right => 1 - cipher_text_fragment = code[ind] - # Truncate possible trailing paddings - cipher_text += cipher_text_fragment[:remaining_bits] - remaining_bits -= len(cipher_text_fragment) - yield cipher_text - # print(remaining_bits) - hidden_prefix_inds.append(ind) - p, kv = p_next_token(hidden_prefix_inds, cache=kv, allow_eos=False) - else: - # We did not control this step. Skip. - hidden_prefix_inds.append(token_inds.pop(0)) - p, kv = p_next_token(hidden_prefix_inds, cache=kv, allow_eos=False) - print(cipher_text, len(cipher_text), bits_to_recover) - yield cipher_text - - -with gr.Blocks() as demo: - gr.Markdown(''' - # Linguistic steganography demo with ``patient-Huffman`` algorithm - Instead of sending secrets in plaintext or in ciphertext, we can "hide the hiding" by embedding the encrypted secret in a natural looking message. - - ## Usage for message sender - 1. Type a short message. Click Encrypt to generate the ciphertext (encrypted text). - 2. Click Hide to generate the stegotext/covertext. - - ## Usage for message receiver - 1. Copy-paste the received stegotext/covertext into the stegotext box. Click Recover to extract the hidden ciphertext. - 2. Click Decrypt to decipher the original message. - ''') - - with gr.Accordion( - 'Secrets shared between sender and receiver', - open=False, - ): - # Shared secrets and parameters. - gr.Markdown(''' - - The proposed stegosystem is agnostic to the choice of cryptosystem. We use the symmetric key encryption implemented in `pyNaCl` library. - - An encryption key is randomly generated, you can refresh the page to get a different one. - - The _choice_ of language model is a shared secret. Due to computation resource constraints, we use GPT-2 as an example. - - The communicating parties can share a prefix to further control the stegotext to appear more appropriate for the channel, e.g., blog posts, social media messages. Take extra care of the whitespaces. - - Imperceptibility threshold controls how much the distribution of stegotexts is allowed to deviate from the language model. Lower imperceptibility threshold produces longer stegotext. - - - Reference: Dai FZ, Cai Z. [Towards Near-imperceptible Steganographic Text](https://arxiv.org/abs/1907.06679). ACL 2019. - ''') - state = gr.State() - with gr.Row(): - tb_shared_key = gr.Textbox( - label='encryption key (hex)', - value=lambda : nacl.utils.random(nacl.secret.SecretBox.KEY_SIZE).hex(), - interactive=True, - scale=1, - lines=3, - ) - # dp_shared_lm = gr.Dropdown( - # label='language model', - # choices=[ - # 'GPT-2', - # # 'GPT-3', - # ], - # value='GPT-2', - # ) - s_shared_imp = gr.Slider( - label='imperceptibility threshold', - minimum=0, - maximum=1, - value=0.4, - scale=1, - ) - s_shared_max_plaintext_len = gr.Slider( - label='max plaintext length', - minimum=4, - maximum=32, - step=1, - value=18, - scale=1, - ) - with gr.Column(scale=1): - tb_shared_prefix = gr.Textbox( - label='prefix', - value='', - ) - gr.Examples( - [ - 'best dessert recipe: ', - 'def solve(x):', - 'breaking news ', - '🤗🔒', - ], - tb_shared_prefix, - cache_examples=False, - ) - - with gr.Row(): - with gr.Box(): - with gr.Column(): - # Sender - gr.Markdown('## Sender') - - # Plain text - tb_sender_plaintext = gr.Textbox( - label='plaintext', - value='gold in top drawer', - ) - btn_encrypt = gr.Button('🔒 Encrypt') - - # Encrypt - # Cipher text - tb_sender_ciphertext = gr.Textbox( - label='ciphertext (hex)', - ) - btn_hide = gr.Button('🫣 Hide', interactive=False) - - # Hide - # Cover text - tb_sender_stegotext = gr.Textbox( - label='stegotext', - ) - - with gr.Box(): - with gr.Column(): - # Receiver - gr.Markdown('## Receiver') - # Cover text - tb_receiver_stegotext = gr.Textbox( - label='stegotext', - ) - btn_recover = gr.Button('🔎 Recover') - # Cipher text - tb_receiver_ciphertext = gr.Textbox( - label='recovered ciphertext (hex)', - ) - btn_decrypt = gr.Button('🔓 Decrypt', interactive=True) - # Plain text - tb_receiver_plaintext = gr.Textbox( - label='deciphered plaintext', - ) - - gr.Markdown(''' - ## Known issues - 1. The ciphertext recovered by the receiver might not match the original ciphertext. This is due to LLM tokenization mismatch. This is a fundamental challenge and for now, just Encrypt again (to use a different nonce) and go through the sender's process again. - 2. The stegotext looks incoherent. GPT-2 small is used for the demo and its fluency is quite limited. A stronger LLM will alleviate this problem. A smaller imperceptibility threshold should also help. - ''') - - # Link the UI to handlers - def encrypt(saved_state, key_in_hex, plaintext, max_plaintext_length): - shared_key = bytes.fromhex(key_in_hex) - # print(saved_state) - if saved_state is None: - # Create the secret boxes if they have not been created. - sender_box = nacl.secret.SecretBox(shared_key) - receiver_box = nacl.secret.SecretBox(shared_key) - saved_state = sender_box, receiver_box - else: - sender_box, receiver_box = saved_state - print('Encode:', bytes(plaintext, 'utf8'), len(bytes(plaintext, 'utf8'))) - utf8_encoded_plaintext = bytes(plaintext, 'utf8') - if len(utf8_encoded_plaintext) > max_plaintext_length: - raise gr.Error('Plaintext is too long. Try a shorter one or increase the max plaintext length.') - else: - # Pad the plaintext to the maximum length. - utf8_encoded_plaintext += bytes(' ' * (max_plaintext_length - len(utf8_encoded_plaintext)), encoding='utf8') - ciphertext = sender_box.encrypt(utf8_encoded_plaintext) - print('Encrypt:', plaintext, len(plaintext), ciphertext, len(ciphertext), len(ciphertext.hex())) - return [ - saved_state, - ciphertext.hex(), - gr.Button.update(interactive=True), - ] - - def decrypt(saved_state, ciphertext, key_in_hex): - shared_key = bytes.fromhex(key_in_hex) - if saved_state is None: - # Create the secret boxes if they have not been created. - sender_box = nacl.secret.SecretBox(shared_key) - receiver_box = nacl.secret.SecretBox(shared_key) - saved_state = sender_box, receiver_box - else: - sender_box, receiver_box = saved_state - try: - utf8_encoded_plaintext = receiver_box.decrypt(bytes.fromhex(ciphertext)) - print('Decrypt:', ciphertext, len(ciphertext), utf8_encoded_plaintext, len(utf8_encoded_plaintext)) - return [ - saved_state, - utf8_encoded_plaintext.decode('utf8'), - ] - except: - raise gr.Error('Decryption failed. Likely due to tokenization mismatch. Try Encrypting again.') - - def hide(ciphertext, tv_threshold, shared_prefix): - # Convert hex to bits - ba = bytes.fromhex(ciphertext) - bits = [b for h in ba for b in f'{h:08b}'] - print('Hide:', ciphertext, bits, len(bits)) - embed_gen = embed_bits(bits, shared_prefix, tv_threshold, lm.config.n_ctx // 2) - for inds in embed_gen: - yield tokenizer.decode(inds) - - def recover(stegotext, tv_threshold, max_plaintext_length, shared_prefix): - inds = tokenizer.encode(stegotext) - print('Recover:', stegotext, inds, len(inds)) - n_bits_to_recover = bits_to_recover(max_plaintext_length) - recover_gen = recover_bits(inds, tv_threshold, n_bits_to_recover, shared_prefix) - for bits in recover_gen: - yield ''.join(bits) - ba = bytearray() - # Convert bits to bytearray - for i in range(0, len(bits), 8): - ba.append(int(''.join(bits[i:i+8]), 2)) - yield ba.hex() - - btn_encrypt.click( - encrypt, - [state, tb_shared_key, tb_sender_plaintext, s_shared_max_plaintext_len], - [state, tb_sender_ciphertext, btn_hide], - ) - btn_hide.click( - hide, - [tb_sender_ciphertext, s_shared_imp, tb_shared_prefix], - [tb_sender_stegotext], - ) - btn_recover.click( - recover, - [tb_receiver_stegotext, s_shared_imp, s_shared_max_plaintext_len, tb_shared_prefix], - [tb_receiver_ciphertext], - ) - btn_decrypt.click( - decrypt, - [state, tb_receiver_ciphertext, tb_shared_key], - [state, tb_receiver_plaintext], - ) - - -if __name__ == '__main__': - demo.queue(concurrency_count=10) - demo.launch() - # demo.launch(share=True) \ No newline at end of file diff --git a/spaces/falterWliame/Face_Mask_Detection/Lingika Rahas Ath Potha Zip !!TOP!!.md b/spaces/falterWliame/Face_Mask_Detection/Lingika Rahas Ath Potha Zip !!TOP!!.md deleted file mode 100644 index d05604bbfa0053a262cc0877507ca381b237548a..0000000000000000000000000000000000000000 --- a/spaces/falterWliame/Face_Mask_Detection/Lingika Rahas Ath Potha Zip !!TOP!!.md +++ /dev/null @@ -1,6 +0,0 @@ -

          Lingika Rahas Ath Potha zip


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



          -
          - d5da3c52bf
          -
          -
          -

          diff --git a/spaces/falterWliame/Face_Mask_Detection/Matlab R2009a Portable.torrent.md b/spaces/falterWliame/Face_Mask_Detection/Matlab R2009a Portable.torrent.md deleted file mode 100644 index 3fc43f8ae6ca7e80f0c8b999de2a393085b4772a..0000000000000000000000000000000000000000 --- a/spaces/falterWliame/Face_Mask_Detection/Matlab R2009a Portable.torrent.md +++ /dev/null @@ -1,6 +0,0 @@ -

          Matlab R2009a Portable.torrent


          Download Ziphttps://urlca.com/2uDd17



          - -Download MATLAB 2009a (v 7.8) + CRACK torrent or any other ... MATLAB 7.9 R2009b (Windows) patch 7268 Matlab 2007b Portable 1.2. 4d29de3e1b
          -
          -
          -

          diff --git a/spaces/fatiXbelha/sd/Apkfolks Among Us The Best Modded Version of the Popular Game.md b/spaces/fatiXbelha/sd/Apkfolks Among Us The Best Modded Version of the Popular Game.md deleted file mode 100644 index e2cd89837eddacd50368ba2e362d790071c22429..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Apkfolks Among Us The Best Modded Version of the Popular Game.md +++ /dev/null @@ -1,135 +0,0 @@ -
          -

          Apkfolks Among Us: How to Download and Play the Modded Version of the Popular Game

          -

          Among Us is one of the most-played online games in the world, with millions of players joining the fun every day. But did you know that there is a modded version of the game that offers more features and customization options? In this article, we will tell you everything you need to know about Apkfolks Among Us, a website that provides modified APK files for Android devices. We will explain what Among Us is, why it is so popular, what Apkfolks is, how it works, how to download and install Apkfolks Among Us, and what are the advantages and disadvantages of using it. By the end of this article, you will be able to decide whether you want to try Apkfolks Among Us or stick to the original game.

          -

          What is Among Us and Why is it So Popular?

          -

          Among Us is a multiplayer game that was released in 2018 by Innersloth, a small indie game studio. It is a social deception game, where players have to work together as crewmates on a spaceship, while trying to identify and eliminate one or more impostors who are secretly sabotaging and killing them. The game can be played online or locally, with 4 to 15 players, using voice chat or text chat. The game has four maps to choose from: The Skeld, Mira HQ, Polus, and The Airship.

          -

          apkfolks among us


          DOWNLOAD » https://urllie.com/2uNv11



          -

          The Gameplay and Rules of Among Us

          -

          The gameplay of Among Us is simple but addictive. At the start of each round, players are randomly assigned the role of either crewmate or impostor. Crewmates have to complete tasks around the map, which are mini-games that involve things like wiring, scanning, fueling, etc. Impostors have to kill crewmates without being caught, while also sabotaging the ship's systems, such as lights, oxygen, reactor, etc. Impostors can also use vents to move around the map quickly and discreetly.

          -

          When a dead body is found by a crewmate, they can report it and call an emergency meeting. During the meeting, all players can discuss who they think is the impostor, based on their observations and alibis. Players can also call an emergency meeting by pressing a button in the cafeteria or meeting room. After each meeting, players can vote to eject someone from the ship. If they eject an impostor, they win. If they eject a crewmate, they lose. If there is a tie or no one is ejected, the game continues.

          -

          Crewmates can also win by completing all their tasks before the impostors kill them all. Impostors can also win by killing enough crewmates so that their number equals or exceeds the number of crewmates left alive. Impostors can also win by sabotaging a critical system and preventing crewmates from fixing it in time.

          -

          The Rise of Among Us in 2020

          -

          Although Among Us was released in 2018, it did not gain much attention until mid-2020, when several popular Twitch streamers and YouTubers started playing it with their friends and fans. Some of these streamers include PewDiePie, Jacksepticeye, Corpse Husband, Valkyrae, Disguised

          The Appeal of Among Us for Streamers and Viewers

          -

          One of the main reasons why Among Us became so popular in 2020 was because of the streaming community. Many streamers and YouTubers started playing the game with their friends and fans, creating hilarious and suspenseful moments that attracted millions of viewers. Some of the most popular streamers who played Among Us include PewDiePie, Jacksepticeye, Corpse Husband, Valkyrae, Disguised Toast, Pokimane, and more.

          -

          The appeal of Among Us for streamers and viewers is that it is a game that relies heavily on social interaction, deception, and deduction. It is a game that can showcase the personalities, skills, and humor of the players, as well as their reactions to the twists and turns of the game. It is also a game that can create a lot of drama, tension, and excitement, as well as memes and fan art. Moreover, it is a game that anyone can play and enjoy, regardless of their age, gender, or gaming experience.

          -

          apkfolks among us mod menu
          -apkfolks among us download
          -apkfolks among us hack
          -apkfolks among us unlocked
          -apkfolks among us latest version
          -apkfolks among us always impostor
          -apkfolks among us no ads
          -apkfolks among us free skins
          -apkfolks among us online
          -apkfolks among us pc
          -apkfolks among us android
          -apkfolks among us ios
          -apkfolks among us review
          -apkfolks among us gameplay
          -apkfolks among us update
          -apkfolks among us tips and tricks
          -apkfolks among us cheats
          -apkfolks among us guide
          -apkfolks among us how to install
          -apkfolks among us reddit
          -apkfolks among us discord
          -apkfolks among us youtube
          -apkfolks among us turbo warp[^1^]
          -apkfolks among us sur.ly[^2^]
          -apkfolks among us website[^3^]
          -apkfolks among us airship map
          -apkfolks among us custom roles
          -apkfolks among us voice chat
          -apkfolks among us pro pack
          -apkfolks among us premium
          -apkfolks among us safe
          -apkfolks among us virus free
          -apkfolks among us error fix
          -apkfolks among us support
          -apkfolks among us alternatives
          -apkfolks among us similar apps
          -apkfolks among us ratings
          -apkfolks among us comments
          -apkfolks among us feedbacks
          -apkfolks among us suggestions
          -apkfolks among us features
          -apkfolks among us benefits
          -apkfolks among us disadvantages
          -apkfolks among us pros and cons
          -apkfolks among us comparison
          -apkfolks among us vs original game

          -

          What is Apkfolks and How Does it Work?

          -

          Apkfolks is a website that provides modified APK files for Android devices. APK stands for Android Package Kit, which is the file format used by Android to distribute and install applications. A modified APK file is an APK file that has been altered or hacked to change some aspects of the original application. For example, a modified APK file can unlock premium features, remove ads, add cheats, or change the graphics or gameplay of an application.

          -

          The Definition and Function of Apkfolks

          -

          Apkfolks is a website that claims to offer "the best modded apps and games for free". It has a large collection of modified APK files for various popular applications and games, such as Spotify, Netflix, WhatsApp, Instagram, PUBG Mobile, Free Fire, and more. Apkfolks also has a section dedicated to Among Us, where it provides different versions of the game with various mods and hacks.

          -

          The function of Apkfolks is to allow users to download and install modified APK files on their Android devices without rooting them. Rooting is the process of gaining full access to the system settings and features of an Android device, which can allow users to install custom ROMs, kernels, mods, and apps. However, rooting can also void the warranty of the device, expose it to security risks, and cause performance issues. Apkfolks claims that its modified APK files do not require rooting and are safe to use.

          -

          The Benefits and Risks of Using Apkfolks

          -

          The benefits of using Apkfolks are that it can provide users with more features and options for their applications and games. For example, using Apkfolks Among Us can allow users to access different skins, hats, pets, maps, modes, cheats, hacks, and more. Some of these features are not available in the original game or require real money to purchase. Using Apkfolks can also allow users to customize their applications and games according to their preferences and needs.

          -

          The risks of using Apkfolks are that it can violate the terms of service and policies of the original developers and publishers of the applications and games. For example, using Apkfolks Among Us can be considered as piracy or cheating by Innersloth , the creators of Among Us. This can result in legal actions or bans from the official servers or platforms. Using Apkfolks can also expose users to malware or viruses that can harm their devices or steal their personal information. Moreover, using Apkfolks can ruin the fun and fairness of the applications and games for other users who play legitimately.

          -

          The Legal and Ethical Issues of Using Apkfolks

          -

          The legal issues of using Apkfolks are that it can infringe on the intellectual property rights and copyrights of the original developers and publishers of the applications and games. For example, using Apkfolks Among Us can be seen as a violation of the End User License Agreement (EULA) and the Digital Millennium Copyright Act (DMCA) of Among Us. These are legal contracts and laws that protect the rights and interests of the creators and owners of digital content. Using Apkfolks can also be seen as a breach of trust and respect for the hard work and creativity of the developers and publishers of the applications and games.

          -

          The ethical issues of using Apkfolks are that it can undermine the integrity and quality of the applications and games. For example, using Apkfolks Among Us can create an unfair advantage for some players over others, or disrupt the balance and harmony of the game. This can lead to frustration, anger, or boredom for the players who play by the rules. Using Apkfolks can also diminish the value and enjoyment of the applications and games, as they lose their originality, authenticity, and challenge. Moreover, using Apkfolks can harm the reputation and revenue of the developers and publishers of the applications and games, as they lose their loyal customers and potential income.

          -

          How to Download and Install Apkfolks Among Us

          -

          If you still want to try Apkfolks Among Us, despite the risks and issues involved, you will need to follow some steps to download and install it on your Android device. Here are the requirements and precautions for installing Apkfolks Among Us:

          -

          The Requirements and Precautions for Installing Apkfolks Among Us

          -

          Before you download and install Apkfolks Among Us, you will need to make sure that your Android device meets the following requirements:

          -
            -
          • It has Android version 4.4 or higher.
          • -
          • It has at least 100 MB of free storage space.
          • -
          • It has a stable internet connection.
          • -
          -

          You will also need to take some precautions to avoid any problems or damages to your device or data:

          -
            -
          • Backup your device data before installing Apkfolks Among Us, in case something goes wrong.
          • -
          • Uninstall any previous or official version of Among Us from your device, to avoid any conflicts or errors.
          • -
          • Enable the option to install apps from unknown sources on your device settings, to allow Apkfolks Among Us to be installed.
          • -
          • Disable any antivirus or security software on your device, to prevent them from blocking or deleting Apkfolks Among Us.
          • -
          • Download Apkfolks Among Us only from its official website, to avoid any fake or malicious files.
          • -
          -

          The Steps for Downloading and Installing Apkfolks Among Us

          -

          After you have met the requirements and taken the precautions for installing Apkfolks Among Us, you can follow these steps to download and install it on your Android device:

          -
            -
          1. Go to the official website of Apkfolks at https://apkfolks.com/.
          2. -
          3. Search for Among Us in the search bar or browse through the categories until you find it.
          4. -
          5. Select the version of Apkfolks Among Us that you want to download. There are different versions with different mods and hacks, such as Always Impostor, No Kill Cooldown, Unlock All Skins, etc.
          6. -
          7. Click on the download button and wait for the file to be downloaded on your device.
          8. -
          9. Locate the downloaded file on your device's file manager or downloads folder.
          10. -
          11. Tap on the file and follow the instructions to install it on your device.
          12. -
          13. Launch Apkfolks Among Us from your device's app drawer or home screen.
          14. -
          15. Enjoy playing Apkfolks Among Us with its modded features and options.
          16. -
          -

          The Features and Differences of Apkfolks Among Us

          -

          Apkfolks Among Us is different from the original game in many ways. It has various features that can enhance or alter your gaming experience. Some of these features are:

          -
            -
          • You can choose to be an impostor or a crewmate at any time, regardless of the game settings or randomization.
          • -
          • You can kill crewmates without any cooldown time or limit, making it easier to eliminate them all quickly.
          • -
          • You can unlock all skins, hats, pets, maps, modes, and more without paying any real money or completing any tasks.
          • -
          • You can see who is an impostor or a crewmate by using a radar or a color indicator.
          • -
          • You can chat with other players during meetings or while dead, giving you more communication options.
          • You can use various cheats and hacks, such as speed hack, wall hack, ghost mode, invisibility, etc. -
          -

          However, these features also come with some drawbacks and limitations. Some of these are:

          -
            -
          • You can only play Apkfolks Among Us with other players who have the same version of the game, which can limit your options and compatibility.
          • -
          • You can face technical issues or errors while playing Apkfolks Among Us, such as crashes, glitches, bugs, etc.
          • -
          • You can get banned or reported by other players or the official servers for using Apkfolks Among Us, which can affect your account and reputation.
          • -
          • You can lose the original charm and challenge of the game by using Apkfolks Among Us, which can make it boring or repetitive.
          • -
          -

          Conclusion

          -

          Apkfolks Among Us is a modded version of the popular game Among Us that offers more features and customization options for Android users. It is a website that provides modified APK files that can be downloaded and installed on Android devices without rooting them. Apkfolks Among Us has various advantages and disadvantages, as well as legal and ethical issues, that users should be aware of before using it. Apkfolks Among Us can be a fun and exciting way to play Among Us with more variety and freedom, but it can also be a risky and unfair way to play Among Us with less quality and integrity.

          -

          If you want to try Apkfolks Among Us, you can follow the steps we provided in this article to download and install it on your Android device. However, we recommend that you use it at your own risk and discretion, and respect the rights and wishes of the original developers and publishers of Among Us, as well as the other players who play the game. We hope that this article was helpful and informative for you. Thank you for reading!

          -

          A Call to Action for the Readers

          -

          If you enjoyed this article, please share it with your friends and family who might be interested in Apkfolks Among Us. You can also leave a comment below to let us know what you think about Apkfolks Among Us, or ask any questions you might have about it. We would love to hear from you!

          -

          FAQs

          -

          Here are some frequently asked questions about Apkfolks Among Us:

          -

          Is Apkfolks Among Us safe to use?

          -

          Apkfolks claims that its modified APK files are safe to use and do not contain any malware or viruses. However, there is no guarantee that this is true, as Apkfolks is not an official or verified source of APK files. Therefore, users should be careful and cautious when using Apkfolks Among Us, and scan their devices regularly for any potential threats.

          -

          Is Apkfolks Among Us free to use?

          -

          Yes, Apkfolks Among Us is free to use and does not require any payment or subscription. However, users should be aware that using Apkfolks Among Us can be considered as piracy or cheating by Innersloth , the creators of Among Us. This can result in legal actions or bans from the official servers or platforms.

          -

          Can I play Apkfolks Among Us with my friends?

          -

          Yes, you can play Apkfolks Among Us with your friends, but only if they have the same version of the game as you. You cannot play Apkfolks Among Us with players who have the original or different version of the game, as they will not be compatible with each other. You can also create or join private rooms with your friends who have Apkfolks Among Us, or play online with other players who have it.

          -

          Can I update Apkfolks Among Us?

          -

          Yes, you can update Apkfolks Among Us whenever there is a new version available on its website. However, you will need to uninstall the previous version of the game from your device before installing the new one. You will also need to check if the new version of Apkfolks Among Us has the same or different features and options as the old one.

          -

          Can I uninstall Apkfolks Among Us?

          -

          Yes, you can uninstall Apkfolks Among Us from your device at any time. You just need to go to your device settings, find Apkfolks Among Us in your list of apps, and tap on uninstall. You can also delete the downloaded file from your device's file manager or downloads folder.

          401be4b1e0
          -
          -
          \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Apprendre les tables de multiplication facilement et rapidement.md b/spaces/fatiXbelha/sd/Apprendre les tables de multiplication facilement et rapidement.md deleted file mode 100644 index 4f856f92e67489d61a5768505bf155799cef3fce..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Apprendre les tables de multiplication facilement et rapidement.md +++ /dev/null @@ -1,54 +0,0 @@ -
          -

          Table de multiplication: qu'est-ce que c'est et comment l'apprendre?

          | | H2: Introduction |

          Introduction

          La table de multiplication est un outil mathématique qui permet de calculer rapidement le produit de deux nombres entiers. Elle est composée de lignes et de colonnes qui indiquent les facteurs et les produits. Par exemple, dans la table de multiplication de 3, on trouve le produit de 3 par chaque nombre de 1 à 12.

          -

          table de multiplication


          Download »»» https://urllie.com/2uNAOM



          Apprendre les tables de multiplication est une étape importante dans l'apprentissage des mathématiques à l'école primaire. Elles permettent de développer le sens du nombre, la mémoire, le calcul mental et la résolution de problèmes. Mais comment apprendre les tables de multiplication efficacement et sans se décourager? Dans cet article, nous allons vous donner quelques conseils et astuces pour maîtriser les tables de multiplication de 1 à 12.

          | | H2: Quelle est l'origine des tables de multiplication? |

          Quelle est l'origine des tables de multiplication?

          Les tables de multiplication ne sont pas une invention récente. Elles existent depuis l'Antiquité, chez les civilisations comme les Babyloniens, les Égyptiens, les Grecs ou les Romains. Ces peuples utilisaient des systèmes de numération différents du nôtre, mais ils avaient besoin de calculer le produit de deux nombres pour des raisons commerciales, astronomiques ou géométriques.

          Les premières traces écrites des tables de multiplication remontent à environ 2000 ans avant J.-C., sur des tablettes d'argile ou des papyrus. Ces documents montrent que les anciens connaissaient les propriétés des tables de multiplication, comme la commutativité (le fait que le produit ne change pas si on inverse l'ordre des facteurs) ou la distributivité (le fait que le produit d'une somme est égal à la somme des produits).

          Au fil du temps, les tables de multiplication ont évolué et se sont adaptées aux différents systèmes de numération et aux besoins des utilisateurs. Aujourd'hui, nous utilisons le système décimal, qui repose sur 10 chiffres (de 0 à 9) et qui facilite le calcul et la mémorisation des tables de multiplication.

          | 7. I will add a table to the article, showing an example of a table de multiplication and explaining how to read it. 8. I will add a H2 heading for the conclusion and write a summary of the main points of the article. 9. I will add 5 unique FAQs after the conclusion, with questions and answers related to the topic of the article. 10. I will write " Here are the two tables I updated: | Outline of the article | Article with HTML formatting | | --- | --- | | H1: Table de multiplication: qu'est-ce que c'est et comment l'apprendre? |

          Table de multiplication: qu'est-ce que c'est et comment l'apprendre?

          | | H2: Introduction |

          Introduction

          La table de multiplication est un outil mathématique qui permet de calculer rapidement le produit de deux nombres entiers. Elle est composée de lignes et de colonnes qui indiquent les facteurs et les produits. Par exemple, dans la table de multiplication de 3, on trouve le produit de 3 par chaque nombre de 1 à 12.

          -

          Table de multiplication à imprimer
          -Table de multiplication en ligne
          -Table de multiplication jeu
          -Table de multiplication CE1
          -Table de multiplication CE2
          -Table de multiplication CM1
          -Table de multiplication CM2
          -Table de multiplication facile
          -Table de multiplication exercice
          -Table de multiplication interactif
          -Table de multiplication PDF
          -Table de multiplication chanson
          -Table de multiplication avec les doigts
          -Table de multiplication Montessori
          -Table de multiplication Maya
          -Table de multiplication magique
          -Table de multiplication rapide
          -Table de multiplication diplôme
          -Table de multiplication quiz
          -Table de multiplication ludique
          -Table de multiplication apprendre
          -Table de multiplication réviser
          -Table de multiplication astuce
          -Table de multiplication truc
          -Table de multiplication mémoriser
          -Table de multiplication poster
          -Table de multiplication carte
          -Table de multiplication puzzle
          -Table de multiplication domino
          -Table de multiplication bingo
          -Table de multiplication coloriage
          -Table de multiplication mandala
          -Table de multiplication origami
          -Table de multiplication robot
          -Table de multiplication escargot
          -Table de multiplication étoile
          -Table de multiplication fleur
          -Table de multiplication animaux
          -Table de multiplication fruits
          -Table de multiplication légumes
          -Table de multiplication voiture
          -Table de multiplication avion
          -Table de multiplication bateau
          -Table de multiplication train
          -Table de multiplication fusée
          -Table de multiplication planète
          -Table de multiplication soleil
          -Table de multiplication lune
          -Table de multiplication arc-en-ciel

          Apprendre les tables de multiplication est une étape importante dans l'apprentissage des mathématiques à l'école primaire. Elles permettent de développer le sens du nombre, la mémoire, le calcul mental et la résolution de problèmes. Mais comment apprendre les tables de multiplication efficacement et sans se décourager? Dans cet article, nous allons vous donner quelques conseils et astuces pour maîtriser les tables de multiplication de 1 à 12.

          | | H2: Quelle est l'origine des tables de multiplication? |

          Quelle est l'origine des tables de multiplication?

          Les tables de multiplication ne sont pas une invention récente. Elles existent depuis l'Antiquité, chez les civilisations comme les Babyloniens, les Égyptiens, les Grecs ou les Romains. Ces peuples utilisaient des systèmes de numération différents du nôtre, mais ils avaient besoin de calculer le produit de deux nombres pour des raisons commerciales, astronomiques ou géométriques.

          Les premières traces écrites des tables de multiplication remontent à environ 2000 ans avant J.-C., sur des tablettes d'argile ou des papyrus. Ces documents montrent que les anciens connaissaient les propriétés des tables de multiplication, comme la commutativité (le fait que le produit ne change pas si on inverse l'ordre des facteurs) ou la distributivité (le fait que le produit d'une somme est égal à la somme des produits).

          Au fil du temps, les tables de multiplication ont évolué et se sont adaptées aux différents systèmes de numération et aux besoins des utilisateurs. Aujourd'hui, nous utilisons le système décimal, qui repose sur 10 chiffres (de 0 à 9) et qui facilite le calcul et la mémorisation des tables de multiplication.

          | | H2: Comment apprendre les tables de multiplication? |

          Comment apprendre les tables de multiplication?

          Apprendre les tables de multiplication n'est pas toujours facile pour tous les enfants. Il faut beaucoup de répétition, d'entraînement et de motivation pour les mémoriser et les utiliser correctement. Voici quelques conseils et astuces pour apprendre les tables de multiplication:

          • Commencez par apprendre les tables les plus simples, comme la table de 1, la table de 2, la table de 5 ou la table de 10. Ces tables ont des règles simples à retenir, comme le fait que le produit se termine toujours par le même chiffre que le deuxième facteur.
          • Utilisez des supports visuels, comme des cartes, des affiches ou des jeux. Ces supports permettent d'associer les produits aux facteurs, de visualiser les relations entre les tables et de s'amuser en apprenant.
          • Répétez les tables à voix haute, en chantant ou en rythmant. Ces techniques permettent de renforcer la mémoire auditive et de créer des associations mnémoniques entre les sons et les nombres.
          • Pratiquez le calcul mental, en utilisant des stratégies comme le double, le

            197e85843d
            -
            -
            \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Car Parking Multiplayer APK GG Tips and Tricks for the Simulation Game.md b/spaces/fatiXbelha/sd/Car Parking Multiplayer APK GG Tips and Tricks for the Simulation Game.md deleted file mode 100644 index cc104f098c2b5998e858865dd8a5b8d2439f0c3a..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Car Parking Multiplayer APK GG Tips and Tricks for the Simulation Game.md +++ /dev/null @@ -1,121 +0,0 @@ - -

            Car Parking Multiplayer APK GG: A Guide for Beginners

            -

            If you are looking for a realistic and fun driving simulator game, you might want to check out Car Parking Multiplayer. This game offers more than just parking: you can explore an open world, customize your car, race with other players, and even use a cheat tool called Game Guardian to hack the game. In this article, we will show you what Car Parking Multiplayer is, how to download and install it, what Game Guardian is, how to use it on the game, and some tips and tricks to make the most out of your gaming experience.

            -

            car parking multiplayer apk gg


            Download ————— https://urllie.com/2uNwsA



            -

            What is Car Parking Multiplayer?

            -

            Car Parking Multiplayer is a simulation game developed by olzhass that lets you drive various cars in different environments and scenarios. You can choose from over 100 cars with realistic interiors and physics, and customize them with different parts and vinyls. You can also interact with other players in the multiplayer mode, where you can chat, exchange cars, race, or even play as a police officer. The game also features a free walking mode, where you can get out of your car and explore the world on foot. You can visit different locations, such as cities, airports, deserts, and more.

            -

            Features of the game

            -

            Some of the features that make Car Parking Multiplayer stand out are:

            -
              -
            • Free walking: You can walk around freely in the open world, enter buildings, use elevators, and interact with objects.
            • -
            • Free open world: You can drive anywhere you want, visit real gas stations and car services, and enjoy the realistic graphics and sounds.
            • -
            • Multiplayer racing: You can compete against real players in various modes, such as drag racing, drifting, off-road racing, and more.
            • -
            • Car exchange: You can trade your cars with other players, or buy new ones from the online market.
            • -
            • Voice chat: You can communicate with other players using voice chat, or use text chat if you prefer.
            • -
            • Police mode: You can play as a police officer and chase criminals, or as a criminal and evade the police.
            • -
            • Friend list: You can add other players as friends, join their games, or invite them to yours.
            • -
            • Car customization: You can modify your car's performance, such as engine, turbo, gearbox, exhaust, etc. You can also change its appearance, such as suspension, wheel angle, color, vinyls, body parts, etc.
            • -
            -

            How to download and install the game

            -

            To download and install Car Parking Multiplayer on your Android device, you can follow these steps:

            -
              -
            1. Go to the Google Play Store and search for Car Parking Multiplayer.
            2. -
            3. Tap on the Install button and wait for the download to finish.
            4. -
            5. Once the installation is complete, tap on the Open button to launch the game.
            6. -
            7. You can also download the APK file from other sources , but make sure they are safe and trustworthy. To install the APK file, you need to enable unknown sources in your device settings.
            8. -
            -

            What is Game Guardian?

            -

            Game Guardian is an app that can be used to hack a variety of video games on your Android device. It allows you to modify various aspects of the game, such as money, HP, SP, and much more. You can also use it to speed up or slow down the game speed, search for encrypted values, change memory values, dump memory, copy memory, etc. With Game Guardian, you can enjoy the fun part of a game without the hassle of grinding or spending real money.

            -

            Features of the app

            -

            Some of the features that make Game Guardian a powerful and versatile tool are:

            -

            car parking multiplayer free download for pc
            -car parking multiplayer simulation game by olzhass
            -car parking multiplayer join official discord server
            -car parking multiplayer open world mode with real players
            -car parking multiplayer android app on google play
            -car parking multiplayer bluestacks app player for mac
            -car parking multiplayer car customization and tuning
            -car parking multiplayer voice chat and friend list
            -car parking multiplayer police mode and racing mode
            -car parking multiplayer 100 cars with real interior
            -car parking multiplayer 82 real-life parking challenges
            -car parking multiplayer dynamic vynils and body parts
            -car parking multiplayer swap engine turbo gearbox and exhaust
            -car parking multiplayer adjustable suspension and wheel angle
            -car parking multiplayer free walking and gas stations
            -car parking multiplayer exchange cars with real players online
            -car parking multiplayer highly detailed environments and buildings
            -car parking multiplayer 16 player skins and clothing options
            -car parking multiplayer tow truck pickup trucks and sport cars
            -car parking multiplayer apk gg latest version download
            -car parking multiplayer apk gg mod menu and cheats
            -car parking multiplayer apk gg unlimited money and gold
            -car parking multiplayer apk gg hack tool and generator
            -car parking multiplayer apk gg no ads and in-app purchases
            -car parking multiplayer apk gg offline mode and data safety
            -car parking multiplayer apk gg reviews and ratings
            -car parking multiplayer apk gg gameplay and trailer
            -car parking multiplayer apk gg tips and tricks
            -car parking multiplayer apk gg support and feedback
            -car parking multiplayer apk gg updates and news

            -
              -
            • Runs on ARM, x64 and x86 devices, including x86 emulators.
            • -
            • Supports Android 2.3.3+ (Gingerbread) through Android 11.
            • -
            • Supports multiple languages, such as English, Chinese, Russian, etc.
            • -
            • Works on both rooted and non-rooted devices, but requires a virtual environment for the latter.
            • -
            • Supports multiple search modes, such as exact value, fuzzy value, encrypted value, etc.
            • -
            • Supports multiple data types, such as DWORD, FLOAT, DOUBLE, QWORD, etc.
            • -
            • Supports Lua scripting for more advanced hacking.
            • -
            • Supports stealth mode to hide the app from detection.
            • -
            -

            How to download and install the app

            -

            To download and install Game Guardian on your Android device, you can follow these steps:

            -
              -
            1. Go to the official website of Game Guardian and download the latest version of the app.
            2. -
            3. Locate the downloaded APK file and tap on it to install it. You may need to enable unknown sources in your device settings.
            4. -
            5. Once the installation is complete, launch the app and grant it root or virtual permissions.
            6. -
            7. You can also watch this video tutorial for more details on how to install and use Game Guardian.
            8. -
            -

            How to use Game Guardian on Car Parking Multiplayer

            -

            If you want to hack Car Parking Multiplayer with Game Guardian, you need to follow some steps to set up the app and then use some tips and tricks to modify the game values. Here is how you can do it:

            -

            Steps to set up Game Guardian

            -
              -
            1. Launch Game Guardian and select the option to start it with root or virtual mode. If you choose virtual mode, you need to install a virtual space app and clone both Game Guardian and Car Parking Multiplayer in it.
            2. -
            3. Open Car Parking Multiplayer from Game Guardian or from the virtual space app.
            4. -
            5. Tap on the Game Guardian icon that floats on your screen and select Car Parking Multiplayer as the process to hack.
            6. -
            7. You can now use the search function of Game Guardian to find and change the values you want in the game.
            8. -
            -

            Tips and tricks to hack the game

            -

            Here are some examples of what you can hack in Car Parking Multiplayer with Game Guardian:

            -
              -
            • Hack money: You can search for your current money value in DWORD type and change it to any amount you want. You can also use the group search function to find multiple values at once, such as money, gold, level, etc.
            • -
            • Hack speed: You can search for your current speed value in FLOAT type and change it to increase or decrease your speed. You can also freeze the value so that it does not change.
            • -
            • Hack fuel: You can search for your current fuel value in FLOAT type and change it to make it infinite. You can also freeze the value so that it does not decrease.
            • -
            • Hack time: You can search for the current time value in DWORD type and change it to manipulate the time in the game. You can also use the speed hack function of Game Guardian to make the game run faster or slower.
            • -
            -

            Conclusion

            -

            In this article, we have shown you what Car Parking Multiplayer is, how to download and install it, what Game Guardian is, how to use it on the game, and some tips and tricks to hack the game. We hope you have enjoyed reading this article and learned something new. If you have any questions or feedback, please feel free to leave a comment below. Happy gaming!

            -

            Summary of the main points

            -
              -
            • Car Parking Multiplayer is a realistic and fun driving simulator game that offers more than just parking.
            • -
            • You can download and install Car Parking Multiplayer from the Google Play Store or from other sources.
            • -
            • Game Guardian is an app that can be used to hack a variety of video games on your Android device.
            • -
            • You can download and install Game Guardian from its official website or from other sources.
            • -
            • You can use Game Guardian on Car Parking Multiplayer by following some steps to set up the app and then using some tips and tricks to modify the game values.
            • -
            -

            FAQs

            -

            Here are some frequently asked questions about Car Parking Multiplayer and Game Guardian:

            -
              -
            1. Is Car Parking Multiplayer free to play?
            2. -

              Yes, Car Parking Multiplayer is free to download and play, but it contains ads and in-app purchases. You can disable the ads by turning off your internet connection or by using an ad blocker. You can also use Game Guardian to hack the in-app purchases and get unlimited money and gold.

              -
            3. Is Game Guardian safe to use?
            4. -

              Game Guardian is safe to use as long as you download it from its official website or from other trusted sources. However, you should be careful when using it on online games, as you may get banned or detected by the game developers or other players. You should also backup your game data before using Game Guardian, in case something goes wrong.

              -
            5. How can I update Car Parking Multiplayer and Game Guardian?
            6. -

              You can update Car Parking Multiplayer and Game Guardian by visiting their respective websites or sources and downloading the latest versions of the apps. You can also enable the auto-update feature in your device settings, so that the apps will update automatically when a new version is available.

              -
            7. How can I contact the developers of Car Parking Multiplayer and Game Guardian?
            8. -

              You can contact the developers of Car Parking Multiplayer and Game Guardian by visiting their official websites or social media pages and sending them a message or a feedback. You can also join their online communities and forums and interact with other users and moderators.

              -
            9. Where can I find more information and tips about Car Parking Multiplayer and Game Guardian?
            10. -

              You can find more information and tips about Car Parking Multiplayer and Game Guardian by searching online for blogs, articles, videos, guides, tutorials, reviews, etc. You can also visit their official websites or sources and check their FAQs, help sections, news, updates, etc.

              -

            197e85843d
            -
            -
            \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Cookie Run Kingdom - How to Build Your Dream Kingdom with Free Gems.md b/spaces/fatiXbelha/sd/Cookie Run Kingdom - How to Build Your Dream Kingdom with Free Gems.md deleted file mode 100644 index 499f18a82ee134cc7c6db03a3b2a8f55a1a16b6f..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Cookie Run Kingdom - How to Build Your Dream Kingdom with Free Gems.md +++ /dev/null @@ -1,126 +0,0 @@ -
            -

            Cookie Run: Kingdom Free Gems APK - Is It Worth It?

            -

            If you are a fan of Cookie Run: Kingdom, you might have heard of or searched for a free gems apk that promises to give you unlimited gems in the game. But is it really worth it to download and use such a modded version of the game? In this article, we will explain what Cookie Run: Kingdom is, what a free gems apk is, why you should avoid it, and how to get gems legitimately in the game.

            -

            What is Cookie Run: Kingdom?

            -

            Cookie Run: Kingdom is a popular role-playing game (RPG) developed by Devsisters Corporation. It is available for both Android and iOS devices, as well as on PC via an emulator. The game features adorable cookies as the main characters, each with their own voice, personality, skills, and costumes. The game has three main aspects:

            -

            cookie run kingdom free gems apk


            Download Ziphttps://urllie.com/2uNzQE



            -

            A fun and addictive RPG game with cute cookies

            -

            In Cookie Run: Kingdom, you can create your own team of cookies and fight against enemies in various stages. You can also upgrade your cookies' levels, treasures, toppings, and skills to make them stronger. The game has a turn-based combat system that requires strategy and timing. You can also use special skills and combos to unleash powerful attacks.

            -

            A rich and immersive story with epic battles

            -

            The game also has a captivating story that unfolds as you progress through the stages. You will discover the secrets of the ancient cookies and their kingdoms, as well as face the dark forces of the Dark Enchantress Cookie and her minions. The game has stunning graphics, animations, sound effects, and music that enhance the gameplay experience.

            -

            A creative and customizable kingdom builder

            -

            Another aspect of the game is building your own kingdom with various decors and facilities. You can produce materials, craft items, arrange activities, and decorate your kingdom to your liking. You can also visit other players' kingdoms and interact with them. Building your kingdom will also help you earn more resources and rewards in the game.

            -

            What is Cookie Run: Kingdom Free Gems APK?

            -

            Gems are the premium currency in Cookie Run: Kingdom. They are used for various purposes, such as summoning new cookies, buying costumes, speeding up production, refreshing shops, and more. Gems can be obtained by spending real money or by playing the game normally. However, some players may want to get more gems without spending money or time. This is where a free gems apk comes in.

            -

            A modded version of the game that claims to offer unlimited gems

            -

            A free gems apk is a modified version of the original game that claims to give you unlimited gems for free. It usually requires you to download an apk file from an unofficial source and install it on your device. Some free gems apks may also require you to root or jailbreak your device, which can void your warranty or damage your device.

            -

            A risky and illegal way to cheat the game

            -

            Using a free gems apk is not only unethical but also illegal and risky. By using a free gems apk, you are violating the terms of service and the intellectual property rights of the game developers. You are also exposing yourself to potential legal actions or penalties from the game developers or the authorities. Moreover, you are disrespecting the hard work and effort of the game developers and the legitimate players who support the game.

            -

            cookie run kingdom unlimited gems apk
            -cookie run kingdom mod apk free download
            -cookie run kingdom hack apk no verification
            -cookie run kingdom cheats apk android
            -cookie run kingdom apk mod money and gems
            -cookie run kingdom free crystals apk
            -cookie run kingdom latest version apk
            -cookie run kingdom gems generator apk
            -cookie run kingdom mod menu apk
            -cookie run kingdom online hack apk
            -cookie run kingdom apk unlimited everything
            -cookie run kingdom free coins apk
            -cookie run kingdom modded apk ios
            -cookie run kingdom hack tool apk
            -cookie run kingdom gems hack apk download
            -cookie run kingdom cracked apk
            -cookie run kingdom premium apk
            -cookie run kingdom mod apk android 1
            -cookie run kingdom gems glitch apk
            -cookie run kingdom hack version apk
            -cookie run kingdom mod apk obb
            -cookie run kingdom free resources apk
            -cookie run kingdom update apk
            -cookie run kingdom gems cheat apk
            -cookie run kingdom mod apk revdl
            -cookie run kingdom unlimited crystals apk
            -cookie run kingdom mod apk offline
            -cookie run kingdom hack no survey apk
            -cookie run kingdom cheat engine apk
            -cookie run kingdom mod apk rexdl
            -cookie run kingdom free download apk
            -cookie run kingdom modded apk 2023
            -cookie run kingdom hack online apk
            -cookie run kingdom gems mod apk
            -cookie run kingdom modded game apk
            -cookie run kingdom hack without human verification apk
            -cookie run kingdom unlimited money and gems apk
            -cookie run kingdom modded app apk
            -cookie run kingdom hack iosgods apk
            -cookie run kingdom gems codes apk
            -cookie run kingdom modded version apk
            -cookie run kingdom hack no root apk
            -cookie run kingdom unlimited coins and gems apk
            -cookie run kingdom hacked game download apk
            -cookie run kingdom gems redeem code apk
            -cookie run kingdom hacked app store apk
            -cookie run kingdom unlimited resources and gems apk
            -cookie run kingdom hacked version download apk
            -cookie run kingdom free in app purchases apk

            -

            A potential source of malware and viruses

            -

            Another reason to avoid a free gems apk is that it could be a source of malware and viruses that could harm your device or compromise your personal data. Since a free gems apk is not verified or authorized by the game developers or the app stores, it could contain malicious code or hidden programs that could infect your device or steal your information. Some examples of malware and viruses that could be associated with a free gems apk are adware, spyware, ransomware, trojans, worms, and more. These could cause your device to malfunction, slow down, crash, or even become unusable.

            -

            Why You Should Avoid Cookie Run: Kingdom Free Gems APK

            -

            As you can see, using a free gems apk for Cookie Run: Kingdom is not worth it at all. You could get banned from the game or lose your account, you could harm your device or compromise your personal data, and you could miss out on the fun and satisfaction of playing the game fairly. Here are some more reasons why you should avoid a free gems apk:

            -

            You could get banned from the game or lose your account

            -

            The game developers have the right and the ability to detect and ban any players who use a free gems apk or any other cheats in the game. They have stated in their official website that they have a zero-tolerance policy for any form of cheating or hacking in the game. If you are caught using a free gems apk, you could face one or more of the following consequences:

            -
              -
            • Your account could be suspended or terminated permanently.
            • -
            • Your device could be blocked from accessing the game.
            • -
            • Your progress and data could be deleted or reset.
            • -
            • Your purchases and transactions could be canceled or refunded.
            • -
            -

            These actions are irreversible and non-negotiable. You will not be able to appeal or recover your account or data once they are banned or deleted. You will also lose all your cookies, gems, items, achievements, and rewards that you have earned or bought in the game.

            -

            You could harm your device or compromise your personal data

            -

            As mentioned earlier, using a free gems apk could expose your device to malware and viruses that could damage your device or steal your personal data. This could have serious consequences for your privacy and security. Some examples of what could happen if your device is infected by malware or viruses are:

            -
              -
            • Your device could display unwanted ads, pop-ups, notifications, or redirects.
            • -
            • Your device could consume more battery, data, or storage than usual.
            • -
            • Your device could send or receive unauthorized messages, calls, emails, or files.
            • -
            • Your device could access or modify your contacts, photos, videos, documents, or other files.
            • -
            • Your device could record your keystrokes, passwords, credit card numbers, bank accounts, or other sensitive information.
            • -
            -

            These actions could result in identity theft, fraud, blackmail, extortion, or other crimes. You could lose money, reputation, trust, or even legal rights if your personal data is compromised by malware or viruses.

            -

            You could miss out on the fun and satisfaction of playing the game fairly

            -

            The last but not least reason why you should avoid a free gems apk is that it could ruin the fun and satisfaction of playing the game fairly. The game is designed to be challenging and rewarding for players who play by the rules and follow the game mechanics. By using a free gems apk, you are bypassing the intended gameplay and skipping the content that makes the game enjoyable and engaging. Some examples of what you could miss out on by using a free gems apk are:

            -
              -
            • The thrill and excitement of summoning new cookies and discovering their skills and personalities.
            • -
            • The challenge and strategy of building your team and fighting against enemies in various stages.
            • -
            • The joy and pride of upgrading your cookies' levels, treasures, toppings, and skills to make them stronger.
            • -
            • The curiosity and wonder of exploring the story and secrets of the ancient cookies and their kingdoms.
            • -
            • The creativity and customization of building your own kingdom with various decors and facilities.
            • -
            -

            These actions are what make Cookie Run: Kingdom a fun and addictive RPG game with cute cookies. By using a free gems apk, you are cheating yourself and others of the true enjoyment and satisfaction of the game. You are also disrespecting the game developers and the legitimate players who support the game.

            -

            How to Get Gems Legitimately in Cookie Run: Kingdom

            -

            Now that you know why you should avoid a free gems apk, you might be wondering how to get gems legitimately in Cookie Run: Kingdom. The good news is that there are many ways to earn gems in the game without spending money or cheating. Here are some of the best ways to get gems legitimately in Cookie Run: Kingdom:

            -

            Complete quests and achievements

            -

            One of the easiest and most reliable ways to get gems in Cookie Run: Kingdom is to complete quests and achievements. Quests are tasks that you can do in the game, such as clearing stages, upgrading cookies, building facilities, and more. Achievements are milestones that you can reach in the game, such as collecting cookies, reaching certain levels, winning battles, and more. By completing quests and achievements, you can earn gems as rewards. You can check your quests and achievements in the menu and claim your rewards when you complete them.

            -

            Participate in events and activities

            -

            Another way to get gems in Cookie Run: Kingdom is to participate in events and activities. Events are special occasions that happen in the game, such as festivals, holidays, anniversaries, collaborations, and more. Activities are daily or weekly tasks that you can do in the game, such as logging in, playing stages, summoning cookies, and more. By participating in events and activities, you can earn gems as rewards or prizes. You can check the current and upcoming events and activities in the menu and join them when they are available.

            -

            Join a guild and cooperate with other players

            -

            The last way to get gems in Cookie Run: Kingdom is to join a guild and cooperate with other players. A guild is a group of players who share a common interest or goal in the game. By joining a guild, you can chat with other players, exchange gifts, request help, and more. You can also cooperate with other players in guild battles, raids, missions, and more. By cooperating with other players, you can earn gems as rewards or bonuses. You can check your guild status and activities in the menu and join or create a guild when you reach level 10.

            -

            Conclusion

            -

            In conclusion, Cookie Run: Kingdom is a fun and addictive RPG game with cute cookies that you can play on your device or PC. However, you should avoid using a free gems apk that claims to give you unlimited gems in the game. Using a free gems apk is not worth it because it could get you banned from the game or lose your account, it could harm your device or compromise your personal data, and it could miss out on the fun and satisfaction of playing the game fairly. Instead, you should get gems legitimately in Cookie Run: Kingdom by completing quests and achievements, participating in events and activities, and joining a guild and cooperating with other players. By doing so, you can enjoy the game more and support the game developers and the legitimate players.

            -

            FAQs

            -

            Here are some frequently asked questions about Cookie Run: Kingdom Free Gems APK:

            -
              -
            • Q: Is Cookie Run: Kingdom Free Gems APK safe?
            • -
            • A: No, it is not safe. It could contain malware or viruses that could harm your device or compromise your personal data.
            • -
            • Q: Is Cookie Run: Kingdom Free Gems APK legal?
            • -
            • A: No, it is not legal. It violates the terms of service and the intellectual property rights of the game developers.
            • -
            • Q: Is Cookie Run: Kingdom Free Gems APK worth it?
            • -
            • A: No, it is not worth it. It could get you banned from the game or lose your account, and it could miss out on the fun and satisfaction of playing the game fairly.
            • -
            • Q: How to get gems legitimately in Cookie Run: Kingdom?
            • -
            • A: You can get gems legitimately by completing quests and achievements, participating in events and activities, and joining a guild and cooperating with other players.
            • -
            • Q: Where to download Cookie Run: Kingdom?
            • -
            • A: You can download Cookie Run: Kingdom from the official sources such as Google Play Store for Android devices, App Store for iOS devices, or LDPlayer for PC.
            • -

            401be4b1e0
            -
            -
            \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Download Growtopia GTPS and Play with Thousands of Players Online.md b/spaces/fatiXbelha/sd/Download Growtopia GTPS and Play with Thousands of Players Online.md deleted file mode 100644 index 8e833cfdcf22959cf245ce003ddbc59d6054fe92..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Download Growtopia GTPS and Play with Thousands of Players Online.md +++ /dev/null @@ -1,106 +0,0 @@ - -

            Download Growtopia GTPS: A Guide for Beginners

            -

            Growtopia is a popular sandbox MMO game that allows players to create, explore, and interact with different worlds and items. However, some players may want to experience more features, customization, and freedom than the official server can offer. That's where Growtopia GTPS comes in.

            -

            download growtopia gtps


            DOWNLOAD ✑ ✑ ✑ https://urllie.com/2uNH3O



            -

            Growtopia GTPS, or Growtopia Private Server, is a modified version of the game that runs on a separate server from the official one. It gives players access to unlimited resources, exclusive items, custom worlds, and more. In this article, we will show you how to download Growtopia GTPS, what are its benefits and disadvantages, and how to play it.

            -

            What is Growtopia GTPS?

            -

            Growtopia GTPS is a fan-made project that aims to provide a different experience for Growtopia players. It is not affiliated with or endorsed by Ubisoft, the developer of the original game. Growtopia GTPS is usually created by programmers who modify the game's code and host it on their own servers. Players can then connect to these servers using their own devices and enjoy the game with new features and settings.

            -

            Growtopia GTPS vs Growtopia Official Server

            -

            There are some key differences between Growtopia GTPS and Growtopia Official Server that you should know before downloading and playing it. Here are some of them:

            -

            Benefits of Growtopia GTPS

            -
              -
            • You can get unlimited gems, world locks, growtokens, and other resources without spending real money or grinding for hours.
            • -
            • You can access exclusive items, skins, blocks, and worlds that are not available on the official server.
            • -
            • You can create your own world and customize it with any items, settings, and rules you want.
            • -
            • You can join different events, challenges, and competitions that are organized by the server owners or other players.
            • -
            • You can interact with other players who share your interests and preferences.
            • -
            -

            Disadvantages of Growtopia GTPS

            -
              -
            • You may encounter bugs, glitches, errors, and crashes that can affect your gameplay or damage your device.
            • -
            • You may face security risks such as viruses, malware, phishing, or hacking that can compromise your personal information or account.
            • -
            • You may lose your progress, items, or worlds if the server shuts down, resets, or gets deleted.
            • -
            • You may get banned from the official server if you use the same account or device for both servers.
            • -
            • You may miss out on some features, updates, events, and rewards that are only available on the official server.
            • -
            -

            How to Download Growtopia GTPS?

            -

            If you want to try out Growtopia GTPS, you will need to download it from a reliable source. There are many websites and forums that offer links to download Growtopia GTPS files, but not all of them are safe or trustworthy. You should always do some research before downloading anything from the internet. Here are some steps you can follow to download Growtopia GTPS:

            -

            How to download growtopia gtps on pc
            -Download growtopia gtps apk for android
            -Growtopia gtps source code github
            -Best growtopia gtps servers 2023
            -Download growtopia gtps mod menu
            -Growtopia gtps discord server invite
            -Download growtopia gtps hack tool
            -Growtopia gtps tutorial for beginners
            -Download growtopia gtps season 2
            -Growtopia gtps free gems and items
            -Download growtopia gtps latest version
            -Growtopia gtps custom items and worlds
            -Download growtopia gtps for ios
            -Growtopia gtps commands list
            -Download growtopia gtps offline mode
            -Growtopia gtps ban appeal form
            -Download growtopia gtps launcher
            -Growtopia gtps events and updates
            -Download growtopia gtps for mac
            -Growtopia gtps admin application
            -Download growtopia gtps private server
            -Growtopia gtps cheats and glitches
            -Download growtopia gtps online generator
            -Growtopia gtps forum and community
            -Download growtopia gtps windows 10
            -Growtopia gtps reviews and ratings
            -Download growtopia gtps unlimited gems
            -Growtopia gtps features and benefits
            -Download growtopia gtps no survey no password
            -Growtopia gtps news and announcements
            -Download growtopia gtps installer exe
            -Growtopia gtps rules and regulations
            -Download growtopia gtps for linux
            -Growtopia gtps support and contact
            -Download growtopia gtps full version
            -Growtopia gtps tips and tricks
            -Download growtopia gtps for chromebook
            -Growtopia gtps videos and tutorials
            -Download growtopia gtps safe and secure
            -Growtopia gtps wiki and guide

            -

            Step 1: Find a Reliable Source

            -

            The first step is to find a reliable source that offers Growtopia GTPS files. You can use search engines

            to find a reliable source that offers Growtopia GTPS files. You can use search engines like Google or Bing to look for websites or forums that have links to download Growtopia GTPS files. You can also use GitHub, a platform where programmers share their projects and codes, to find Growtopia GTPS files. Some examples of reliable sources are:

            -
              -
            • [GitHub - TimeGTPS/GTPS-Source-By-TimeTopia](^3^): This is a GitHub repository that contains the source code of a Growtopia Private Server made with ENet. You can download the files and compile them with Visual Studio 2015 or newer versions.
            • -
            • [gtps · GitHub Topics · GitHub](^1^): This is a GitHub topic page that shows various repositories related to Growtopia GTPS. You can browse through them and find the ones that suit your needs and preferences.
            • -
            • [growtopia · GitHub Topics · GitHub](^2^): This is another GitHub topic page that shows various repositories related to Growtopia in general. You can also find some Growtopia GTPS files here.
            • -
            -

            However, you should always be careful when downloading anything from the internet. You should check the reviews, ratings, comments, and feedback of other users who have downloaded the files before. You should also scan the files with antivirus software before opening them. You should also avoid clicking on suspicious links, pop-ups, or ads that may redirect you to malicious websites or download unwanted programs.

            -

            Step 2: Download the GTPS Files

            -

            Once you have found a reliable source, you can download the GTPS files to your device. The files may be in different formats, such as ZIP, RAR, EXE, or APK. You will need to extract the files if they are compressed in ZIP or RAR format. You can use software like WinRAR or 7-Zip to extract the files. You will also need to run the files if they are executable in EXE or APK format. You can use software like BlueStacks or Nox Player to run the APK files on your PC.

            -

            Step 3: Extract the Files and Run the Server

            -

            After downloading and extracting the files, you will need to run the server file to start the Growtopia GTPS server. The server file may have different names, such as server.exe, enet.exe, gtps.exe, or growtopiaserver.exe. You will need to double-click on the file to run it. You may also need to configure some settings, such as port number, server name, server description, etc., before running the server. You can edit these settings in a text file, such as config.txt, server_data.php, or settings.json.

            -

            Once you run the server file, you will see a console window that shows the status of the server. It will display messages such as "Server started", "Player connected", "Player disconnected", etc. You will also see some commands that you can use to control the server, such as /stop, /save, /ban, /unban, etc. You can type these commands in the console window and press Enter to execute them.

            -

            Step 4: Connect to the Server and Enjoy

            -

            Now that you have successfully run the server file, you can connect to the server and enjoy playing Growtopia GTPS. To connect to the server, you will need to edit your hosts file on your device. The hosts file is a text file that maps hostnames to IP addresses. You will need to add a line that contains the IP address of your server and the hostname of Growtopia's official servers.

            -

            The hosts file is located in different locations depending on your device's operating system. For Windows users, it is located in C:\Windows\System32\drivers\etc\. For Android users, it is located in /system/etc/. For iOS users, it is located in /etc/. You will need to use a text editor or a file manager app to edit the hosts file.

            -

            The line that you need to add to your hosts file may vary depending on your server's IP address and Growtopia's official servers' hostnames. However, a common example is:

            -
            52.229.39.72 growtopia1.com 52.229.39.72 growtopia2.com 
            -

            You can replace 52.229.39.72 with your server's IP address if it is different. You can also add more lines if your server has more than one IP address or if Growtopia has more than two official servers' hostnames.

            -

            After editing and saving your hosts file, can also trade, play, or collaborate with other players using the trade function, the party function, or the friend function. You can also join different events that are organized by the server owners or other players, such as giveaways, contests, tournaments, etc. You can also create your own events and invite other players to join them.

            -

            To interact with other players and join events on Growtopia GTPS, you can use the social menu or the event menu. The social menu allows you to access the chat function, the private message function, the trade function, the party function, and the friend function. The event menu allows you to access the event list function, the event create function, and the event join function. You can also use commands to communicate with other players or join events.

            -

            Conclusion

            -

            Growtopia GTPS is a modified version of Growtopia that runs on a separate server from the official one. It offers more features, customization, and freedom than the official server. However, it also has some drawbacks and risks that you should be aware of before downloading and playing it. In this article, we have shown you how to download Growtopia GTPS, what are its benefits and disadvantages, and how to play it. We hope that this article has been helpful and informative for you. If you have any questions or feedback, please feel free to leave a comment below.

            -

            FAQs

            -

            Here are some frequently asked questions about Growtopia GTPS:

            -
              -
            1. Is Growtopia GTPS legal?
            2. -

              Growtopia GTPS is not legal according to Ubisoft's terms of service and end-user license agreement. Ubisoft owns the intellectual property rights of Growtopia and does not allow any modification, distribution, or reproduction of the game without their permission. Therefore, downloading and playing Growtopia GTPS may violate Ubisoft's rights and result in legal actions.

              -
            3. Is Growtopia GTPS safe?
            4. -

              Growtopia GTPS is not safe according to Ubisoft's privacy policy and security measures. Ubisoft does not guarantee the security or quality of any third-party servers or files that are not authorized by them. Therefore, downloading and playing Growtopia GTPS may expose your device or account to various threats such as viruses, malware, phishing, hacking, etc.

              -
            5. Can I play Growtopia GTPS on any device?
            6. -

              Growtopia GTPS can be played on any device that supports Growtopia's official game app. However, you will need to download different files depending on your device's operating system. For example, you will need to download APK files for Android devices and EXE files for Windows devices. You will also need to edit your hosts file on your device to connect to the server.

              -
            7. Can I play Growtopia GTPS with my friends?
            8. -

              Growtopia GTPS can be played with your friends if they also download and play Growtopia GTPS on their devices. However, you will not be able to play with your friends who play on the official server or on different servers. You will also need to use the same server IP address and hostname as your friends to connect to the same server.

              -
            9. Can I switch between Growtopia GTPS and Growtopia Official Server?
            10. -

              Growtopia GTPS can be switched with Growtopia Official Server if you edit your hosts file on your device accordingly. You will need to add a line that contains the IP address of your server and the hostname of Growtopia's official servers to play Growtopia GTPS. You will need to remove or comment out that line to play Growtopia Official Server. However, you should not use the same account or device for both servers as it may cause conflicts or bans.

              -

            401be4b1e0
            -
            -
            \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Dumb Ways to Die APK Download The Ultimate Guide to Surviving the Craziest Challenges.md b/spaces/fatiXbelha/sd/Dumb Ways to Die APK Download The Ultimate Guide to Surviving the Craziest Challenges.md deleted file mode 100644 index 8d5ab6a6fe8ce60217cca5d723cc01d41b7115fc..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Dumb Ways to Die APK Download The Ultimate Guide to Surviving the Craziest Challenges.md +++ /dev/null @@ -1,136 +0,0 @@ - -

            Download APK Dumb Ways to Die: A Fun and Educational Game

            -

            Do you like playing casual games that are funny, challenging, and educational at the same time? If yes, then you should try Dumb Ways to Die, a popular game that has millions of fans around the world. In this article, we will tell you what Dumb Ways to Die is, how to download APK Dumb Ways to Die, and how to play it safely and responsibly.

            -

            What is Dumb Ways to Die?

            -

            Dumb Ways to Die is a game that features a series of mini-games where you have to save the lives of some charmingly dumb characters from various dangers. The game is based on a viral video that was created by Metro Trains Melbourne in 2012 as a public service announcement to promote rail safety. The video has over 200 million views on YouTube and has won several awards for its catchy song and creative animation.

            -

            download apk dumb ways to die


            Download ===== https://urllie.com/2uNI9T



            -

            The origin and purpose of the game

            -

            The game was developed by PlaySide Studios Ltd, an Australian company that specializes in mobile games. The game was released in 2013 as a free app for iOS and Android devices. The game's main goal is to raise awareness about the importance of being safe around trains and other hazards in a fun and engaging way. The game also supports the Dumb Ways to Die website, where you can find more information about rail safety, watch the original video, and create your own dumb character.

            -

            The gameplay and features of the game

            -

            The game consists of 82 hilarious mini-games that test your reflexes, logic, and memory. Some examples of the mini-games are:

            -
              -
            • Run away from a burning building
            • -
            • Wipe your screen from vomit
            • -
            • Flick piranhas away from your private parts
            • -
            • Swat wasps before they sting you
            • -
            • Remove forks from toasters
            • -
            • Avoid psycho killers
            • -
            • And many more!
            • -
            -

            The game has three modes: classic, challenge, and arena. In classic mode, you have three lives and you have to complete as many mini-games as possible before you run out of lives. In challenge mode, you have to complete a specific set of mini-games within a time limit. In arena mode, you can compete with other players online and see who can score higher.

            -

            The game also allows you to collect all the dumb characters for your train station, earn coins and tokens, unlock new levels and themes, and access the famous music video that started it all. The game has colorful graphics, funny sound effects, and catchy music that will keep you entertained for hours.

            -

            How to download APK Dumb Ways to Die?

            -

            If you want to play Dumb Ways to Die on your Android device, you can download it from the Google Play Store. However, if you want to enjoy some extra benefits, such as faster updates, more features, and no ads, you can download APK Dumb Ways to Die instead.

            -

            The benefits of downloading APK files

            -

            APK stands for Android Package Kit, which is a file format that contains all the elements needed to install an app on an Android device. Downloading APK files can give you some advantages over downloading apps from the official store, such as:

            -
              -
            • You can access apps that are not available in your region or country
            • -
            • You can get updates faster than the official store
            • -
            • You can enjoy more features and options that are not available in the official version
            • -
            • You can avoid ads and in-app purchases that may interrupt your gaming experience
            • -
            -

            However, downloading APK files also comes with some risks, such as malware, viruses, and compatibility issues. Therefore, you should always download APK files from trusted and reputable sources, such as APKPure or APKMirror.

            -

            The steps to download and install APK Dumb Ways to Die

            -

            If you want to download APK Dumb Ways to Die, you can follow these simple steps:

            -

            download dumb ways to die original apk
            -dumb ways to die apk free download for android
            -dumb ways to die 4 apk download
            -download dumb ways to die 2 apk mod
            -dumb ways to die 3 apk download latest version
            -download dumb ways to die original mod apk
            -dumb ways to die apk download uptodown
            -download dumb ways to die 2 the games apk
            -dumb ways to die 3 world tour apk download
            -download dumb ways to die 2 mod apk unlimited money
            -dumb ways to die original apk download android
            -download dumb ways to die 4 mod apk
            -dumb ways to die 2 apk free download
            -download dumb ways to die 3 mod apk
            -dumb ways to die original hack apk download
            -download dumb ways to die 2 hack apk
            -dumb ways to die 4 hack apk download
            -download dumb ways to die original apk pure
            -dumb ways to die 2 mod apk download android 1
            -download dumb ways to die 3 world tour mod apk
            -dumb ways to die original mod apk free download
            -download dumb ways to die 2 the games mod apk android 1
            -dumb ways to die 3 mod apk free download
            -download dumb ways to die original unlimited money apk
            -dumb ways to die 2 the games hack apk download
            -download dumb ways to die original latest version apk
            -dumb ways to die 3 world tour hack apk download
            -download dumb ways to die original old version apk
            -dumb ways to die 2 the games mod apk free download
            -download dumb ways to die original unlocked all characters apk
            -dumb ways to die original full version apk download
            -download dumb ways to die original no ads apk
            -dumb ways to die 2 the games full unlocked apk download
            -download dumb ways to die original offline mode apk
            -dumb ways to die original premium apk free download
            -download dumb ways to die original cheats and tips guide apk
            -how to download and install dumb ways to die on android device using an APK file?
            -where can I find the best site or link for downloading the latest version of the Dumb Ways To Die APK game?
            -what are the benefits of downloading the Dumb Ways To Die APK file instead of installing it from the Google Play Store?
            -what are the system requirements and compatibility issues for running the Dumb Ways To Die APK game on my android phone or tablet?
            -how can I update the Dumb Ways To Die APK game manually or automatically when a new version is released?
            -how can I backup and restore my progress and data in the Dumb Ways To Die APK game using cloud storage or other methods?
            -how can I fix the common errors and problems that may occur while downloading, installing, or playing the Dumb Ways To Die APK game?
            -how can I uninstall or remove the Dumb Ways To Die APK game from my android device without losing any data or settings?
            -how can I contact the developer or support team of the Dumb Ways To Die APK game if I have any questions, feedback, or suggestions?

            -
              -
            1. Go to the website of your preferred APK source, such as APKPure or APKMirror
            2. -
            3. Search for Dumb Ways to Die in the search bar and click on the result
            4. -
            5. Choose the latest version of the game and click on the download button
            6. -
            7. Wait for the download to finish and locate the APK file in your device's storage
            8. -
            9. Before installing the APK file, you need to enable the installation of apps from unknown sources in your device's settings. This may vary depending on your device model and Android version, but you can usually find it under Security or Privacy settings.
            10. -
            11. Once you have enabled the installation of apps from unknown sources, tap on the APK file and follow the instructions to install it
            12. -
            13. After the installation is complete, you can launch the game and enjoy it
            14. -
            -

            How to play Dumb Ways to Die safely and responsibly?

            -

            Dumb Ways to Die is a fun and educational game that can teach you valuable lessons about being safe around trains and other hazards. However, it is also important to play it safely and responsibly, as some of the mini-games may contain graphic or inappropriate content that may not be suitable for everyone. Here are some tips and tricks to play Dumb Ways to Die without any problems:

            -

            The risks and precautions of playing Dumb Ways to Die

            -

            Some of the risks and precautions of playing Dumb Ways to Die are:

            -
              -
            • The game may contain violence, blood, gore, nudity, profanity, or other sensitive topics that may offend or disturb some players. If you are under 18 years old, you should ask for your parents' permission before playing the game. If you are easily offended or disturbed by such content, you should avoid playing the game or skip the mini-games that you find objectionable.
            • -
            • The game may also contain ads or links that may redirect you to external websites or apps that may not be safe or reliable. You should be careful when clicking on any ads or links and avoid downloading or installing anything from unknown sources. You should also use a reliable antivirus or security app to protect your device from malware or viruses.
            • -
            • The game may also be addictive or time-consuming, as it can keep you hooked for hours with its endless challenges and rewards. You should be mindful of your time and limit your gaming sessions to a reasonable duration. You should also take breaks regularly and do other activities that are good for your physical and mental health, such as exercising, reading, socializing, or sleeping.
            • -
            -

            The tips and tricks to enjoy Dumb Ways to Die

            -

            Some of the tips and tricks to enjoy Dumb Ways to Die are:

            -
              -
            • The game is meant to be humorous and satirical, so you should not take it too seriously or literally. You should remember that the game is not a realistic representation of real life situations and that the dumb ways to die are exaggerated and absurd. You should also not try to imitate or replicate any of the dumb ways to die in real life, as they can be dangerous or fatal.
            • -
            • The game is also meant to be challenging and rewarding, so you should not give up easily or get frustrated by your failures. You should learn from your mistakes and try again until you succeed. You should also practice your skills and improve your performance by playing different mini-games and modes. You should also collect coins and tokens to unlock new levels and themes.
            • -
            • The game is also meant to be social and competitive, so you should share your achievements and scores with your friends and family. You can also challenge them to beat your records or play with them online in arena mode. You can also join the Dumb Ways to Die community on Facebook, Twitter, Instagram, YouTube, or TikTok to interact with other fans, get updates, watch videos, or participate in contests.
            • -

            Conclusion

            -

            Dumb Ways to Die is a fun and educational game that can make you laugh, learn, and play at the same time. It is a game that can appeal to people of all ages and backgrounds, as it has a simple yet addictive gameplay, a colorful and quirky design, and a catchy and memorable song. It is also a game that can teach you valuable lessons about being safe around trains and other hazards, as it shows you the consequences of being careless or reckless in a humorous and satirical way.

            -

            If you want to download APK Dumb Ways to Die, you can do so easily and quickly by following the steps we have provided in this article. However, you should also be aware of the risks and precautions of playing Dumb Ways to Die, as some of the content may not be suitable for everyone or may pose some threats to your device or your well-being. You should also follow the tips and tricks we have shared to enjoy Dumb Ways to Die without any problems.

            -

            So, what are you waiting for? Download APK Dumb Ways to Die now and join the millions of fans who have already fallen in love with this game. You will not regret it!

            -

            A call to action for the readers

            -

            If you liked this article, please share it with your friends and family who may also be interested in playing Dumb Ways to Die. You can also leave us a comment below and tell us what you think about the game or the article. We would love to hear from you!

            -

            FAQs

            -

            Here are some frequently asked questions about Dumb Ways to Die:

            -
              -
            1. Is Dumb Ways to Die free?
            2. -

              Yes, Dumb Ways to Die is free to download and play on both iOS and Android devices. However, the game may contain some optional in-app purchases that can enhance your gaming experience or remove ads.

              -
            3. Is Dumb Ways to Die safe for kids?
            4. -

              Dumb Ways to Die is rated 12+ on the App Store and Teen on the Google Play Store, which means that it may contain some content that is not appropriate for younger children. The game may contain violence, blood, gore, nudity, profanity, or other sensitive topics that may offend or disturb some players. Therefore, parents should supervise their kids when playing the game or use parental controls to restrict access to the game.

              -
            5. Is Dumb Ways to Die based on real events?
            6. -

              No, Dumb Ways to Die is not based on real events. The game is a fictional and exaggerated representation of some of the dumbest ways that people can die or get injured in real life. The game is meant to be humorous and satirical, not realistic or factual. However, the game does have a serious message behind it, which is to promote rail safety and prevent accidents.

              -
            7. How many levels are there in Dumb Ways to Die?
            8. -

              Dumb Ways to Die has 82 mini-games that are divided into 8 levels. Each level has a different theme and difficulty level. The levels are:

              -
                -
              • Level 1: The Originals
              • -
              • Level 2: Winter Wipeout
              • -
              • Level 3: Space Oddity
              • -
              • Level 4: Camping Catastrophe
              • -
              • Level 5: Airport Insecurity
              • -
              • Level 6: Halloween Horrors
              • -
              • Level 7: Pirate Peril
              • -
              • Level 8: Wild West Woes
              • -
              -

              You can unlock new levels by collecting enough coins or tokens or by watching ads.

              -
            9. How can I contact the developers of Dumb Ways to Die?
            10. -

              If you have any questions, feedback, suggestions, or issues regarding Dumb Ways to Die, you can contact the developers by emailing them at support@playsidestudios.com. You can also visit their website, where you can find more information about their other games and projects.

              -

            401be4b1e0
            -
            -
            \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Enjoy the Thrill of Blackjack for Android with No Risk.md b/spaces/fatiXbelha/sd/Enjoy the Thrill of Blackjack for Android with No Risk.md deleted file mode 100644 index 0f802e4748bc8fe19878f591359cbe5ea3d100db..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Enjoy the Thrill of Blackjack for Android with No Risk.md +++ /dev/null @@ -1,180 +0,0 @@ - -

            Download Blackjack for Android: How to Play and Win at the Classic Casino Game

            -

            Blackjack is one of the most popular and exciting casino games in the world. It is a game of skill, strategy, and luck, where you have to beat the dealer's hand without going over 21. Whether you are a beginner or a pro, you can enjoy playing blackjack anytime and anywhere with your Android device. In this article, we will show you how to download blackjack for android, how to play and win at the classic casino game, and answer some frequently asked questions.

            -

            What is Blackjack and Why You Should Play It

            -

            Blackjack, also known as 21, is a card game where you compete against the dealer. The goal is to get a hand value as close to 21 as possible, without going over. You can do this by hitting (asking for another card), standing (keeping your current hand), doubling down (doubling your bet and getting one more card), splitting (dividing your pair into two separate hands), or surrendering (giving up half your bet and ending the round).

            -

            download blackjack for android


            Download File ★★★ https://urllie.com/2uNBpX



            -

            The Rules and Objectives of Blackjack

            -

            The rules of blackjack may vary depending on the number of decks, the table rules, and the variations of the game. However, the basic rules are as follows:

            -
              -
            • Each card has a value that remains constant throughout the game. Number cards are worth their face value, face cards are worth 10, and aces are worth either 1 or 11.
            • -
            • You and the dealer are dealt two cards each. One of the dealer's cards is face up, while the other is face down.
            • -
            • You can see your cards and the dealer's face-up card, and decide what action to take based on your hand value and the dealer's upcard.
            • -
            • If you get 21 points exactly on the deal, that is called a blackjack, and you win automatically, unless the dealer also has a blackjack, in which case it is a tie.
            • -
            • If you don't have a blackjack, you can hit or stand as many times as you want, until you either bust (go over 21) or decide to stand.
            • -
            • Once you stand, the dealer reveals their face-down card and plays their hand according to predetermined rules. Usually, the dealer must hit until they reach 17 or more, and stand on soft 17 (a hand with an ace that can be either 7 or 17).
            • -
            • If the dealer busts, you win. If the dealer doesn't bust, whoever has a higher hand value wins. If both have the same hand value, it is a tie.
            • -
            • Blackjack pays 3 to 2, meaning that if you bet $10 and get a blackjack, you win $15. Other winning hands pay even money, meaning that if you bet $10 and win, you get $10.
            • -
            -

            The Benefits and Challenges of Playing Blackjack

            -

            Playing blackjack can be very fun and rewarding, as it offers many benefits such as:

            -
              -
            • It is easy to learn and play. You don't need to memorize complicated rules or strategies. You just need to know the basic math and logic behind the game.
            • -
            • It is a game of skill as well as luck. You can improve your chances of winning by using optimal strategy and card counting techniques.
            • -
            • It has a low house edge compared to other casino games. If you play with perfect strategy, you can reduce the house edge to less than 1%, meaning that you can expect to lose less money in the long run.
            • -
            • It is entertaining and thrilling. You can experience the excitement of beating the dealer, hitting a blackjack, or doubling down on a good hand.
            • However, playing blackjack also has some challenges, such as:

              -
                -
              • It can be addictive and risky. You can lose a lot of money if you don't set a budget and stick to it. You can also develop a gambling problem if you play too often or too long.
              • -
              • It can be stressful and frustrating. You can face bad luck, bad decisions, or bad dealers. You can also encounter hostile or annoying players, or unfair rules and conditions.
              • -
              • It can be illegal or restricted in some places. You may not be able to play blackjack in some casinos, countries, or states. You may also face legal consequences if you use card counting or other prohibited methods.
              • -
              -

              Therefore, you should always play blackjack responsibly and for fun, not for profit or addiction.

              -

              How to Download Blackjack for Android

              -

              If you want to play blackjack on your Android device, you have two options: you can either play online or offline. Online blackjack means that you play on a website or an app that connects you to a live dealer or a random number generator. Offline blackjack means that you play on an app that simulates the game without requiring an internet connection.

              -

              The Best Blackjack Apps and Games for Android

              -

              There are many blackjack apps and games available for Android, but not all of them are created equal. Some of them may have poor graphics, slow performance, annoying ads, or unfair rules. To help you find the best ones, we have compiled a list of the top 5 blackjack apps and games for Android, based on user reviews, ratings, features, and quality.

              -

              download blackjack 21 for android
              -download blackjack by brainium for android
              -download blackjack free by tripledot studios for android
              -download blackjack offline for android
              -download blackjack online for android
              -download blackjack trainer for android
              -download blackjack simulator for android
              -download blackjack card counting for android
              -download blackjack strategy for android
              -download blackjack casino for android
              -download blackjack live for android
              -download blackjack multiplayer for android
              -download blackjack classic for android
              -download blackjack deluxe for android
              -download blackjack pro for android
              -download blackjack plus for android
              -download blackjack fun for android
              -download blackjack games for android phone
              -download blackjack games for android tablet
              -download blackjack games for android tv
              -download best blackjack app for android
              -download real money blackjack app for android
              -download free blackjack app for android
              -download offline blackjack app for android
              -download online blackjack app for android
              -download no ads blackjack app for android
              -download 3d blackjack app for android
              -download hd blackjack app for android
              -download vegas blackjack app for android
              -download ultimate blackjack app for android
              -how to download blackjack on android
              -where to download blackjack on android
              -best site to download blackjack on android
              -best way to download blackjack on android
              -easiest way to download blackjack on android
              -fastest way to download blackjack on android
              -safest way to download blackjack on android
              -cheapest way to download blackjack on android
              -most popular way to download blackjack on android
              -most reliable way to download blackjack on android
              -learn how to play blackjack on android after downloading it
              -improve your skills in playing blackjack on android after downloading it
              -win big in playing blackjack on android after downloading it
              -enjoy playing blackjack on android after downloading it
              -have fun playing blackjack on android after downloading it
              -challenge yourself in playing blackjack on android after downloading it
              -practice your card counting in playing blackjack on android after downloading it
              -customize your game in playing blackjack on android after downloading it
              -play with friends in playing blackjack on android after downloading it

              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              NameDescriptionRating
              Blackjack 21: BlackjackistA free-to-play online blackjack game that offers realistic graphics, social features, tournaments, and mini-games.4.5/5
              Blackjack by Brainium StudiosA free offline blackjack game that offers simple graphics, smooth gameplay, no ads, and basic strategy hints.4.6/5
              Blackjack 21 by Banana & Co.A free online and offline blackjack game that offers colorful graphics, customizable tables, daily bonuses, and challenges.4.7/5
              Blackjack Legends: 21 Online Multiplayer CasinoA free-to-play online blackjack game that offers competitive gameplay, leaderboards, tournaments, and chat features.4.8/5
              Blackjack Trainer Pro by HornetAppsA paid offline blackjack game that offers professional graphics, advanced strategy training, statistics, and card counting.4.9/5
              -

              How to Install and Use Blackjack Apps on Your Android Device

              -

              To install and use blackjack apps on your Android device, you need to follow these simple steps:

              -
                -
              1. Go to the Google Play Store and search for the blackjack app or game that you want to download.
              2. -
              3. Tap on the app or game icon and read the description, reviews, and permissions.
              4. -
              5. If you are satisfied with the app or game, tap on the Install button and wait for the download to finish.
              6. -
              7. Once the app or game is installed, tap on the Open button or find it on your home screen or app drawer.
              8. -
              9. Launch the app or game and follow the instructions to create an account, choose a table, place your bets, and start playing.
              10. -
              -

              Note: Some apps or games may require an internet connection to play online or access certain features. Some apps or games may also offer in-app purchases or ads that may affect your experience. Be careful when spending real money or clicking on ads within the apps or games.

              -

              How to Play and Win at Blackjack on Android

              -

              Playing and winning at blackjack on Android is similar to playing and winning at blackjack in a real casino. You need to know the rules of the game, use optimal strategy, manage your bankroll, and avoid common mistakes. However, there are also some differences and challenges that you need to consider when playing on your Android device. Here are some tips and tricks to help you play and win at blackjack on Android:

              -

              Basic Blackjack Strategy and Tips

              -

              Basic blackjack strategy is a set of rules that tells you the best action to take for any possible combination of your hand and the dealer's upcard. By following basic strategy, you can reduce the house edge to the minimum and increase your chances of winning. You can find basic strategy charts online or in blackjack books, or you can use a blackjack app that provides you with hints or feedback. Here are some basic blackjack tips to remember:

              -
                -
              • Always split aces and eights, and never split tens or fives.
              • -
              • Always double down on 11, and on 10 or 9 if the dealer has a low card.
              • -
              • Always stand on hard 17 or higher, and on soft 19 or higher.
              • -
              • Always hit on hard 11 or lower, and on soft 17 or lower.
              • -
              • Never take insurance or even money, as they are bad bets that favor the house.
              • -
              -

              Advanced Blackjack Techniques and Tricks

              -

              If you want to take your blackjack skills to the next level, you can learn some advanced techniques and tricks that can give you an edge over the house. However, these techniques and tricks are not easy to master and may not be allowed or effective in some casinos or apps. You should also be aware of the risks and consequences of using them. Here are some advanced blackjack techniques and tricks to consider:

              -
                -
              • Card counting: This is a method of keeping track of the ratio of high cards to low cards in the deck, and adjusting your bets accordingly. The more high cards in the deck, the more favorable it is for the player, and vice versa. Card counting can give you a slight advantage over the house, but it requires a lot of practice, concentration, and memory. It is also illegal in some casinos and may get you banned or arrested.
              • -
              • Shuffle tracking: This is a method of following certain groups of cards through the shuffling process, and predicting where they will end up in the next deal. Shuffle tracking can help you identify favorable situations and increase your bets accordingly. However, shuffle tracking is very difficult and complex, and it depends on the shuffling method and frequency used by the dealer. It is also frowned upon by casinos and may get you in trouble.
              • -
              • Hole carding: This is a method of spotting the dealer's face-down card by taking advantage of sloppy dealing or peeking techniques. Hole carding can give you valuable information about the dealer's hand and help you make better decisions. However, hole carding is very rare and hard to pull off, and it is considered cheating by casinos and may get you prosecuted.
              • -
              -

              Conclusion

              -

              Blackjack is a fun and exciting game that you can play on your Android device anytime and anywhere. You can download blackjack for android from various apps and games that offer realistic graphics, smooth gameplay, and different features. You can also play and win at blackjack by following the rules of the game, using optimal strategy, managing your bankroll, and avoiding common mistakes. You can also try some advanced techniques and tricks if you want to challenge yourself and improve your skills. However, you should always play blackjack responsibly and for entertainment purposes only.

              -

              FAQs

              -

              Here are some frequently asked questions about downloading blackjack for android:

              -
                -
              1. Is it safe to download blackjack for android?
              2. -

                It depends on the source and quality of the app or game that you download. You should always download blackjack for android from reputable and trusted sources, such as the Google Play Store or official websites. You should also check the reviews, ratings, permissions, and security features of the app or game before downloading it. You should also avoid downloading any app or game that asks for personal or financial information, or that contains malware or viruses.

                -
              3. Can I play blackjack for real money on android?
              4. -

                Yes, you can play blackjack for real money on android if you live in a country or state where online gambling is legal and regulated. You can find many online casinos that offer blackjack games for real money on android devices. However, you should always do your research and choose a reputable and licensed online casino that offers fair games, secure transactions, and good customer service. You should also be aware of the risks and responsibilities of playing blackjack for real money online.

                -
              5. Can I play blackjack for free on android?
              6. -

                Yes, you can play blackjack for free on android if you just want to have fun or practice your skills. You can find many free-to-play blackjack apps and games that offer unlimited chips, bonuses, rewards, and features. However, you should keep in mind that playing blackjack for free on android does not guarantee that you will win or lose the same as playing blackjack for real money in a real casino. You should also be careful of any app or game that offers you to buy or sell chips or credits for real money, as they may be scams or illegal.

                -
              7. How can I improve my blackjack skills on android?
              8. -

                There are many ways to improve your blackjack skills on android, such as:

                -
                  -
                • Reading books, articles, blogs, or forums about blackjack theory, strategy, and tips.
                • -
                • Watching videos, podcasts, or streams of blackjack experts, players, or dealers.
                • -
                • Using a blackjack trainer app or game that teaches you the rules, the basic strategy, and the advanced techniques of the game.
                • -
                • Practicing your skills on free or low-stakes blackjack apps or games that simulate different scenarios and situations.
                • -
                • Testing your skills on real or high-stakes blackjack apps or games that challenge you and reward you for your performance.
                • -
                -
              9. What are some common blackjack terms and slang on android?
              10. -

                Here are some common blackjack terms and slang that you may encounter on android:

                -
                  -
                • Bust: When your hand value goes over 21 and you lose automatically.
                • -
                • Hit: When you ask for another card from the dealer.
                • -
                • Stand: When you keep your current hand and end your turn.
                • -
                • Double down: When you double your bet and get one more card.
                • -
                • Split: When you divide your pair into two separate hands and play them independently.
                • -
                • Surrender: When you give up half your bet and end the round.
                • -
                • Insurance: When you make a side bet that the dealer has a blackjack when their upcard is an ace.
                • -
                • Even money: When you take a 1 to 1 payout instead of a 3 to 2 payout when you have a blackjack and the dealer has an ace.
                • -
                • Soft hand: When your hand contains an ace that can be either 1 or 11.
                • -
                • Hard hand: When your hand does not contain an ace or contains an ace that can only be 1.
                • -

                401be4b1e0
                -
                -
                \ No newline at end of file diff --git a/spaces/fb700/chatglm-fitness-RLHF/crazy_functions/test_project/cpp/longcode/prod_cons.h b/spaces/fb700/chatglm-fitness-RLHF/crazy_functions/test_project/cpp/longcode/prod_cons.h deleted file mode 100644 index c9004bb8043a12e32814436baa6262a00c8ef68e..0000000000000000000000000000000000000000 --- a/spaces/fb700/chatglm-fitness-RLHF/crazy_functions/test_project/cpp/longcode/prod_cons.h +++ /dev/null @@ -1,433 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include "libipc/def.h" - -#include "libipc/platform/detail.h" -#include "libipc/circ/elem_def.h" -#include "libipc/utility/log.h" -#include "libipc/utility/utility.h" - -namespace ipc { - -//////////////////////////////////////////////////////////////// -/// producer-consumer implementation -//////////////////////////////////////////////////////////////// - -template -struct prod_cons_impl; - -template <> -struct prod_cons_impl> { - - template - struct elem_t { - std::aligned_storage_t data_ {}; - }; - - alignas(cache_line_size) std::atomic rd_; // read index - alignas(cache_line_size) std::atomic wt_; // write index - - constexpr circ::u2_t cursor() const noexcept { - return 0; - } - - template - bool push(W* /*wrapper*/, F&& f, E* elems) { - auto cur_wt = circ::index_of(wt_.load(std::memory_order_relaxed)); - if (cur_wt == circ::index_of(rd_.load(std::memory_order_acquire) - 1)) { - return false; // full - } - std::forward(f)(&(elems[cur_wt].data_)); - wt_.fetch_add(1, std::memory_order_release); - return true; - } - - /** - * In single-single-unicast, 'force_push' means 'no reader' or 'the only one reader is dead'. - * So we could just disconnect all connections of receiver, and return false. - */ - template - bool force_push(W* wrapper, F&&, E*) { - wrapper->elems()->disconnect_receiver(~static_cast(0u)); - return false; - } - - template - bool pop(W* /*wrapper*/, circ::u2_t& /*cur*/, F&& f, R&& out, E* elems) { - auto cur_rd = circ::index_of(rd_.load(std::memory_order_relaxed)); - if (cur_rd == circ::index_of(wt_.load(std::memory_order_acquire))) { - return false; // empty - } - std::forward(f)(&(elems[cur_rd].data_)); - std::forward(out)(true); - rd_.fetch_add(1, std::memory_order_release); - return true; - } -}; - -template <> -struct prod_cons_impl> - : prod_cons_impl> { - - template - bool force_push(W* wrapper, F&&, E*) { - wrapper->elems()->disconnect_receiver(1); - return false; - } - - template class E, std::size_t DS, std::size_t AS> - bool pop(W* /*wrapper*/, circ::u2_t& /*cur*/, F&& f, R&& out, E* elems) { - byte_t buff[DS]; - for (unsigned k = 0;;) { - auto cur_rd = rd_.load(std::memory_order_relaxed); - if (circ::index_of(cur_rd) == - circ::index_of(wt_.load(std::memory_order_acquire))) { - return false; // empty - } - std::memcpy(buff, &(elems[circ::index_of(cur_rd)].data_), sizeof(buff)); - if (rd_.compare_exchange_weak(cur_rd, cur_rd + 1, std::memory_order_release)) { - std::forward(f)(buff); - std::forward(out)(true); - return true; - } - ipc::yield(k); - } - } -}; - -template <> -struct prod_cons_impl> - : prod_cons_impl> { - - using flag_t = std::uint64_t; - - template - struct elem_t { - std::aligned_storage_t data_ {}; - std::atomic f_ct_ { 0 }; // commit flag - }; - - alignas(cache_line_size) std::atomic ct_; // commit index - - template - bool push(W* /*wrapper*/, F&& f, E* elems) { - circ::u2_t cur_ct, nxt_ct; - for (unsigned k = 0;;) { - cur_ct = ct_.load(std::memory_order_relaxed); - if (circ::index_of(nxt_ct = cur_ct + 1) == - circ::index_of(rd_.load(std::memory_order_acquire))) { - return false; // full - } - if (ct_.compare_exchange_weak(cur_ct, nxt_ct, std::memory_order_acq_rel)) { - break; - } - ipc::yield(k); - } - auto* el = elems + circ::index_of(cur_ct); - std::forward(f)(&(el->data_)); - // set flag & try update wt - el->f_ct_.store(~static_cast(cur_ct), std::memory_order_release); - while (1) { - auto cac_ct = el->f_ct_.load(std::memory_order_acquire); - if (cur_ct != wt_.load(std::memory_order_relaxed)) { - return true; - } - if ((~cac_ct) != cur_ct) { - return true; - } - if (!el->f_ct_.compare_exchange_strong(cac_ct, 0, std::memory_order_relaxed)) { - return true; - } - wt_.store(nxt_ct, std::memory_order_release); - cur_ct = nxt_ct; - nxt_ct = cur_ct + 1; - el = elems + circ::index_of(cur_ct); - } - return true; - } - - template - bool force_push(W* wrapper, F&&, E*) { - wrapper->elems()->disconnect_receiver(1); - return false; - } - - template class E, std::size_t DS, std::size_t AS> - bool pop(W* /*wrapper*/, circ::u2_t& /*cur*/, F&& f, R&& out, E* elems) { - byte_t buff[DS]; - for (unsigned k = 0;;) { - auto cur_rd = rd_.load(std::memory_order_relaxed); - auto cur_wt = wt_.load(std::memory_order_acquire); - auto id_rd = circ::index_of(cur_rd); - auto id_wt = circ::index_of(cur_wt); - if (id_rd == id_wt) { - auto* el = elems + id_wt; - auto cac_ct = el->f_ct_.load(std::memory_order_acquire); - if ((~cac_ct) != cur_wt) { - return false; // empty - } - if (el->f_ct_.compare_exchange_weak(cac_ct, 0, std::memory_order_relaxed)) { - wt_.store(cur_wt + 1, std::memory_order_release); - } - k = 0; - } - else { - std::memcpy(buff, &(elems[circ::index_of(cur_rd)].data_), sizeof(buff)); - if (rd_.compare_exchange_weak(cur_rd, cur_rd + 1, std::memory_order_release)) { - std::forward(f)(buff); - std::forward(out)(true); - return true; - } - ipc::yield(k); - } - } - } -}; - -template <> -struct prod_cons_impl> { - - using rc_t = std::uint64_t; - - enum : rc_t { - ep_mask = 0x00000000ffffffffull, - ep_incr = 0x0000000100000000ull - }; - - template - struct elem_t { - std::aligned_storage_t data_ {}; - std::atomic rc_ { 0 }; // read-counter - }; - - alignas(cache_line_size) std::atomic wt_; // write index - alignas(cache_line_size) rc_t epoch_ { 0 }; // only one writer - - circ::u2_t cursor() const noexcept { - return wt_.load(std::memory_order_acquire); - } - - template - bool push(W* wrapper, F&& f, E* elems) { - E* el; - for (unsigned k = 0;;) { - circ::cc_t cc = wrapper->elems()->connections(std::memory_order_relaxed); - if (cc == 0) return false; // no reader - el = elems + circ::index_of(wt_.load(std::memory_order_relaxed)); - // check all consumers have finished reading this element - auto cur_rc = el->rc_.load(std::memory_order_acquire); - circ::cc_t rem_cc = cur_rc & ep_mask; - if ((cc & rem_cc) && ((cur_rc & ~ep_mask) == epoch_)) { - return false; // has not finished yet - } - // consider rem_cc to be 0 here - if (el->rc_.compare_exchange_weak( - cur_rc, epoch_ | static_cast(cc), std::memory_order_release)) { - break; - } - ipc::yield(k); - } - std::forward(f)(&(el->data_)); - wt_.fetch_add(1, std::memory_order_release); - return true; - } - - template - bool force_push(W* wrapper, F&& f, E* elems) { - E* el; - epoch_ += ep_incr; - for (unsigned k = 0;;) { - circ::cc_t cc = wrapper->elems()->connections(std::memory_order_relaxed); - if (cc == 0) return false; // no reader - el = elems + circ::index_of(wt_.load(std::memory_order_relaxed)); - // check all consumers have finished reading this element - auto cur_rc = el->rc_.load(std::memory_order_acquire); - circ::cc_t rem_cc = cur_rc & ep_mask; - if (cc & rem_cc) { - ipc::log("force_push: k = %u, cc = %u, rem_cc = %u\n", k, cc, rem_cc); - cc = wrapper->elems()->disconnect_receiver(rem_cc); // disconnect all invalid readers - if (cc == 0) return false; // no reader - } - // just compare & exchange - if (el->rc_.compare_exchange_weak( - cur_rc, epoch_ | static_cast(cc), std::memory_order_release)) { - break; - } - ipc::yield(k); - } - std::forward(f)(&(el->data_)); - wt_.fetch_add(1, std::memory_order_release); - return true; - } - - template - bool pop(W* wrapper, circ::u2_t& cur, F&& f, R&& out, E* elems) { - if (cur == cursor()) return false; // acquire - auto* el = elems + circ::index_of(cur++); - std::forward(f)(&(el->data_)); - for (unsigned k = 0;;) { - auto cur_rc = el->rc_.load(std::memory_order_acquire); - if ((cur_rc & ep_mask) == 0) { - std::forward(out)(true); - return true; - } - auto nxt_rc = cur_rc & ~static_cast(wrapper->connected_id()); - if (el->rc_.compare_exchange_weak(cur_rc, nxt_rc, std::memory_order_release)) { - std::forward(out)((nxt_rc & ep_mask) == 0); - return true; - } - ipc::yield(k); - } - } -}; - -template <> -struct prod_cons_impl> { - - using rc_t = std::uint64_t; - using flag_t = std::uint64_t; - - enum : rc_t { - rc_mask = 0x00000000ffffffffull, - ep_mask = 0x00ffffffffffffffull, - ep_incr = 0x0100000000000000ull, - ic_mask = 0xff000000ffffffffull, - ic_incr = 0x0000000100000000ull - }; - - template - struct elem_t { - std::aligned_storage_t data_ {}; - std::atomic rc_ { 0 }; // read-counter - std::atomic f_ct_ { 0 }; // commit flag - }; - - alignas(cache_line_size) std::atomic ct_; // commit index - alignas(cache_line_size) std::atomic epoch_ { 0 }; - - circ::u2_t cursor() const noexcept { - return ct_.load(std::memory_order_acquire); - } - - constexpr static rc_t inc_rc(rc_t rc) noexcept { - return (rc & ic_mask) | ((rc + ic_incr) & ~ic_mask); - } - - constexpr static rc_t inc_mask(rc_t rc) noexcept { - return inc_rc(rc) & ~rc_mask; - } - - template - bool push(W* wrapper, F&& f, E* elems) { - E* el; - circ::u2_t cur_ct; - rc_t epoch = epoch_.load(std::memory_order_acquire); - for (unsigned k = 0;;) { - circ::cc_t cc = wrapper->elems()->connections(std::memory_order_relaxed); - if (cc == 0) return false; // no reader - el = elems + circ::index_of(cur_ct = ct_.load(std::memory_order_relaxed)); - // check all consumers have finished reading this element - auto cur_rc = el->rc_.load(std::memory_order_relaxed); - circ::cc_t rem_cc = cur_rc & rc_mask; - if ((cc & rem_cc) && ((cur_rc & ~ep_mask) == epoch)) { - return false; // has not finished yet - } - else if (!rem_cc) { - auto cur_fl = el->f_ct_.load(std::memory_order_acquire); - if ((cur_fl != cur_ct) && cur_fl) { - return false; // full - } - } - // consider rem_cc to be 0 here - if (el->rc_.compare_exchange_weak( - cur_rc, inc_mask(epoch | (cur_rc & ep_mask)) | static_cast(cc), std::memory_order_relaxed) && - epoch_.compare_exchange_weak(epoch, epoch, std::memory_order_acq_rel)) { - break; - } - ipc::yield(k); - } - // only one thread/process would touch here at one time - ct_.store(cur_ct + 1, std::memory_order_release); - std::forward(f)(&(el->data_)); - // set flag & try update wt - el->f_ct_.store(~static_cast(cur_ct), std::memory_order_release); - return true; - } - - template - bool force_push(W* wrapper, F&& f, E* elems) { - E* el; - circ::u2_t cur_ct; - rc_t epoch = epoch_.fetch_add(ep_incr, std::memory_order_release) + ep_incr; - for (unsigned k = 0;;) { - circ::cc_t cc = wrapper->elems()->connections(std::memory_order_relaxed); - if (cc == 0) return false; // no reader - el = elems + circ::index_of(cur_ct = ct_.load(std::memory_order_relaxed)); - // check all consumers have finished reading this element - auto cur_rc = el->rc_.load(std::memory_order_acquire); - circ::cc_t rem_cc = cur_rc & rc_mask; - if (cc & rem_cc) { - ipc::log("force_push: k = %u, cc = %u, rem_cc = %u\n", k, cc, rem_cc); - cc = wrapper->elems()->disconnect_receiver(rem_cc); // disconnect all invalid readers - if (cc == 0) return false; // no reader - } - // just compare & exchange - if (el->rc_.compare_exchange_weak( - cur_rc, inc_mask(epoch | (cur_rc & ep_mask)) | static_cast(cc), std::memory_order_relaxed)) { - if (epoch == epoch_.load(std::memory_order_acquire)) { - break; - } - else if (push(wrapper, std::forward(f), elems)) { - return true; - } - epoch = epoch_.fetch_add(ep_incr, std::memory_order_release) + ep_incr; - } - ipc::yield(k); - } - // only one thread/process would touch here at one time - ct_.store(cur_ct + 1, std::memory_order_release); - std::forward(f)(&(el->data_)); - // set flag & try update wt - el->f_ct_.store(~static_cast(cur_ct), std::memory_order_release); - return true; - } - - template - bool pop(W* wrapper, circ::u2_t& cur, F&& f, R&& out, E(& elems)[N]) { - auto* el = elems + circ::index_of(cur); - auto cur_fl = el->f_ct_.load(std::memory_order_acquire); - if (cur_fl != ~static_cast(cur)) { - return false; // empty - } - ++cur; - std::forward(f)(&(el->data_)); - for (unsigned k = 0;;) { - auto cur_rc = el->rc_.load(std::memory_order_acquire); - if ((cur_rc & rc_mask) == 0) { - std::forward(out)(true); - el->f_ct_.store(cur + N - 1, std::memory_order_release); - return true; - } - auto nxt_rc = inc_rc(cur_rc) & ~static_cast(wrapper->connected_id()); - bool last_one = false; - if ((last_one = (nxt_rc & rc_mask) == 0)) { - el->f_ct_.store(cur + N - 1, std::memory_order_release); - } - if (el->rc_.compare_exchange_weak(cur_rc, nxt_rc, std::memory_order_release)) { - std::forward(out)(last_one); - return true; - } - ipc::yield(k); - } - } -}; - -} // namespace ipc diff --git a/spaces/fb700/chatglm-fitness-RLHF/src/facerender/modules/make_animation.py b/spaces/fb700/chatglm-fitness-RLHF/src/facerender/modules/make_animation.py deleted file mode 100644 index 3360c53501a064f35d7db21a5361f89aa9658b42..0000000000000000000000000000000000000000 --- a/spaces/fb700/chatglm-fitness-RLHF/src/facerender/modules/make_animation.py +++ /dev/null @@ -1,170 +0,0 @@ -from scipy.spatial import ConvexHull -import torch -import torch.nn.functional as F -import numpy as np -from tqdm import tqdm - -def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False, - use_relative_movement=False, use_relative_jacobian=False): - if adapt_movement_scale: - source_area = ConvexHull(kp_source['value'][0].data.cpu().numpy()).volume - driving_area = ConvexHull(kp_driving_initial['value'][0].data.cpu().numpy()).volume - adapt_movement_scale = np.sqrt(source_area) / np.sqrt(driving_area) - else: - adapt_movement_scale = 1 - - kp_new = {k: v for k, v in kp_driving.items()} - - if use_relative_movement: - kp_value_diff = (kp_driving['value'] - kp_driving_initial['value']) - kp_value_diff *= adapt_movement_scale - kp_new['value'] = kp_value_diff + kp_source['value'] - - if use_relative_jacobian: - jacobian_diff = torch.matmul(kp_driving['jacobian'], torch.inverse(kp_driving_initial['jacobian'])) - kp_new['jacobian'] = torch.matmul(jacobian_diff, kp_source['jacobian']) - - return kp_new - -def headpose_pred_to_degree(pred): - device = pred.device - idx_tensor = [idx for idx in range(66)] - idx_tensor = torch.FloatTensor(idx_tensor).type_as(pred).to(device) - pred = F.softmax(pred) - degree = torch.sum(pred*idx_tensor, 1) * 3 - 99 - return degree - -def get_rotation_matrix(yaw, pitch, roll): - yaw = yaw / 180 * 3.14 - pitch = pitch / 180 * 3.14 - roll = roll / 180 * 3.14 - - roll = roll.unsqueeze(1) - pitch = pitch.unsqueeze(1) - yaw = yaw.unsqueeze(1) - - pitch_mat = torch.cat([torch.ones_like(pitch), torch.zeros_like(pitch), torch.zeros_like(pitch), - torch.zeros_like(pitch), torch.cos(pitch), -torch.sin(pitch), - torch.zeros_like(pitch), torch.sin(pitch), torch.cos(pitch)], dim=1) - pitch_mat = pitch_mat.view(pitch_mat.shape[0], 3, 3) - - yaw_mat = torch.cat([torch.cos(yaw), torch.zeros_like(yaw), torch.sin(yaw), - torch.zeros_like(yaw), torch.ones_like(yaw), torch.zeros_like(yaw), - -torch.sin(yaw), torch.zeros_like(yaw), torch.cos(yaw)], dim=1) - yaw_mat = yaw_mat.view(yaw_mat.shape[0], 3, 3) - - roll_mat = torch.cat([torch.cos(roll), -torch.sin(roll), torch.zeros_like(roll), - torch.sin(roll), torch.cos(roll), torch.zeros_like(roll), - torch.zeros_like(roll), torch.zeros_like(roll), torch.ones_like(roll)], dim=1) - roll_mat = roll_mat.view(roll_mat.shape[0], 3, 3) - - rot_mat = torch.einsum('bij,bjk,bkm->bim', pitch_mat, yaw_mat, roll_mat) - - return rot_mat - -def keypoint_transformation(kp_canonical, he, wo_exp=False): - kp = kp_canonical['value'] # (bs, k, 3) - yaw, pitch, roll= he['yaw'], he['pitch'], he['roll'] - yaw = headpose_pred_to_degree(yaw) - pitch = headpose_pred_to_degree(pitch) - roll = headpose_pred_to_degree(roll) - - if 'yaw_in' in he: - yaw = he['yaw_in'] - if 'pitch_in' in he: - pitch = he['pitch_in'] - if 'roll_in' in he: - roll = he['roll_in'] - - rot_mat = get_rotation_matrix(yaw, pitch, roll) # (bs, 3, 3) - - t, exp = he['t'], he['exp'] - if wo_exp: - exp = exp*0 - - # keypoint rotation - kp_rotated = torch.einsum('bmp,bkp->bkm', rot_mat, kp) - - # keypoint translation - t[:, 0] = t[:, 0]*0 - t[:, 2] = t[:, 2]*0 - t = t.unsqueeze(1).repeat(1, kp.shape[1], 1) - kp_t = kp_rotated + t - - # add expression deviation - exp = exp.view(exp.shape[0], -1, 3) - kp_transformed = kp_t + exp - - return {'value': kp_transformed} - - - -def make_animation(source_image, source_semantics, target_semantics, - generator, kp_detector, he_estimator, mapping, - yaw_c_seq=None, pitch_c_seq=None, roll_c_seq=None, - use_exp=True, use_half=False): - with torch.no_grad(): - predictions = [] - - kp_canonical = kp_detector(source_image) - he_source = mapping(source_semantics) - kp_source = keypoint_transformation(kp_canonical, he_source) - - for frame_idx in tqdm(range(target_semantics.shape[1]), 'Face Renderer:'): - # still check the dimension - # print(target_semantics.shape, source_semantics.shape) - target_semantics_frame = target_semantics[:, frame_idx] - he_driving = mapping(target_semantics_frame) - if yaw_c_seq is not None: - he_driving['yaw_in'] = yaw_c_seq[:, frame_idx] - if pitch_c_seq is not None: - he_driving['pitch_in'] = pitch_c_seq[:, frame_idx] - if roll_c_seq is not None: - he_driving['roll_in'] = roll_c_seq[:, frame_idx] - - kp_driving = keypoint_transformation(kp_canonical, he_driving) - - kp_norm = kp_driving - out = generator(source_image, kp_source=kp_source, kp_driving=kp_norm) - ''' - source_image_new = out['prediction'].squeeze(1) - kp_canonical_new = kp_detector(source_image_new) - he_source_new = he_estimator(source_image_new) - kp_source_new = keypoint_transformation(kp_canonical_new, he_source_new, wo_exp=True) - kp_driving_new = keypoint_transformation(kp_canonical_new, he_driving, wo_exp=True) - out = generator(source_image_new, kp_source=kp_source_new, kp_driving=kp_driving_new) - ''' - predictions.append(out['prediction']) - predictions_ts = torch.stack(predictions, dim=1) - return predictions_ts - -class AnimateModel(torch.nn.Module): - """ - Merge all generator related updates into single model for better multi-gpu usage - """ - - def __init__(self, generator, kp_extractor, mapping): - super(AnimateModel, self).__init__() - self.kp_extractor = kp_extractor - self.generator = generator - self.mapping = mapping - - self.kp_extractor.eval() - self.generator.eval() - self.mapping.eval() - - def forward(self, x): - - source_image = x['source_image'] - source_semantics = x['source_semantics'] - target_semantics = x['target_semantics'] - yaw_c_seq = x['yaw_c_seq'] - pitch_c_seq = x['pitch_c_seq'] - roll_c_seq = x['roll_c_seq'] - - predictions_video = make_animation(source_image, source_semantics, target_semantics, - self.generator, self.kp_extractor, - self.mapping, use_exp = True, - yaw_c_seq=yaw_c_seq, pitch_c_seq=pitch_c_seq, roll_c_seq=roll_c_seq) - - return predictions_video \ No newline at end of file diff --git a/spaces/fclong/summary/fengshen/data/data_utils/sentence_split.py b/spaces/fclong/summary/fengshen/data/data_utils/sentence_split.py deleted file mode 100644 index 1a25e4b51b13f86f4a8a6b39f497f85c050856b6..0000000000000000000000000000000000000000 --- a/spaces/fclong/summary/fengshen/data/data_utils/sentence_split.py +++ /dev/null @@ -1,35 +0,0 @@ -import re - - -class ChineseSentenceSplitter(object): - def merge_symmetry(self, sentences, symmetry=('“', '”')): - # '''合并对称符号,如双引号''' - effective_ = [] - merged = True - for index in range(len(sentences)): - if symmetry[0] in sentences[index] and symmetry[1] not in sentences[index]: - merged = False - effective_.append(sentences[index]) - elif symmetry[1] in sentences[index] and not merged: - merged = True - effective_[-1] += sentences[index] - elif symmetry[0] not in sentences[index] and symmetry[1] not in sentences[index] and not merged: - effective_[-1] += sentences[index] - else: - effective_.append(sentences[index]) - return [i.strip() for i in effective_ if len(i.strip()) > 0] - - def to_sentences(self, paragraph): - # """由段落切分成句子""" - sentences = re.split(r"(?|。|[!]+|!|\…\…)", paragraph) - sentences.append("") - sentences = ["".join(i) for i in zip(sentences[0::2], sentences[1::2])] - sentences = [i.strip() for i in sentences if len(i.strip()) > 0] - for j in range(1, len(sentences)): - if sentences[j][0] == '”': - sentences[j-1] = sentences[j-1] + '”' - sentences[j] = sentences[j][1:] - return self.merge_symmetry(sentences) - - def tokenize(self, text): - return self.to_sentences(text) diff --git a/spaces/felixz/LLM-as-continuous-chat/app.py b/spaces/felixz/LLM-as-continuous-chat/app.py deleted file mode 100644 index 9e43eb4da372cd9539332b7d8a3e6d4be35ff545..0000000000000000000000000000000000000000 --- a/spaces/felixz/LLM-as-continuous-chat/app.py +++ /dev/null @@ -1,90 +0,0 @@ -import gradio as gr - -from transformers import T5Tokenizer, T5ForConditionalGeneration - -# xl size run out of memory on 16GB vm -# All the models have input length of 512 tokens and outputs of 512 tokens -# small 80M param -# base 250M -# large 780M -# xl -# xxl -model_name = "large" -tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-" + model_name) -model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-" + model_name) - -title = "" - -def get_examples (): - return [ - ["Peter goes to the store to buy a soda. The soda costs $.25 an ounce. \ -He brought $2 with him and leaves with $.50. How many ounces of soda did he buy?", - "How much did Peter spend on soda? ** He spend $1.5 on soda because 2 - .5 = <<2-.5=1.5>>1.5 \ - How many ounces of soda did Peter buy? ** He bought 6 ounces of soda because 1.5 / .25 = <<6=6>>6 #### 6" - ], - ["Krystian works in the library. He borrows an average of 40 books every day. \ -Every Friday, his number of borrowed books is about 40% higher than the daily average. How many books does he borrow in a week if the library is open from Monday to Friday?" - ,"How many books does Krystian borrow on Friday? ** The number of books borrowed \ -on Friday is higher by 40 * 40/100 = <<40*40/100=16>>16 books. How many books does Krystian borrow in a week? ** There are 5 days from Monday to Friday inclusive, so Krystian borrows an average of 5 * 40 = <<5*40=200>>200 books during that time. How many books does Krystian borrow in a week? ** With Friday's increase in borrowings, during one week Krystian borrows 200 + 16 = <<200+16=216>>216 books."] - , ["Jane had $60 but gave $30 to dave and went to movies and spend $2. How much money does Jane has left? Answer by reasoning step by step:", "$28"], - ["Cat is a friend of a Dog. Are cat and Dog friends?", "Yes"] - ] - - -def text2text(input_text): - input_ids = tokenizer(input_text, return_tensors="pt").input_ids - - input_num_tokens = input_ids.shape[1] - - print( "Number of input tokens: " + str(input_num_tokens)) - print("Length of input: " + str(len(input_text))) - - list_of_tokens = tokenizer.convert_ids_to_tokens(input_ids.view(-1).tolist()) - - print( "Tokens : " + ' '.join(list_of_tokens)) - - # Does not seem to care if it goes over 512... humm... - # To make it faster generate 100 tokens at a time - # sampling mode.. don't greedily take the highest probability token every time. Helps it chat with some variation - # temperature.. how random should the sampling be. - # top_p Which set of tokens to sample from. Filters out some low probability tokens before smapling. - # - # input_ids should not be over 512 tokens. This method does not break over 512 tokens.. what is it doing? - outputs = model.generate(input_ids, max_new_tokens=100, do_sample=True, temperature=0.7, top_p=0.8) - - # Remove and eof sequence tokens - model_output_text = tokenizer.decode(outputs[0],skip_special_tokens=True) - - print("Number of output tokens: " + str(outputs.shape[1])) - print("length of output: " + str(len(model_output_text))) - print("Output: " + model_output_text) - # Space is added because model seem to not add it automatically. - output_text = input_text + " " + model_output_text - return output_text - - -with gr.Blocks() as demo: - gr.Markdown( - """ - # Flan T5 Large Demo (Chat Mode) - 780M parameter Large language model fine tuned on diverse tasks. - Prompt the model in the Input box. Models output is appended to input. To get additional generation hit submit again. - """) - txt_in = gr.Textbox(label="Input", lines=8) - correct_label = gr.Label(label="Correct") - # txt_out = gr.Textbox(value="", label="Output", lines=4) - - - btn = gr.Button(value="Submit") - # Send back to inputs - btn.click(text2text, inputs=[txt_in], outputs=[txt_in]) - - - gr.Examples( - examples=get_examples(), - inputs=[txt_in,correct_label] - ) - - -if __name__ == "__main__": - demo.launch() \ No newline at end of file diff --git a/spaces/feregVcuzo/sanity-test-midi/checkpoint/Clash of Kings APK How to Join Alliances and Win Battles.md b/spaces/feregVcuzo/sanity-test-midi/checkpoint/Clash of Kings APK How to Join Alliances and Win Battles.md deleted file mode 100644 index 95717a9b5d20f6641f272f1b6c59a75c9104e644..0000000000000000000000000000000000000000 --- a/spaces/feregVcuzo/sanity-test-midi/checkpoint/Clash of Kings APK How to Join Alliances and Win Battles.md +++ /dev/null @@ -1,103 +0,0 @@ - -

                Clash of Kings APK Update: What's New and How to Download

                -

                Are you a fan of strategy games that let you build your own empire and conquer the world? If yes, then you might have heard of Clash of Kings, one of the most popular mobile games in this genre. But did you know that there is a new APK update for this game that brings a lot of exciting features and improvements? In this article, we will tell you everything you need to know about the Clash of Kings APK update, including what's new, how to download it, and some tips and tricks to enjoy the game.

                -

                clash of kings apk update


                Download File ····· https://gohhs.com/2uPs4C



                -

                Introduction

                -

                What is Clash of Kings?

                -

                Clash of Kings is a free mobile game launched by the Elex Wireless team from China. It is an RTS (real-time strategy) game that lets you create your own kingdom, train your army, research advanced technology, forge alliances with other players, and fight against enemies from all over the world. The game has over 50 million downloads on Google Play and has received positive reviews from players and critics alike.

                -

                Why download the latest APK update?

                -

                An APK (Android Package Kit) is a file format that contains all the elements needed to install an app on an Android device. Sometimes, developers release APK updates for their apps that are not available on the official app stores. These updates may contain new features, bug fixes, performance enhancements, or security patches that can improve your gaming experience. The latest APK update for Clash of Kings was released on June 7, 2023, and it has a lot of new things to offer.

                -

                Features of Clash of Kings APK Update

                -

                New civilizations and commanders

                -

                One of the most exciting features of the Clash of Kings APK update is the addition of five new civilizations inspired by historical empires. These are Viking, Yamato, Crescent, Huaxia, and Dragon-Born. Each civilization has its own unique design, culture, and characteristics. You can choose your favorite one and explore its history and legends.

                -

                clash of kings apk latest version download
                -clash of kings mod apk unlimited money and gold
                -clash of kings apk old version
                -clash of kings apk hack free download
                -clash of kings apk offline
                -clash of kings apk pure
                -clash of kings apk for pc
                -clash of kings apk obb
                -clash of kings apk mirror
                -clash of kings apk revdl
                -clash of kings apk uptodown
                -clash of kings apk mod menu
                -clash of kings apk android 1
                -clash of kings apk rexdl
                -clash of kings apk data
                -clash of kings apk no root
                -clash of kings apk unlimited everything
                -clash of kings apk mod offline
                -clash of kings apk 2023
                -clash of kings apk mod latest version
                -clash of kings apk hack tool
                -clash of kings apk cheat engine
                -clash of kings apk modded
                -clash of kings apk cracked
                -clash of kings apk full version
                -clash of kings apk unlimited gems
                -clash of kings apk mod online
                -clash of kings apk hack no survey
                -clash of kings apk free shopping
                -clash of kings apk mod unlimited troops
                -clash of kings apk hack android
                -clash of kings apk mod vip 10
                -clash of kings apk unlimited resources
                -clash of kings apk mod no ban
                -clash of kings apk hack ios
                -clash of kings apk mod anti ban
                -clash of kings apk unlimited coins
                -clash of kings apk mod free download
                -clash of kings apk hack download 2023
                -clash of kings apk mod unlimited money and gold 2023

                -

                Along with the new civilizations, the update also introduces more than 50 new commanders with different traits and abilities. These commanders can lead your troops into battle and give you an edge over your enemies. You can also collect and upgrade them to make them more powerful.

                -

                Improved graphics and gameplay

                -

                The Clash of Kings APK update also brings some improvements to the graphics and gameplay of the game. The game now has more realistic and detailed graphics that will make you feel like you are in a medieval world. The game also has smoother and faster gameplay that will let you enjoy real-time battles with easy controls.

                -

                Enhanced cross-server battles and alliances

                -

                The game also offers more opportunities for cross-server battles and alliances with the update. You can now move to different kingdoms to form new alliances and participate in multi-level cross-server battle royals. You can also join various events and challenges with your allies and compete with other players from different servers.

                -

                How to Download Clash of Kings APK Update

                -

                Requirements and compatibility

                -

                To download the Clash of Kings APK update, you need to have an Android device that meets the following requirements:

                -
                  -
                • Android version: 4.0.3 or higher
                • -
                • RAM: 1 GB or more
                • -
                • Storage space: 964 MB or more
                • -
                • Internet connection: Wi-Fi or mobile data
                • -

                Steps to download and install

                -

                To download and install the Clash of Kings APK update, you need to follow these steps:

                -
                  -
                1. Go to the download link of the APK file. You can use one of the links provided by the web search results, such as or . Make sure you choose a trusted and secure source.
                2. -
                3. Tap on the download button and wait for the file to be downloaded on your device. You may need to enable the option to download files from unknown sources in your device settings.
                4. -
                5. Once the file is downloaded, locate it in your file manager and tap on it to start the installation process. You may need to grant some permissions to the app.
                6. -
                7. Follow the instructions on the screen and wait for the installation to be completed. You may need to uninstall the previous version of the game if you have it.
                8. -
                9. Launch the game and enjoy the new features and improvements.
                10. -
                -

                Tips and tricks to enjoy the game

                -

                Now that you have downloaded and installed the Clash of Kings APK update, you may want to know some tips and tricks to make the most out of the game. Here are some of them:

                -
                  -
                • Join an active alliance and cooperate with your allies. You can get help from them in building, researching, attacking, and defending. You can also share resources, information, and rewards with them.
                • -
                • Focus on upgrading your castle and your resource buildings. Your castle is the heart of your kingdom and determines your level and power. Your resource buildings provide you with food, wood, iron, and gold that you need for everything else.
                • -
                • Balance your army composition and strategy. You have different types of units that have different strengths and weaknesses. You should have a mix of infantry, cavalry, archers, siege, and special units. You should also use different formations and tactics depending on the situation.
                • -
                • Participate in events and quests. The game offers various events and quests that can give you rewards, such as gold, items, speed-ups, VIP points, etc. You should try to complete as many as you can to boost your progress and gain an advantage.
                • -
                • Have fun and be respectful. The game is meant to be a fun and social experience where you can interact with other players from around the world. You should enjoy the game and be respectful to others. Don't cheat, spam, or harass other players.
                • -
                -

                Conclusion

                -

                Summary of the main points

                -

                In conclusion, Clash of Kings is a great game for strategy lovers who want to build their own empire and conquer the world. The game has a new APK update that brings a lot of new features and improvements, such as new civilizations, commanders, graphics, gameplay, cross-server battles, and alliances. To download the update, you need to have an Android device that meets the requirements and follow the steps provided in this article. You can also use some tips and tricks to enjoy the game more.

                -

                Call to action and feedback

                -

                If you are interested in playing Clash of Kings or updating your game to the latest version, you can use one of the links below to download the APK file. We hope you found this article helpful and informative. If you have any questions or feedback, please leave a comment below. We would love to hear from you.

                -

                FAQs

                -

                Here are some frequently asked questions about Clash of Kings APK update:

                -
                  -
                1. Is Clash of Kings APK update safe to download?
                2. -

                  Yes, as long as you download it from a trusted and secure source. However, you should always be careful when downloading files from unknown sources and scan them for viruses or malware before installing them.

                  -
                3. What are the benefits of downloading Clash of Kings APK update?
                4. -

                  The benefits of downloading Clash of Kings APK update are that you can enjoy new features and improvements that are not available on the official app stores. You can also get access to exclusive events and rewards that are only available for APK users.

                  -
                5. How do I update Clash of Kings APK?
                6. -

                  To update Clash of Kings APK, you need to download the latest version of the APK file from a reliable source and install it on your device. You may need to uninstall the previous version of the game if you have it.

                  -
                7. Can I play Clash of Kings APK update with my friends who have the official version?
                8. -

                  Yes, you can play Clash of Kings APK update with your friends who have the official version. The game is compatible with both versions and allows cross-platform play

                9. What are the drawbacks of downloading Clash of Kings APK update?
                10. -

                  The drawbacks of downloading Clash of Kings APK update are that you may encounter some bugs or glitches that are not fixed yet. You may also face some compatibility issues with your device or other apps. You may also risk violating the terms and conditions of the game or the app store.

                  -

                401be4b1e0
                -
                -
                \ No newline at end of file diff --git a/spaces/feregVcuzo/sanity-test-midi/checkpoint/Como baixar e instalar Stickman Falling APK com MOD de dinheiro infinito.md b/spaces/feregVcuzo/sanity-test-midi/checkpoint/Como baixar e instalar Stickman Falling APK com MOD de dinheiro infinito.md deleted file mode 100644 index c4739f95186d74346b84b9faf9c350545a564742..0000000000000000000000000000000000000000 --- a/spaces/feregVcuzo/sanity-test-midi/checkpoint/Como baixar e instalar Stickman Falling APK com MOD de dinheiro infinito.md +++ /dev/null @@ -1,121 +0,0 @@ -
                -

                Stickman Falling Dinheiro Infinito APK: How to Download and Play

                -

                Do you love stickman games? Do you enjoy watching the stickman fall and crash in different ways? If yes, then you should try Stickman Falling, a fun and addictive game where you need to help the stickman survive the obstacles and reach the finish line. But what if you want to have more money and resources in the game? What if you want to remove all the ads and enjoy the game without interruptions? Well, there is a solution for that: Stickman Falling Dinheiro Infinito APK. In this article, we will tell you everything you need to know about this modded version of Stickman Falling, how to download and install it, and how to play it like a pro. Let's get started!

                -

                stickman falling dinheiro infinito apk


                Download Filehttps://gohhs.com/2uPoyj



                -

                What is Stickman Falling?

                -

                Stickman Falling is a casual game developed by Skygo. It is available for Android devices on Google Play Store. The game has more than 50 million downloads and a 4.1 rating out of 5. The game is simple but challenging: you need to control the stickman as he falls from different heights and angles, avoiding the obstacles and landing safely. You can choose from various vehicles, such as cars, bikes, trucks, planes, helicopters, and more. You can also customize your stickman with different outfits, hats, glasses, and accessories. The game has realistic physics and graphics, as well as funny sound effects. The game is suitable for all ages and can be played offline.

                -

                Features of Stickman Falling

                -

                Some of the features of Stickman Falling are:

                -
                  -
                • More than 100 levels with different scenarios and difficulties.
                • -
                • More than 20 vehicles with different characteristics and abilities.
                • -
                • More than 30 items to customize your stickman.
                • -
                • Daily rewards and achievements.
                • -
                • Leaderboards and rankings.
                • -
                • Easy controls and user-friendly interface.
                • -
                -

                How to play Stickman Falling

                -

                The gameplay of Stickman Falling is simple but fun. Here are the basic steps:

                -
                  -
                1. Select a level from the map.
                2. -
                3. Select a vehicle from the garage.
                4. -
                5. Tap the screen to start the fall.
                6. -
                7. Tilt your device to steer the vehicle.
                8. -
                9. Tap the screen again to use boosters or brakes.
                10. -
                11. Avoid the obstacles and land safely.
                12. -
                13. Earn coins and diamonds for completing the level.
                14. -
                -

                What is Stickman Falling Dinheiro Infinito APK?

                -

                Stickman Falling Dinheiro Infinito APK is a modified version of Stickman Falling that gives you unlimited money and resources in the game. It also removes all ads from the game, so you can enjoy it without interruptions. With this mod, you can unlock all the vehicles, items, levels, and features in the game without spending any real money. You can also enjoy faster gameplay and smoother performance.

                -

                Benefits of Stickman Falling Dinheiro Infinito APK

                -

                Some of the benefits of Stickman Falling Dinheiro Infinito APK are:

                -

                stickman falling mod apk dinheiro infinito
                -baixar stickman falling dinheiro infinito
                -stickman falling hack apk dinheiro infinito
                -stickman falling atualizado dinheiro infinito
                -stickman falling apk mod dinheiro ilimitado
                -como baixar stickman falling com dinheiro infinito
                -stickman falling download apk dinheiro infinito
                -stickman falling versão mais recente dinheiro infinito
                -stickman falling apk dinheiro infinito 2023
                -stickman falling jogo de corrida dinheiro infinito
                -stickman falling apk mod hack dinheiro infinito
                -stickman falling android apk dinheiro infinito
                -stickman falling apk mod tudo desbloqueado dinheiro infinito
                -stickman falling apk mod sem anúncios dinheiro infinito
                -stickman falling apk mod online dinheiro infinito
                -stickman falling apk mod offline dinheiro infinito
                -stickman falling apk mod atualizado 2023 dinheiro infinito
                -stickman falling apk mod novas fases dinheiro infinito
                -stickman falling apk mod novos veículos dinheiro infinito
                -stickman falling apk mod gráficos melhorados dinheiro infinito
                -stickman falling apk mod física realista dinheiro infinito
                -stickman falling apk mod controles fáceis dinheiro infinito
                -stickman falling apk mod diversão garantida dinheiro infinito
                -stickman falling apk mod desafios incríveis dinheiro infinito
                -stickman falling apk mod cenários variados dinheiro infinito
                -como instalar stickman falling com dinheiro infinito
                -como jogar stickman falling com dinheiro infinito
                -como atualizar stickman falling com dinheiro infinito
                -como desinstalar stickman falling com dinheiro infinito
                -como fazer backup de stickman falling com dinheiro infinito
                -como restaurar dados de stickman falling com dinheiro infinito
                -como resolver problemas de stickman falling com dinheiro infinito
                -como entrar em contato com o desenvolvedor de stickman falling com dinheiro infinito
                -como avaliar o jogo stickman falling com dinheiro infinito
                -como compartilhar o jogo stickman falling com dinheiro infinito
                -melhores dicas para jogar stickman falling com dinheiro infinito
                -melhores truques para jogar stickman falling com dinheiro infinito
                -melhores manobras para jogar stickman falling com dinheiro infinito
                -melhores veículos para jogar stickman falling com dinheiro infinito
                -melhores fases para jogar stickman falling com dinheiro infinito
                -melhores momentos para jogar stickman falling com dinheiro infinito
                -melhores vídeos de gameplay de stickman falling com dinheiro infinito
                -melhores canais de youtube de stickman falling com dinheiro infinito
                -melhores sites de download de stickman falling com dinheiro infinito
                -melhores blogs de review de stickman falling com dinheiro infinito
                -melhores fóruns de discussão de stickman falling com dinheiro infinito

                -
                  -
                • You can have unlimited money and resources in the game.
                • -
                • You can unlock all the vehicles, items, levels, and features in the game.
                • -
                • You can remove all ads from the game.
                • -
                • You can enjoy faster gameplay and smoother performance.
                • -
                • You can play offline without any restrictions.
                • -
                -

                How to download and install Stickman Falling Dinheiro Infinito APK

                -

                To download and install Stickman Falling Dinheiro Inf nito APK, you need to follow these steps:

                -
                  -
                1. Go to the link and download the APK file.
                2. -
                3. Enable the installation of unknown sources on your device. To do this, go to Settings > Security > Unknown Sources and toggle it on.
                4. -
                5. Locate the downloaded APK file on your device and tap on it.
                6. -
                7. Follow the instructions on the screen and install the app.
                8. -
                9. Launch the app and enjoy the game.
                10. -
                -

                Tips and tricks for Stickman Falling

                -

                Stickman Falling is a fun and addictive game, but it can also be challenging and frustrating at times. To help you master the game and have more fun, here are some tips and tricks you can use:

                -

                Choose the right vehicle

                -

                The vehicle you choose can make a big difference in your performance and score. Each vehicle has different characteristics and abilities, such as speed, durability, handling, and weight. Some vehicles are better suited for certain levels and obstacles than others. For example, a bike might be faster and more agile, but it can also break easily and flip over. A truck might be more durable and stable, but it can also be slower and harder to steer. You should experiment with different vehicles and find the one that suits your style and preference.

                -

                Use the boosters wisely

                -

                Boosters are items that can help you in your fall. They can give you extra speed, protection, or power. However, they are not always available and they have limited uses. You should use them wisely and strategically, depending on the situation. For example, you can use a booster to accelerate when you need to avoid an obstacle or reach the finish line faster. You can also use a booster to protect yourself when you are about to crash or hit something hard. You can also use a booster to break through a barrier or a wall. You should save your boosters for when you really need them and not waste them unnecessarily.

                -

                Avoid the spikes and saws

                -

                The spikes and saws are some of the most dangerous obstacles in the game. They can cause a lot of damage to your vehicle and your stickman. They can also make you lose coins and diamonds. You should avoid them at all costs and try to steer clear of them. If you see them coming, you should either change your direction or use a booster to escape them. You should also watch out for other obstacles that can push you or bounce you into them, such as barrels, balls, or springs.

                -

                Collect coins and diamonds

                -

                Coins and diamonds are the currency of the game. You can use them to buy new vehicles, items, and features in the game. You can also use them to upgrade your existing vehicles and items. You can earn coins and diamonds by completing levels, achieving goals, watching ads, or using Stickman Falling Dinheiro Infinito APK. You should collect as many coins and diamonds as you can and spend them wisely.

                -

                Conclusion

                -

                Stickman Falling is a fun and addictive game that will keep you entertained for hours. You can enjoy watching the stickman fall and crash in different ways, while controlling his vehicle and avoiding the obstacles. You can also customize your stickman and your vehicle with various items and features. If you want to have more money and resources in the game, you can download Stickman Falling Dinheiro Infinito APK, which gives you unlimited access to everything in the game. You can also use some tips and tricks to improve your skills and score in the game. We hope this article was helpful for you and that you will enjoy playing Stickman Falling.

                -

                FAQs

                -

                Here are some frequently asked questions about Stickman Falling:

                -
                  -
                • Is Stickman Falling free?
                  -Yes, Stickman Falling is free to download and play on Android devices. However, it contains ads that can be removed by purchasing the premium version or using Stickman Falling Dinheiro Infinito APK.
                • -
                • Is Stickman Falling safe?
                  -Yes, Stickman Falling is safe to play on Android devices. It does not contain any viruses or malware that can harm your device or data. However, if you download Stickman Falling Dinheiro Infinito APK from an unknown source, you should be careful and scan it before installing it.
                • -
                • Is Stickman Falling offline?
                  -Yes, Stickman Falling can be played offline without any internet connection. However, some features of the game might require an internet connection, such as watching ads or accessing leaderboards.
                • -
                • How do I update Stickman Falling?
                  -You can update Stickman Falling by going to Google Play Store and checking for any available updates. You can also enable the automatic update option on your device settings. If you download Stickman Falling Dinheiro Infinito APK from an external source, you might need to check the website regularly for any new versions.
                • -
                • How do I contact the developer of Stickman Falling?
                  -You can contact the developer of Stickman Falling by sending an email to skygo@skygo.com. You can also visit their website or follow them on Facebook, Twitter, or Instagram for more information and updates.
                • -

                401be4b1e0
                -
                -
                \ No newline at end of file diff --git a/spaces/fffiloni/SplitTrack2MusicGen/audiocraft/models/__init__.py b/spaces/fffiloni/SplitTrack2MusicGen/audiocraft/models/__init__.py deleted file mode 100644 index 92c7a48a200eba455044cd66e0d2c1efe6494f5c..0000000000000000000000000000000000000000 --- a/spaces/fffiloni/SplitTrack2MusicGen/audiocraft/models/__init__.py +++ /dev/null @@ -1,10 +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. - -# flake8: noqa -from .musicgen import MusicGen -from .lm import LMModel -from .encodec import CompressionModel, EncodecModel diff --git a/spaces/fffiloni/controlnet-animation-doodle/node_modules/merge-descriptors/README.md b/spaces/fffiloni/controlnet-animation-doodle/node_modules/merge-descriptors/README.md deleted file mode 100644 index d593c0ebd7c15b5749e913412ab3b729d114b81e..0000000000000000000000000000000000000000 --- a/spaces/fffiloni/controlnet-animation-doodle/node_modules/merge-descriptors/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Merge Descriptors - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Merge objects using descriptors. - -```js -var thing = { - get name() { - return 'jon' - } -} - -var animal = { - -} - -merge(animal, thing) - -animal.name === 'jon' -``` - -## API - -### merge(destination, source) - -Redefines `destination`'s descriptors with `source`'s. - -### merge(destination, source, false) - -Defines `source`'s descriptors on `destination` if `destination` does not have -a descriptor by the same name. - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg -[npm-url]: https://npmjs.org/package/merge-descriptors -[travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg -[travis-url]: https://travis-ci.org/component/merge-descriptors -[coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg -[coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master -[downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg -[downloads-url]: https://npmjs.org/package/merge-descriptors diff --git a/spaces/flax-community/multilingual-image-captioning/sections/bias.md b/spaces/flax-community/multilingual-image-captioning/sections/bias.md deleted file mode 100644 index e4f45c99e227c796cf9f0d578e03302f20b1b84f..0000000000000000000000000000000000000000 --- a/spaces/flax-community/multilingual-image-captioning/sections/bias.md +++ /dev/null @@ -1,9 +0,0 @@ -### Limitations -- Our model has a major limitation in that the training data provided was limited to a sequence length of 64 tokens. Hence, it does not perform very well with longer sequence lengths. Sometimes, it yields up empty captions. We are working on it as of this writing by doubling the maximum sequence length of translation and training. -- The dataset has all `Person` type named entites masked as ``. While that is good for biases as we explain below, the dataset contains too many `` tags and the model results in `` sometimes for Person-related images. -- Our captions are sometimes generic. Stating what is present in the image instead of generation well-formed and convoluted captions. Despite the training, the BLEU scores we achieve are not very great, which could be a reason for this. With higher BLEU scores, we can expect less-generic models. -- English captions are sometimes better than other languages. This can be due to the fact that we limit sequence length of other languages to 64 (and now 128) while English text works fine. This could also be due to poor-quality translations which we wish to address in our next attempt. -### Biases -Due to the gender, racial, color and stereotypical biases in data, person identification by an image captioning model suffers. Also, the gender-activity bias, owing to the word-by-word prediction, influences other words in the caption prediction, resulting in the well-known problem of label bias. - -One of the reasons why we chose Conceptual 12M over COCO captioning dataset for training our Multi-lingual Image Captioning model was that in former all named entities of type Person were substituted by a special token . Because of this, the gendered terms in our captions became quite infrequent. We'll present a few captions from our model to analyse how our model performed on different images on which different pre-trained image captioning model usually gives gender prediction biases. \ No newline at end of file diff --git a/spaces/flowers-team/SocialAISchool/scripts/LLM_test.py b/spaces/flowers-team/SocialAISchool/scripts/LLM_test.py deleted file mode 100644 index 0cf38fb88020192fd7280133246f99491e4f3fdb..0000000000000000000000000000000000000000 --- a/spaces/flowers-team/SocialAISchool/scripts/LLM_test.py +++ /dev/null @@ -1,926 +0,0 @@ -import argparse -import json -import requests -import time -import warnings -from n_tokens import estimate_price -import pickle - -import numpy as np -import torch -from pathlib import Path - -# from utils.babyai_utils.baby_agent import load_agent -from utils import * -from textworld_utils.utils import generate_text_obs -from models import * -import subprocess -import os - -from matplotlib import pyplot as plt - -from gym_minigrid.wrappers import * -from gym_minigrid.window import Window -from datetime import datetime - -from imageio import mimsave - -def new_episode_marker(): - return "New episode.\n" - -def success_marker(): - return "Success!\n" - -def failure_marker(): - return "Failure!\n" - -def action_query(): - return "Act :" - -def get_parsed_action(text_action): - """ - Parses the text generated by a model and extracts the action - """ - - if "move forward" in text_action: - return "move forward" - - elif "done" in text_action: - return "done" - - elif "turn left" in text_action: - return "turn left" - - elif "turn right" in text_action: - return "turn right" - - elif "toggle" in text_action: - return "toggle" - - elif "no_op" in text_action: - return "no_op" - else: - warnings.warn(f"Undefined action {text_action}") - return "no_op" - - -def action_to_prompt_action_text(action): - if np.allclose(action, [int(env.actions.forward), np.nan, np.nan], equal_nan=True): - # 2 - text_action = "move forward" - - elif np.allclose(action, [int(env.actions.left), np.nan, np.nan], equal_nan=True): - # 0 - text_action = "turn left" - - elif np.allclose(action, [int(env.actions.right), np.nan, np.nan], equal_nan=True): - # 1 - text_action = "turn right" - - elif np.allclose(action, [int(env.actions.toggle), np.nan, np.nan], equal_nan=True): - # 3 - text_action = "toggle" - - elif np.allclose(action, [int(env.actions.done), np.nan, np.nan], equal_nan=True): - # 4 - text_action = "done" - - elif np.allclose(action, [np.nan, np.nan, np.nan], equal_nan=True): - text_action = "no_op" - - else: - warnings.warn(f"Undefined action {action}") - return "no_op" - - return f"{action_query()} {text_action}\n" - - - -def text_action_to_action(text_action): - - # text_action = get_parsed_action(text_action) - - if "move forward" == text_action: - action = [int(env.actions.forward), np.nan, np.nan] - - elif "turn left" == text_action: - action = [int(env.actions.left), np.nan, np.nan] - - elif "turn right" == text_action: - action = [int(env.actions.right), np.nan, np.nan] - - elif "toggle" == text_action: - action = [int(env.actions.toggle), np.nan, np.nan] - - elif "done" == text_action: - action = [int(env.actions.done), np.nan, np.nan] - - elif "no_op" == text_action: - action = [np.nan, np.nan, np.nan] - - return action - - -def prompt_preprocessor(llm_prompt): - # remove peer observations - lines = llm_prompt.split("\n") - new_lines = [] - for line in lines: - if line.startswith("#"): - continue - - elif line.startswith("Conversation"): - continue - - elif "peer" in line: - caretaker = True - if caretaker: - # show only the location of the caretaker - - # this is very ugly, todo: refactor this - assert "there is a" in line - start_index = line.index('there is a') + 11 - new_line = line[:start_index] + 'caretaker' - - new_lines.append(new_line) - - else: - # no caretaker at all - if line.startswith("Obs :") and "peer" in line: - # remove only the peer descriptions - line = "Obs :" - new_lines.append(line) - else: - assert "peer" in line - - elif "Caretaker:" in line: - line = line.replace("Caretaker:", "Caretaker says: ") - new_lines.append(line) - - else: - new_lines.append(line) - - return "\n".join(new_lines) - -# def generate_text_obs(obs, info): -# -# text_observation = obs_to_text(info) -# -# llm_prompt = "Obs : " -# llm_prompt += "".join(text_observation) -# -# # add utterances -# if obs["utterance_history"] != "Conversation: \n": -# utt_hist = obs['utterance_history'] -# utt_hist = utt_hist.replace("Conversation: \n","") -# llm_prompt += utt_hist -# -# return llm_prompt - -# def obs_to_text(info): -# image, vis_mask = info["image"], info["vis_mask"] -# carrying = info["carrying"] -# agent_pos_vx, agent_pos_vy = info["agent_pos_vx"], info["agent_pos_vy"] -# npc_actions_dict = info["npc_actions_dict"] -# -# # (OBJECT_TO_IDX[self.type], COLOR_TO_IDX[self.color], state) -# # State, 0: open, 1: closed, 2: locked -# IDX_TO_COLOR = dict(zip(COLOR_TO_IDX.values(), COLOR_TO_IDX.keys())) -# IDX_TO_OBJECT = dict(zip(OBJECT_TO_IDX.values(), OBJECT_TO_IDX.keys())) -# -# list_textual_descriptions = [] -# -# if carrying is not None: -# list_textual_descriptions.append("You carry a {} {}".format(carrying.color, carrying.type)) -# -# # agent_pos_vx, agent_pos_vy = self.get_view_coords(self.agent_pos[0], self.agent_pos[1]) -# -# view_field_dictionary = dict() -# -# for i in range(image.shape[0]): -# for j in range(image.shape[1]): -# if image[i][j][0] != 0 and image[i][j][0] != 1 and image[i][j][0] != 2: -# if i not in view_field_dictionary.keys(): -# view_field_dictionary[i] = dict() -# view_field_dictionary[i][j] = image[i][j] -# else: -# view_field_dictionary[i][j] = image[i][j] -# -# # Find the wall if any -# # We describe a wall only if there is no objects between the agent and the wall in straight line -# -# # Find wall in front -# add_wall_descr = False -# if add_wall_descr: -# j = agent_pos_vy - 1 -# object_seen = False -# while j >= 0 and not object_seen: -# if image[agent_pos_vx][j][0] != 0 and image[agent_pos_vx][j][0] != 1: -# if image[agent_pos_vx][j][0] == 2: -# list_textual_descriptions.append( -# f"A wall is {agent_pos_vy - j} steps in front of you. \n") # forward -# object_seen = True -# else: -# object_seen = True -# j -= 1 -# # Find wall left -# i = agent_pos_vx - 1 -# object_seen = False -# while i >= 0 and not object_seen: -# if image[i][agent_pos_vy][0] != 0 and image[i][agent_pos_vy][0] != 1: -# if image[i][agent_pos_vy][0] == 2: -# list_textual_descriptions.append( -# f"A wall is {agent_pos_vx - i} steps to the left. \n") # left -# object_seen = True -# else: -# object_seen = True -# i -= 1 -# # Find wall right -# i = agent_pos_vx + 1 -# object_seen = False -# while i < image.shape[0] and not object_seen: -# if image[i][agent_pos_vy][0] != 0 and image[i][agent_pos_vy][0] != 1: -# if image[i][agent_pos_vy][0] == 2: -# list_textual_descriptions.append( -# f"A wall is {i - agent_pos_vx} steps to the right. \n") # right -# object_seen = True -# else: -# object_seen = True -# i += 1 -# -# # list_textual_descriptions.append("You see the following objects: ") -# # returns the position of seen objects relative to you -# for i in view_field_dictionary.keys(): -# for j in view_field_dictionary[i].keys(): -# if i != agent_pos_vx or j != agent_pos_vy: -# object = view_field_dictionary[i][j] -# -# # # don't show npc -# # if IDX_TO_OBJECT[object[0]] == "npc": -# # continue -# -# front_dist = agent_pos_vy - j -# left_right_dist = i - agent_pos_vx -# -# loc_descr = "" -# if front_dist == 1 and left_right_dist == 0: -# loc_descr += "Right in front of you " -# -# elif left_right_dist == 1 and front_dist == 0: -# loc_descr += "Just to the right of you" -# -# elif left_right_dist == -1 and front_dist == 0: -# loc_descr += "Just to the left of you" -# -# else: -# front_str = str(front_dist) + " steps in front of you " if front_dist > 0 else "" -# -# loc_descr += front_str -# -# suff = "s" if abs(left_right_dist) > 0 else "" -# and_ = "and" if loc_descr != "" else "" -# -# if left_right_dist < 0: -# left_right_str = f"{and_} {-left_right_dist} step{suff} to the left" -# loc_descr += left_right_str -# -# elif left_right_dist > 0: -# left_right_str = f"{and_} {left_right_dist} step{suff} to the right" -# loc_descr += left_right_str -# -# else: -# left_right_str = "" -# loc_descr += left_right_str -# -# loc_descr += f" there is a " -# -# obj_type = IDX_TO_OBJECT[object[0]] -# if obj_type == "npc": -# IDX_TO_STATE = {0: 'friendly', 1: 'antagonistic'} -# -# description = f"{IDX_TO_STATE[object[2]]} {IDX_TO_COLOR[object[1]]} peer. " -# -# # gaze -# gaze_dir = { -# 0: "towards you", -# 1: "to the left of you", -# 2: "in the same direction as you", -# 3: "to the right of you", -# } -# description += f"It is looking {gaze_dir[object[3]]}. " -# -# # point -# point_dir = { -# 0: "towards you", -# 1: "to the left of you", -# 2: "in the same direction as you", -# 3: "to the right of you", -# } -# -# if object[4] != 255: -# description += f"It is pointing {point_dir[object[4]]}. " -# -# # last action -# last_action = {v: k for k, v in npc_actions_dict.items()}[object[5]] -# -# last_action = { -# "go_forward": "foward", -# "rotate_left": "turn left", -# "rotate_right": "turn right", -# "toggle_action": "toggle", -# "point_stop_point": "stop pointing", -# "point_E": "", -# "point_S": "", -# "point_W": "", -# "point_N": "", -# "stop_point": "stop pointing", -# "no_op": "" -# }[last_action] -# -# if last_action not in ["no_op", ""]: -# description += f"It's last action is {last_action}. " -# -# elif obj_type in ["switch", "apple", "generatorplatform", "marble", "marbletee", "fence"]: -# # todo: this assumes that Switch.no_light == True -# description = f"{IDX_TO_COLOR[object[1]]} {IDX_TO_OBJECT[object[0]]} " -# assert object[2:].mean() == 0 -# -# elif obj_type == "lockablebox": -# IDX_TO_STATE = {0: 'open', 1: 'closed', 2: 'locked'} -# description = f"{IDX_TO_STATE[object[2]]} {IDX_TO_COLOR[object[1]]} {IDX_TO_OBJECT[object[0]]} " -# assert object[3:].mean() == 0 -# -# elif obj_type == "applegenerator": -# IDX_TO_STATE = {1: 'square', 2: 'round'} -# description = f"{IDX_TO_STATE[object[2]]} {IDX_TO_COLOR[object[1]]} {IDX_TO_OBJECT[object[0]]} " -# assert object[3:].mean() == 0 -# -# elif obj_type == "remotedoor": -# IDX_TO_STATE = {0: 'open', 1: 'closed'} -# description = f"{IDX_TO_STATE[object[2]]} {IDX_TO_COLOR[object[1]]} {IDX_TO_OBJECT[object[0]]} " -# assert object[3:].mean() == 0 -# -# elif obj_type == "door": -# IDX_TO_STATE = {0: 'open', 1: 'closed', 2: 'locked'} -# description = f"{IDX_TO_STATE[object[2]]} {IDX_TO_COLOR[object[1]]} {IDX_TO_OBJECT[object[0]]} " -# assert object[3:].mean() == 0 -# -# elif obj_type == "lever": -# IDX_TO_STATE = {1: 'activated', 0: 'unactivated'} -# if object[3] == 255: -# countdown_txt = "" -# else: -# countdown_txt = f"with {object[3]} timesteps left. " -# -# description = f"{IDX_TO_STATE[object[2]]} {IDX_TO_COLOR[object[1]]} {IDX_TO_OBJECT[object[0]]} {countdown_txt}" -# -# assert object[4:].mean() == 0 -# else: -# raise ValueError(f"Undefined object type {obj_type}") -# -# full_destr = loc_descr + description + "\n" -# -# list_textual_descriptions.append(full_destr) -# -# if len(list_textual_descriptions) == 0: -# list_textual_descriptions.append("\n") -# -# return list_textual_descriptions - -def plt_2_rgb(env): - # data = np.frombuffer(env.window.fig.canvas.tostring_rgb(), dtype=np.uint8) - # data = data.reshape(env.window.fig.canvas.get_width_height()[::-1] + (3,)) - - width, height = env.window.fig.get_size_inches() * env.window.fig.get_dpi() - data = np.fromstring(env.window.fig.canvas.tostring_rgb(), dtype='uint8').reshape(int(height), int(width), 3) - return data - - -def reset(env): - env.reset() - # a dirty trick just to get obs and info - return env.step([np.nan, np.nan, np.nan]) - # return step("no_op") - -def generate(text_input, model): - # return "(a) move forward" - if model == "dummy": - print("dummy action forward") - return "move forward" - - elif model == "interactive": - return input("Enter action:") - - elif model == "random": - print("random agent") - - print("PROMPT:") - print(text_input) - return random.choice([ - "move forward", - "turn left", - "turn right", - "toggle", - ]) - - elif model in ["gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-4-0613", "gpt-4-0314"]: - while True: - try: - c = openai.ChatCompletion.create( - model=model, - messages=[ - # {"role": "system", "content": ""}, - # {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, - # {"role": "user", "content": "Continue the following text in the most logical way.\n"+text_input} - - # {"role": "system", "content": - # "You are an agent and can use the following actions: 'move forward', 'toggle', 'turn left', 'turn right', 'done'." - # # "The caretaker will say the color of the box which you should open. Turn until you find this box and toggle it when it is right in front of it." - # # "Then an apple will appear and you can toggle it to succeed." - # }, - {"role": "user", "content": text_input} - ], - max_tokens=3, - n=1, - temperature=0.0, - request_timeout=30, - ) - break - except Exception as e: - print(e) - print("Pausing") - time.sleep(10) - continue - print("->LLM generation: ", c['choices'][0]['message']['content']) - return c['choices'][0]['message']['content'] - - elif re.match(r"text-.*-\d{3}", model) or model in ["gpt-3.5-turbo-instruct-0914"]: - while True: - try: - response = openai.Completion.create( - model=model, - prompt=text_input, - # temperature=0.7, - temperature=0.0, - max_tokens=3, - top_p=1, - frequency_penalty=0, - presence_penalty=0, - timeout=30 - ) - break - - except Exception as e: - print(e) - print("Pausing") - time.sleep(10) - continue - - choices = response["choices"] - assert len(choices) == 1 - return choices[0]["text"].strip().lower() # remove newline from the end - - elif model in ["gpt2_large", "api_bloom"]: - # HF_TOKEN = os.getenv("HF_TOKEN") - if model == "gpt2_large": - API_URL = "https://api-inference.huggingface.co/models/gpt2-large" - - elif model == "api_bloom": - API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom" - - else: - raise ValueError(f"Undefined model {model}.") - - headers = {"Authorization": f"Bearer {HF_TOKEN}"} - - def query(text_prompt, n_tokens=3): - - input = text_prompt - - # make n_tokens request and append the output each time - one request generates one token - - for _ in range(n_tokens): - # prepare request - payload = { - "inputs": input, - "parameters": { - "do_sample": False, - 'temperature': 0, - 'wait_for_model': True, - # "max_length": 500, # for gpt2 - # "max_new_tokens": 250 # fot gpt2-xl - }, - } - data = json.dumps(payload) - - # request - response = requests.request("POST", API_URL, headers=headers, data=data) - response_json = json.loads(response.content.decode("utf-8")) - - if type(response_json) is list and len(response_json) == 1: - # generated_text contains the input + the response - response_full_text = response_json[0]['generated_text'] - - # we use this as the next input - input = response_full_text - - else: - print("Invalid request to huggingface api") - from IPython import embed; embed() - - # remove the prompt from the beginning - assert response_full_text.startswith(text_prompt) - response_text = response_full_text[len(text_prompt):] - - return response_text - - response = query(text_input).strip().lower() - return response - - elif model in ["bloom_560m"]: - # from transformers import BloomForCausalLM - # from transformers import BloomTokenizerFast - # - # tokenizer = BloomTokenizerFast.from_pretrained("bigscience/bloom-560m", cache_dir=".cache/huggingface/") - # model = BloomForCausalLM.from_pretrained("bigscience/bloom-560m", cache_dir=".cache/huggingface/") - - inputs = hf_tokenizer(text_input, return_tensors="pt") - # 3 words - result_length = inputs['input_ids'].shape[-1]+3 - full_output = hf_tokenizer.decode(hf_model.generate(inputs["input_ids"], max_length=result_length)[0]) - - assert full_output.startswith(text_input) - response = full_output[len(text_input):] - - response = response.strip().lower() - - return response - - else: - raise ValueError("Unknown model.") - - -def estimate_tokens_selenium(prompt): - # selenium is used because python3.9 is needed for tiktoken - - from selenium import webdriver - from selenium.webdriver.common.by import By - from selenium.webdriver.support.ui import WebDriverWait - from selenium.webdriver.support import expected_conditions as EC - import time - - # Initialize the WebDriver instance - options = webdriver.ChromeOptions() - options.add_argument('headless') - - # set up the driver - driver = webdriver.Chrome(options=options) - - # Navigate to the website - driver.get('https://platform.openai.com/tokenizer') - - text_input = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div/div[2]/div[3]/textarea') - text_input.clear() - text_input.send_keys(prompt) - - n_tokens = 0 - while n_tokens == 0: - time.sleep(1) - # Wait for the response to be loaded - wait = WebDriverWait(driver, 10) - response = wait.until( - EC.presence_of_element_located((By.CSS_SELECTOR, 'div.tokenizer-stat:nth-child(1) > div:nth-child(2)'))) - n_tokens = int(response.text.replace(",", "")) - - - # Close the WebDriver instance - driver.quit() - return n_tokens - - -def load_in_context_examples(in_context_episodes): - in_context_examples = "" - print(f'Loading {len(in_context_episodes)} examples.') - for episode_data in in_context_episodes: - - in_context_examples += new_episode_marker() - - for step_i, step_data in enumerate(episode_data): - - action = step_data["action"] - info = step_data["info"] - obs = step_data["obs"] - reward = step_data["reward"] - done = step_data["done"] - - if step_i == 0: - # step 0 is the initial state of the environment - assert action is None - prompt_action_text = "" - - else: - prompt_action_text = action_to_prompt_action_text(action) - - text_obs = generate_text_obs(obs, info) - step_text = prompt_preprocessor(prompt_action_text + text_obs) - - in_context_examples += step_text - - if done: - if reward > 0: - in_context_examples += success_marker() - else: - in_context_examples += failure_marker() - - else: - # in all envs reward is given in the end - # in the initial step rewards is None - assert reward == 0 or (step_i == 0 and reward is None) - - print("-------------------------- IN CONTEXT EXAMPLES --------------------------") - print(in_context_examples) - print("-------------------------------------------------------------------------") - - return in_context_examples - - -if __name__ == "__main__": - - # Parse arguments - parser = argparse.ArgumentParser() - parser.add_argument("--model", required=False, - help="text-ada-001") - parser.add_argument("--seed", type=int, default=0, - help="Seed of the first episode. The seed for the following episodes will be used in order: seed, seed + 1, ... seed + (n_episodes-1) (default: 0)") - parser.add_argument("--max-steps", type=int, default=15, - help="max num of steps") - parser.add_argument("--shift", type=int, default=0, - help="number of times the environment is reset at the beginning (default: 0)") - parser.add_argument("--argmax", action="store_true", default=False, - help="select the action with highest probability (default: False)") - parser.add_argument("--pause", type=float, default=0.5, - help="pause duration between two consequent actions of the agent (default: 0.5)") - parser.add_argument("--env-name", type=str, - default="SocialAI-AsocialBoxInformationSeekingParamEnv-v1", - # default="SocialAI-ColorBoxesLLMCSParamEnv-v1", - required=False, - help="env name") - parser.add_argument("--in-context-path", type=str, - # old - # default='llm_data/in_context_asocial_box.txt' - # default='llm_data/in_context_color_boxes.txt', - # new - # asocial box - default='llm_data/in_context_examples/in_context_asocialbox_SocialAI-AsocialBoxInformationSeekingParamEnv-v1_2023_07_19_19_28_48/episodes.pkl', - # colorbox - # default='llm_data/in_context_examples/in_context_colorbox_SocialAI-ColorBoxesLLMCSParamEnv-v1_2023_07_20_13_11_54/episodes.pkl', - required=False, - help="path to in context examples") - parser.add_argument("--episodes", type=int, default=10, - help="number of episodes to visualize") - parser.add_argument("--env-args", nargs='*', default=None) - parser.add_argument("--agent_view", default=False, help="draw the agent sees (partially observable view)", action='store_true' ) - parser.add_argument("--tile_size", type=int, help="size at which to render tiles", default=32 ) - parser.add_argument("--mask-unobserved", default=False, help="mask cells that are not observed by the agent", action='store_true' ) - parser.add_argument("--log", type=str, default="llm_log/episodes_log", help="log from the run", required=False) - parser.add_argument("--feed-full-ep", default=False, help="weather to append the whole episode to the prompt", action='store_true') - parser.add_argument("--last-n", type=int, help="how many last steps to provide in observation (if not feed-full-ep)", default=3) - parser.add_argument("--skip-check", default=False, help="Don't estimate the price.", action="store_true") - - args = parser.parse_args() - - # Set seed for all randomness sources - - seed(args.seed) - - model = args.model - - - in_context_examples_path = args.in_context_path - - # test for paper: remove later - if "asocialbox" in in_context_examples_path: - assert args.env_name == "SocialAI-AsocialBoxInformationSeekingParamEnv-v1" - elif "colorbox" in in_context_examples_path: - assert args.env_name == "SocialAI-ColorBoxesLLMCSParamEnv-v1" - - - print("env name:", args.env_name) - print("examples:", in_context_examples_path) - print("model:", args.model) - - # datetime - now = datetime.now() - datetime_string = now.strftime("%d_%m_%Y_%H:%M:%S") - print(datetime_string) - - # log filenames - - log_folder = args.log+"_"+datetime_string+"/" - os.mkdir(log_folder) - evaluation_log_filename = log_folder+"evaluation_log.json" - prompt_log_filename = log_folder + "prompt_log.txt" - ep_h_log_filename = log_folder+"episode_history_query.txt" - gif_savename = log_folder + "demo.gif" - - - env_args = env_args_str_to_dict(args.env_args) - env = make_env(args.env_name, args.seed, env_args) - - # env = gym.make(args.env_name, **env_args) - print(f"Environment {args.env_name} and args: {env_args_str_to_dict(args.env_args)}\n") - - # Define agent - print("Agent loaded\n") - - # prepare models - model_instance = None - - if "text" in args.model or "gpt-3" in args.model or "gpt-4" in args.model: - import openai - openai.api_key = os.getenv("OPENAI_API_KEY") - - elif args.model in ["gpt2_large", "api_bloom"]: - HF_TOKEN = os.getenv("HF_TOKEN") - - elif args.model in ["bloom_560m"]: - from transformers import BloomForCausalLM - from transformers import BloomTokenizerFast - - hf_tokenizer = BloomTokenizerFast.from_pretrained("bigscience/bloom-560m", cache_dir=".cache/huggingface/") - hf_model = BloomForCausalLM.from_pretrained("bigscience/bloom-560m", cache_dir=".cache/huggingface/") - - elif args.model in ["bloom"]: - from transformers import BloomForCausalLM - from transformers import BloomTokenizerFast - - hf_tokenizer = BloomTokenizerFast.from_pretrained("bigscience/bloom", cache_dir=".cache/huggingface/") - hf_model = BloomForCausalLM.from_pretrained("bigscience/bloom", cache_dir=".cache/huggingface/") - - model_instance = (hf_tokenizer, hf_model) - - with open(in_context_examples_path, "rb") as f: - in_context_episodes = pickle.load(f) - - in_context_examples = load_in_context_examples(in_context_episodes) - - with open(prompt_log_filename, "a+") as f: - f.write(datetime_string) - - with open(ep_h_log_filename, "a+") as f: - f.write(datetime_string) - - full_episode_history = args.feed_full_ep - last_n=args.last_n - - if full_episode_history: - print("Full episode history.") - else: - print(f"Last {args.last_n} steps.") - - if not args.skip_check and not args.model in ["dummy", "random", "interactive"]: - print(f"Estimating price for model {args.model}.") - in_context_n_tokens = estimate_tokens_selenium(in_context_examples) - - n_in_context_steps = sum([len(ep) for ep in in_context_episodes]) - tokens_per_step = in_context_n_tokens / n_in_context_steps - - _, price = estimate_price( - num_of_episodes=args.episodes, - in_context_len=in_context_n_tokens, - tokens_per_step=tokens_per_step, - n_steps=args.max_steps, - last_n=last_n, - model=args.model, - feed_episode_history=full_episode_history - ) - input(f"You will spend: {price} dollars. ok?") - - # prepare frames list to save to gif - frames = [] - - assert args.max_steps <= 20 - - success_rates = [] - # episodes start - for episode in range(args.episodes): - print("Episode:", episode) - episode_history_text = new_episode_marker() - - success = False - episode_seed = args.seed + episode - env = make_env(args.env_name, episode_seed, env_args) - - with open(prompt_log_filename, "a+") as f: - f.write("\n\n") - - observations = [] - actions = [] - for i in range(int(args.max_steps)): - - if i == 0: - obs, reward, done, info = reset(env) - prompt_action_text = "" - - else: - with open(prompt_log_filename, "a+") as f: - f.write("\nnew prompt: -----------------------------------\n") - f.write(llm_prompt) - - # querry the model - generation = generate(llm_prompt, args.model) - - # parse the action - text_action = get_parsed_action(generation) - - # get the raw action - action = text_action_to_action(text_action) - - # execute the action - obs, reward, done, info = env.step(action) - - prompt_action_text = f"{action_query()} {text_action}\n" - - assert action_to_prompt_action_text(action) == prompt_action_text - - actions.append(prompt_action_text) - - text_obs = generate_text_obs(obs, info) - observations.append(text_obs) - - step_text = prompt_preprocessor(prompt_action_text + text_obs) - print("Step text:") - print(step_text) - - episode_history_text += step_text # append to history of this episode - - if full_episode_history: - # feed full episode history - llm_prompt = in_context_examples + episode_history_text + action_query() - - else: - n = min(last_n, len(observations)) - obs = observations[-n:] - act = (actions + [action_query()])[-n:] - - episode_text = "".join([o+a for o, a in zip(obs, act)]) - - llm_prompt = in_context_examples + new_episode_marker() + episode_text - - llm_prompt = prompt_preprocessor(llm_prompt) - - # save the image - env.render(mode="human") - rgb_img = plt_2_rgb(env) - frames.append(rgb_img) - - if env.current_env.box.blocked and not env.current_env.box.is_open: - # target box is blocked -> apple can't be obtained - # break to save compute - break - - if done: - # quadruple last frame to pause between episodes - for i in range(3): - same_img = np.copy(rgb_img) - # toggle a pixel between frames to avoid cropping when going from gif to mp4 - same_img[0, 0, 2] = 0 if (i % 2) == 0 else 255 - frames.append(same_img) - - if reward > 0: - print("Success!") - - - episode_history_text += success_marker() - success = True - else: - episode_history_text += failure_marker() - - with open(ep_h_log_filename, "a+") as f: - f.write("\nnew prompt: -----------------------------------\n") - f.write(episode_history_text) - - break - - else: - with open(ep_h_log_filename, "a+") as f: - f.write("\nnew prompt: -----------------------------------\n") - f.write(episode_history_text) - - print(f"{'Success' if success else 'Failure'}") - success_rates.append(success) - - mean_success_rate = np.mean(success_rates) - print("Success rate:", mean_success_rate) - print(f"Saving gif to {gif_savename}.") - mimsave(gif_savename, frames, duration=args.pause) - - print("Done.") - - log_data_dict = vars(args) - log_data_dict["success_rates"] = success_rates - log_data_dict["mean_success_rate"] = mean_success_rate - - print("Evaluation log: ", evaluation_log_filename) - with open(evaluation_log_filename, "w") as f: - f.write(json.dumps(log_data_dict)) diff --git a/spaces/freddyaboulton/gradio_pdf/src/backend/gradio_pdf/templates/example/index.js b/spaces/freddyaboulton/gradio_pdf/src/backend/gradio_pdf/templates/example/index.js deleted file mode 100644 index 2a747d30019883117bd611067771bb31404023e7..0000000000000000000000000000000000000000 --- a/spaces/freddyaboulton/gradio_pdf/src/backend/gradio_pdf/templates/example/index.js +++ /dev/null @@ -1,12261 +0,0 @@ -var Zi = Object.defineProperty; -var ts = (dt, d, et) => d in dt ? Zi(dt, d, { enumerable: !0, configurable: !0, writable: !0, value: et }) : dt[d] = et; -var ee = (dt, d, et) => (ts(dt, typeof d != "symbol" ? d + "" : d, et), et), Ne = (dt, d, et) => { - if (!d.has(dt)) - throw TypeError("Cannot " + et); -}; -var t = (dt, d, et) => (Ne(dt, d, "read from private field"), et ? et.call(dt) : d.get(dt)), L = (dt, d, et) => { - if (d.has(dt)) - throw TypeError("Cannot add the same private member more than once"); - d instanceof WeakSet ? d.add(dt) : d.set(dt, et); -}, Z = (dt, d, et, l) => (Ne(dt, d, "write to private field"), l ? l.call(dt, et) : d.set(dt, et), et); -var ge = (dt, d, et, l) => ({ - set _(P) { - Z(dt, d, P, et); - }, - get _() { - return t(dt, d, l); - } -}), W = (dt, d, et) => (Ne(dt, d, "access private method"), et); -function getDefaultExportFromCjs(dt) { - return dt && dt.__esModule && Object.prototype.hasOwnProperty.call(dt, "default") ? dt.default : dt; -} -function getAugmentedNamespace(dt) { - if (dt.__esModule) - return dt; - var d = dt.default; - if (typeof d == "function") { - var et = function l() { - return this instanceof l ? Reflect.construct(d, arguments, this.constructor) : d.apply(this, arguments); - }; - et.prototype = d.prototype; - } else - et = {}; - return Object.defineProperty(et, "__esModule", { value: !0 }), Object.keys(dt).forEach(function(l) { - var P = Object.getOwnPropertyDescriptor(dt, l); - Object.defineProperty(et, l, P.get ? P : { - enumerable: !0, - get: function() { - return dt[l]; - } - }); - }), et; -} -function commonjsRequire(dt) { - throw new Error('Could not dynamically require "' + dt + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); -} -var pdf = { exports: {} }; -const __viteBrowserExternal = {}, __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - default: __viteBrowserExternal -}, Symbol.toStringTag, { value: "Module" })), require$$5 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1); -(function(module, exports) { - (function(d, et) { - module.exports = d.pdfjsLib = et(); - })(globalThis, () => ( - /******/ - (() => { - var __webpack_modules__ = [ - , - /* 1 */ - /***/ - (dt, d) => { - var $t; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.VerbosityLevel = d.Util = d.UnknownErrorException = d.UnexpectedResponseException = d.TextRenderingMode = d.RenderingIntentFlag = d.PromiseCapability = d.PermissionFlag = d.PasswordResponses = d.PasswordException = d.PageActionEventType = d.OPS = d.MissingPDFException = d.MAX_IMAGE_SIZE_TO_CACHE = d.LINE_FACTOR = d.LINE_DESCENT_FACTOR = d.InvalidPDFException = d.ImageKind = d.IDENTITY_MATRIX = d.FormatError = d.FeatureTest = d.FONT_IDENTITY_MATRIX = d.DocumentActionEventType = d.CMapCompressionType = d.BaseException = d.BASELINE_FACTOR = d.AnnotationType = d.AnnotationReplyType = d.AnnotationPrefix = d.AnnotationMode = d.AnnotationFlag = d.AnnotationFieldFlag = d.AnnotationEditorType = d.AnnotationEditorPrefix = d.AnnotationEditorParamsType = d.AnnotationBorderStyleType = d.AnnotationActionEventType = d.AbortException = void 0, d.assert = lt, d.bytesToString = N, d.createValidAbsoluteUrl = wt, d.getModificationDate = Ct, d.getUuid = Vt, d.getVerbosityLevel = V, d.info = st, d.isArrayBuffer = ht, d.isArrayEqual = Et, d.isNodeJS = void 0, d.normalizeUnicode = Xt, d.objectFromMap = ct, d.objectSize = nt, d.setVerbosityLevel = E, d.shadow = xt, d.string32 = Q, d.stringToBytes = tt, d.stringToPDFString = ft, d.stringToUTF8String = K, d.unreachable = H, d.utf8StringToString = J, d.warn = at; - const et = typeof process == "object" && process + "" == "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"); - d.isNodeJS = et; - const l = [1, 0, 0, 1, 0, 0]; - d.IDENTITY_MATRIX = l; - const P = [1e-3, 0, 0, 1e-3, 0, 0]; - d.FONT_IDENTITY_MATRIX = P; - const rt = 1e7; - d.MAX_IMAGE_SIZE_TO_CACHE = rt; - const X = 1.35; - d.LINE_FACTOR = X; - const pt = 0.35; - d.LINE_DESCENT_FACTOR = pt; - const B = pt / X; - d.BASELINE_FACTOR = B; - const F = { - ANY: 1, - DISPLAY: 2, - PRINT: 4, - SAVE: 8, - ANNOTATIONS_FORMS: 16, - ANNOTATIONS_STORAGE: 32, - ANNOTATIONS_DISABLE: 64, - OPLIST: 256 - }; - d.RenderingIntentFlag = F; - const g = { - DISABLE: 0, - ENABLE: 1, - ENABLE_FORMS: 2, - ENABLE_STORAGE: 3 - }; - d.AnnotationMode = g; - const O = "pdfjs_internal_editor_"; - d.AnnotationEditorPrefix = O; - const I = { - DISABLE: -1, - NONE: 0, - FREETEXT: 3, - STAMP: 13, - INK: 15 - }; - d.AnnotationEditorType = I; - const x = { - RESIZE: 1, - CREATE: 2, - FREETEXT_SIZE: 11, - FREETEXT_COLOR: 12, - FREETEXT_OPACITY: 13, - INK_COLOR: 21, - INK_THICKNESS: 22, - INK_OPACITY: 23 - }; - d.AnnotationEditorParamsType = x; - const v = { - PRINT: 4, - MODIFY_CONTENTS: 8, - COPY: 16, - MODIFY_ANNOTATIONS: 32, - FILL_INTERACTIVE_FORMS: 256, - COPY_FOR_ACCESSIBILITY: 512, - ASSEMBLE: 1024, - PRINT_HIGH_QUALITY: 2048 - }; - d.PermissionFlag = v; - const A = { - FILL: 0, - STROKE: 1, - FILL_STROKE: 2, - INVISIBLE: 3, - FILL_ADD_TO_PATH: 4, - STROKE_ADD_TO_PATH: 5, - FILL_STROKE_ADD_TO_PATH: 6, - ADD_TO_PATH: 7, - FILL_STROKE_MASK: 3, - ADD_TO_PATH_FLAG: 4 - }; - d.TextRenderingMode = A; - const u = { - GRAYSCALE_1BPP: 1, - RGB_24BPP: 2, - RGBA_32BPP: 3 - }; - d.ImageKind = u; - const _ = { - TEXT: 1, - LINK: 2, - FREETEXT: 3, - LINE: 4, - SQUARE: 5, - CIRCLE: 6, - POLYGON: 7, - POLYLINE: 8, - HIGHLIGHT: 9, - UNDERLINE: 10, - SQUIGGLY: 11, - STRIKEOUT: 12, - STAMP: 13, - CARET: 14, - INK: 15, - POPUP: 16, - FILEATTACHMENT: 17, - SOUND: 18, - MOVIE: 19, - WIDGET: 20, - SCREEN: 21, - PRINTERMARK: 22, - TRAPNET: 23, - WATERMARK: 24, - THREED: 25, - REDACT: 26 - }; - d.AnnotationType = _; - const w = { - GROUP: "Group", - REPLY: "R" - }; - d.AnnotationReplyType = w; - const C = { - INVISIBLE: 1, - HIDDEN: 2, - PRINT: 4, - NOZOOM: 8, - NOROTATE: 16, - NOVIEW: 32, - READONLY: 64, - LOCKED: 128, - TOGGLENOVIEW: 256, - LOCKEDCONTENTS: 512 - }; - d.AnnotationFlag = C; - const y = { - READONLY: 1, - REQUIRED: 2, - NOEXPORT: 4, - MULTILINE: 4096, - PASSWORD: 8192, - NOTOGGLETOOFF: 16384, - RADIO: 32768, - PUSHBUTTON: 65536, - COMBO: 131072, - EDIT: 262144, - SORT: 524288, - FILESELECT: 1048576, - MULTISELECT: 2097152, - DONOTSPELLCHECK: 4194304, - DONOTSCROLL: 8388608, - COMB: 16777216, - RICHTEXT: 33554432, - RADIOSINUNISON: 33554432, - COMMITONSELCHANGE: 67108864 - }; - d.AnnotationFieldFlag = y; - const a = { - SOLID: 1, - DASHED: 2, - BEVELED: 3, - INSET: 4, - UNDERLINE: 5 - }; - d.AnnotationBorderStyleType = a; - const c = { - E: "Mouse Enter", - X: "Mouse Exit", - D: "Mouse Down", - U: "Mouse Up", - Fo: "Focus", - Bl: "Blur", - PO: "PageOpen", - PC: "PageClose", - PV: "PageVisible", - PI: "PageInvisible", - K: "Keystroke", - F: "Format", - V: "Validate", - C: "Calculate" - }; - d.AnnotationActionEventType = c; - const k = { - WC: "WillClose", - WS: "WillSave", - DS: "DidSave", - WP: "WillPrint", - DP: "DidPrint" - }; - d.DocumentActionEventType = k; - const p = { - O: "PageOpen", - C: "PageClose" - }; - d.PageActionEventType = p; - const r = { - ERRORS: 0, - WARNINGS: 1, - INFOS: 5 - }; - d.VerbosityLevel = r; - const T = { - NONE: 0, - BINARY: 1 - }; - d.CMapCompressionType = T; - const m = { - dependency: 1, - setLineWidth: 2, - setLineCap: 3, - setLineJoin: 4, - setMiterLimit: 5, - setDash: 6, - setRenderingIntent: 7, - setFlatness: 8, - setGState: 9, - save: 10, - restore: 11, - transform: 12, - moveTo: 13, - lineTo: 14, - curveTo: 15, - curveTo2: 16, - curveTo3: 17, - closePath: 18, - rectangle: 19, - stroke: 20, - closeStroke: 21, - fill: 22, - eoFill: 23, - fillStroke: 24, - eoFillStroke: 25, - closeFillStroke: 26, - closeEOFillStroke: 27, - endPath: 28, - clip: 29, - eoClip: 30, - beginText: 31, - endText: 32, - setCharSpacing: 33, - setWordSpacing: 34, - setHScale: 35, - setLeading: 36, - setFont: 37, - setTextRenderingMode: 38, - setTextRise: 39, - moveText: 40, - setLeadingMoveText: 41, - setTextMatrix: 42, - nextLine: 43, - showText: 44, - showSpacedText: 45, - nextLineShowText: 46, - nextLineSetSpacingShowText: 47, - setCharWidth: 48, - setCharWidthAndBounds: 49, - setStrokeColorSpace: 50, - setFillColorSpace: 51, - setStrokeColor: 52, - setStrokeColorN: 53, - setFillColor: 54, - setFillColorN: 55, - setStrokeGray: 56, - setFillGray: 57, - setStrokeRGBColor: 58, - setFillRGBColor: 59, - setStrokeCMYKColor: 60, - setFillCMYKColor: 61, - shadingFill: 62, - beginInlineImage: 63, - beginImageData: 64, - endInlineImage: 65, - paintXObject: 66, - markPoint: 67, - markPointProps: 68, - beginMarkedContent: 69, - beginMarkedContentProps: 70, - endMarkedContent: 71, - beginCompat: 72, - endCompat: 73, - paintFormXObjectBegin: 74, - paintFormXObjectEnd: 75, - beginGroup: 76, - endGroup: 77, - beginAnnotation: 80, - endAnnotation: 81, - paintImageMaskXObject: 83, - paintImageMaskXObjectGroup: 84, - paintImageXObject: 85, - paintInlineImageXObject: 86, - paintInlineImageXObjectGroup: 87, - paintImageXObjectRepeat: 88, - paintImageMaskXObjectRepeat: 89, - paintSolidColorImageMask: 90, - constructPath: 91 - }; - d.OPS = m; - const U = { - NEED_PASSWORD: 1, - INCORRECT_PASSWORD: 2 - }; - d.PasswordResponses = U; - let z = r.WARNINGS; - function E(ot) { - Number.isInteger(ot) && (z = ot); - } - function V() { - return z; - } - function st(ot) { - z >= r.INFOS && console.log(`Info: ${ot}`); - } - function at(ot) { - z >= r.WARNINGS && console.log(`Warning: ${ot}`); - } - function H(ot) { - throw new Error(ot); - } - function lt(ot, Y) { - ot || H(Y); - } - function gt(ot) { - switch (ot == null ? void 0 : ot.protocol) { - case "http:": - case "https:": - case "ftp:": - case "mailto:": - case "tel:": - return !0; - default: - return !1; - } - } - function wt(ot, Y = null, G = null) { - if (!ot) - return null; - try { - if (G && typeof ot == "string") { - if (G.addDefaultProtocol && ot.startsWith("www.")) { - const At = ot.match(/\./g); - (At == null ? void 0 : At.length) >= 2 && (ot = `http://${ot}`); - } - if (G.tryConvertEncoding) - try { - ot = K(ot); - } catch { - } - } - const bt = Y ? new URL(ot, Y) : new URL(ot); - if (gt(bt)) - return bt; - } catch { - } - return null; - } - function xt(ot, Y, G, bt = !1) { - return Object.defineProperty(ot, Y, { - value: G, - enumerable: !bt, - configurable: !0, - writable: !1 - }), G; - } - const S = function() { - function Y(G, bt) { - this.constructor === Y && H("Cannot initialize BaseException."), this.message = G, this.name = bt; - } - return Y.prototype = new Error(), Y.constructor = Y, Y; - }(); - d.BaseException = S; - class i extends S { - constructor(Y, G) { - super(Y, "PasswordException"), this.code = G; - } - } - d.PasswordException = i; - class n extends S { - constructor(Y, G) { - super(Y, "UnknownErrorException"), this.details = G; - } - } - d.UnknownErrorException = n; - class s extends S { - constructor(Y) { - super(Y, "InvalidPDFException"); - } - } - d.InvalidPDFException = s; - class o extends S { - constructor(Y) { - super(Y, "MissingPDFException"); - } - } - d.MissingPDFException = o; - class h extends S { - constructor(Y, G) { - super(Y, "UnexpectedResponseException"), this.status = G; - } - } - d.UnexpectedResponseException = h; - class b extends S { - constructor(Y) { - super(Y, "FormatError"); - } - } - d.FormatError = b; - class M extends S { - constructor(Y) { - super(Y, "AbortException"); - } - } - d.AbortException = M; - function N(ot) { - (typeof ot != "object" || (ot == null ? void 0 : ot.length) === void 0) && H("Invalid argument for bytesToString"); - const Y = ot.length, G = 8192; - if (Y < G) - return String.fromCharCode.apply(null, ot); - const bt = []; - for (let At = 0; At < Y; At += G) { - const te = Math.min(At + G, Y), Zt = ot.subarray(At, te); - bt.push(String.fromCharCode.apply(null, Zt)); - } - return bt.join(""); - } - function tt(ot) { - typeof ot != "string" && H("Invalid argument for stringToBytes"); - const Y = ot.length, G = new Uint8Array(Y); - for (let bt = 0; bt < Y; ++bt) - G[bt] = ot.charCodeAt(bt) & 255; - return G; - } - function Q(ot) { - return String.fromCharCode(ot >> 24 & 255, ot >> 16 & 255, ot >> 8 & 255, ot & 255); - } - function nt(ot) { - return Object.keys(ot).length; - } - function ct(ot) { - const Y = /* @__PURE__ */ Object.create(null); - for (const [G, bt] of ot) - Y[G] = bt; - return Y; - } - function yt() { - const ot = new Uint8Array(4); - return ot[0] = 1, new Uint32Array(ot.buffer, 0, 1)[0] === 1; - } - function ut() { - try { - return new Function(""), !0; - } catch { - return !1; - } - } - class Ft { - static get isLittleEndian() { - return xt(this, "isLittleEndian", yt()); - } - static get isEvalSupported() { - return xt(this, "isEvalSupported", ut()); - } - static get isOffscreenCanvasSupported() { - return xt(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas < "u"); - } - static get platform() { - return typeof navigator > "u" ? xt(this, "platform", { - isWin: !1, - isMac: !1 - }) : xt(this, "platform", { - isWin: navigator.platform.includes("Win"), - isMac: navigator.platform.includes("Mac") - }); - } - static get isCSSRoundSupported() { - var Y, G; - return xt(this, "isCSSRoundSupported", (G = (Y = globalThis.CSS) == null ? void 0 : Y.supports) == null ? void 0 : G.call(Y, "width: round(1.5px, 1px)")); - } - } - d.FeatureTest = Ft; - const Bt = [...Array(256).keys()].map((ot) => ot.toString(16).padStart(2, "0")); - class St { - static makeHexColor(Y, G, bt) { - return `#${Bt[Y]}${Bt[G]}${Bt[bt]}`; - } - static scaleMinMax(Y, G) { - let bt; - Y[0] ? (Y[0] < 0 && (bt = G[0], G[0] = G[1], G[1] = bt), G[0] *= Y[0], G[1] *= Y[0], Y[3] < 0 && (bt = G[2], G[2] = G[3], G[3] = bt), G[2] *= Y[3], G[3] *= Y[3]) : (bt = G[0], G[0] = G[2], G[2] = bt, bt = G[1], G[1] = G[3], G[3] = bt, Y[1] < 0 && (bt = G[2], G[2] = G[3], G[3] = bt), G[2] *= Y[1], G[3] *= Y[1], Y[2] < 0 && (bt = G[0], G[0] = G[1], G[1] = bt), G[0] *= Y[2], G[1] *= Y[2]), G[0] += Y[4], G[1] += Y[4], G[2] += Y[5], G[3] += Y[5]; - } - static transform(Y, G) { - return [Y[0] * G[0] + Y[2] * G[1], Y[1] * G[0] + Y[3] * G[1], Y[0] * G[2] + Y[2] * G[3], Y[1] * G[2] + Y[3] * G[3], Y[0] * G[4] + Y[2] * G[5] + Y[4], Y[1] * G[4] + Y[3] * G[5] + Y[5]]; - } - static applyTransform(Y, G) { - const bt = Y[0] * G[0] + Y[1] * G[2] + G[4], At = Y[0] * G[1] + Y[1] * G[3] + G[5]; - return [bt, At]; - } - static applyInverseTransform(Y, G) { - const bt = G[0] * G[3] - G[1] * G[2], At = (Y[0] * G[3] - Y[1] * G[2] + G[2] * G[5] - G[4] * G[3]) / bt, te = (-Y[0] * G[1] + Y[1] * G[0] + G[4] * G[1] - G[5] * G[0]) / bt; - return [At, te]; - } - static getAxialAlignedBoundingBox(Y, G) { - const bt = this.applyTransform(Y, G), At = this.applyTransform(Y.slice(2, 4), G), te = this.applyTransform([Y[0], Y[3]], G), Zt = this.applyTransform([Y[2], Y[1]], G); - return [Math.min(bt[0], At[0], te[0], Zt[0]), Math.min(bt[1], At[1], te[1], Zt[1]), Math.max(bt[0], At[0], te[0], Zt[0]), Math.max(bt[1], At[1], te[1], Zt[1])]; - } - static inverseTransform(Y) { - const G = Y[0] * Y[3] - Y[1] * Y[2]; - return [Y[3] / G, -Y[1] / G, -Y[2] / G, Y[0] / G, (Y[2] * Y[5] - Y[4] * Y[3]) / G, (Y[4] * Y[1] - Y[5] * Y[0]) / G]; - } - static singularValueDecompose2dScale(Y) { - const G = [Y[0], Y[2], Y[1], Y[3]], bt = Y[0] * G[0] + Y[1] * G[2], At = Y[0] * G[1] + Y[1] * G[3], te = Y[2] * G[0] + Y[3] * G[2], Zt = Y[2] * G[1] + Y[3] * G[3], $ = (bt + Zt) / 2, vt = Math.sqrt((bt + Zt) ** 2 - 4 * (bt * Zt - te * At)) / 2, Lt = $ + vt || 1, Tt = $ - vt || 1; - return [Math.sqrt(Lt), Math.sqrt(Tt)]; - } - static normalizeRect(Y) { - const G = Y.slice(0); - return Y[0] > Y[2] && (G[0] = Y[2], G[2] = Y[0]), Y[1] > Y[3] && (G[1] = Y[3], G[3] = Y[1]), G; - } - static intersect(Y, G) { - const bt = Math.max(Math.min(Y[0], Y[2]), Math.min(G[0], G[2])), At = Math.min(Math.max(Y[0], Y[2]), Math.max(G[0], G[2])); - if (bt > At) - return null; - const te = Math.max(Math.min(Y[1], Y[3]), Math.min(G[1], G[3])), Zt = Math.min(Math.max(Y[1], Y[3]), Math.max(G[1], G[3])); - return te > Zt ? null : [bt, te, At, Zt]; - } - static bezierBoundingBox(Y, G, bt, At, te, Zt, $, vt) { - const Lt = [], Tt = [[], []]; - let Ot, Nt, Jt, _t, Yt, It, R, e; - for (let q = 0; q < 2; ++q) { - if (q === 0 ? (Nt = 6 * Y - 12 * bt + 6 * te, Ot = -3 * Y + 9 * bt - 9 * te + 3 * $, Jt = 3 * bt - 3 * Y) : (Nt = 6 * G - 12 * At + 6 * Zt, Ot = -3 * G + 9 * At - 9 * Zt + 3 * vt, Jt = 3 * At - 3 * G), Math.abs(Ot) < 1e-12) { - if (Math.abs(Nt) < 1e-12) - continue; - _t = -Jt / Nt, 0 < _t && _t < 1 && Lt.push(_t); - continue; - } - R = Nt * Nt - 4 * Jt * Ot, e = Math.sqrt(R), !(R < 0) && (Yt = (-Nt + e) / (2 * Ot), 0 < Yt && Yt < 1 && Lt.push(Yt), It = (-Nt - e) / (2 * Ot), 0 < It && It < 1 && Lt.push(It)); - } - let f = Lt.length, D; - const j = f; - for (; f--; ) - _t = Lt[f], D = 1 - _t, Tt[0][f] = D * D * D * Y + 3 * D * D * _t * bt + 3 * D * _t * _t * te + _t * _t * _t * $, Tt[1][f] = D * D * D * G + 3 * D * D * _t * At + 3 * D * _t * _t * Zt + _t * _t * _t * vt; - return Tt[0][j] = Y, Tt[1][j] = G, Tt[0][j + 1] = $, Tt[1][j + 1] = vt, Tt[0].length = Tt[1].length = j + 2, [Math.min(...Tt[0]), Math.min(...Tt[1]), Math.max(...Tt[0]), Math.max(...Tt[1])]; - } - } - d.Util = St; - const Dt = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 728, 711, 710, 729, 733, 731, 730, 732, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8226, 8224, 8225, 8230, 8212, 8211, 402, 8260, 8249, 8250, 8722, 8240, 8222, 8220, 8221, 8216, 8217, 8218, 8482, 64257, 64258, 321, 338, 352, 376, 381, 305, 322, 339, 353, 382, 0, 8364]; - function ft(ot) { - if (ot[0] >= "ï") { - let G; - if (ot[0] === "þ" && ot[1] === "ÿ" ? G = "utf-16be" : ot[0] === "ÿ" && ot[1] === "þ" ? G = "utf-16le" : ot[0] === "ï" && ot[1] === "»" && ot[2] === "¿" && (G = "utf-8"), G) - try { - const bt = new TextDecoder(G, { - fatal: !0 - }), At = tt(ot); - return bt.decode(At); - } catch (bt) { - at(`stringToPDFString: "${bt}".`); - } - } - const Y = []; - for (let G = 0, bt = ot.length; G < bt; G++) { - const At = Dt[ot.charCodeAt(G)]; - Y.push(At ? String.fromCharCode(At) : ot.charAt(G)); - } - return Y.join(""); - } - function K(ot) { - return decodeURIComponent(escape(ot)); - } - function J(ot) { - return unescape(encodeURIComponent(ot)); - } - function ht(ot) { - return typeof ot == "object" && (ot == null ? void 0 : ot.byteLength) !== void 0; - } - function Et(ot, Y) { - if (ot.length !== Y.length) - return !1; - for (let G = 0, bt = ot.length; G < bt; G++) - if (ot[G] !== Y[G]) - return !1; - return !0; - } - function Ct(ot = /* @__PURE__ */ new Date()) { - return [ot.getUTCFullYear().toString(), (ot.getUTCMonth() + 1).toString().padStart(2, "0"), ot.getUTCDate().toString().padStart(2, "0"), ot.getUTCHours().toString().padStart(2, "0"), ot.getUTCMinutes().toString().padStart(2, "0"), ot.getUTCSeconds().toString().padStart(2, "0")].join(""); - } - class jt { - constructor() { - L(this, $t, !1); - this.promise = new Promise((Y, G) => { - this.resolve = (bt) => { - Z(this, $t, !0), Y(bt); - }, this.reject = (bt) => { - Z(this, $t, !0), G(bt); - }; - }); - } - get settled() { - return t(this, $t); - } - } - $t = new WeakMap(), d.PromiseCapability = jt; - let Gt = null, Ht = null; - function Xt(ot) { - return Gt || (Gt = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu, Ht = /* @__PURE__ */ new Map([["ſt", "ſt"]])), ot.replaceAll(Gt, (Y, G, bt) => G ? G.normalize("NFKC") : Ht.get(bt)); - } - function Vt() { - if (typeof crypto < "u" && typeof (crypto == null ? void 0 : crypto.randomUUID) == "function") - return crypto.randomUUID(); - const ot = new Uint8Array(32); - if (typeof crypto < "u" && typeof (crypto == null ? void 0 : crypto.getRandomValues) == "function") - crypto.getRandomValues(ot); - else - for (let Y = 0; Y < 32; Y++) - ot[Y] = Math.floor(Math.random() * 255); - return N(ot); - } - const Wt = "pdfjs_internal_id_"; - d.AnnotationPrefix = Wt; - }, - /* 2 */ - /***/ - (__unused_webpack_module, exports, __w_pdfjs_require__) => { - var dt, et, l, P, he, X, Ee, B, F, g, O, I, x, v, A, u, we, w, C, Be, a, c; - Object.defineProperty(exports, "__esModule", { - value: !0 - }), exports.RenderTask = exports.PDFWorkerUtil = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultFilterFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0, Object.defineProperty(exports, "SVGGraphics", { - enumerable: !0, - get: function() { - return _displaySvg.SVGGraphics; - } - }), exports.build = void 0, exports.getDocument = getDocument, exports.version = void 0; - var _util = __w_pdfjs_require__(1), _annotation_storage = __w_pdfjs_require__(3), _display_utils = __w_pdfjs_require__(6), _font_loader = __w_pdfjs_require__(9), _displayNode_utils = __w_pdfjs_require__(10), _canvas = __w_pdfjs_require__(11), _worker_options = __w_pdfjs_require__(14), _message_handler = __w_pdfjs_require__(15), _metadata = __w_pdfjs_require__(16), _optional_content_config = __w_pdfjs_require__(17), _transport_stream = __w_pdfjs_require__(18), _displayFetch_stream = __w_pdfjs_require__(19), _displayNetwork = __w_pdfjs_require__(22), _displayNode_stream = __w_pdfjs_require__(23), _displaySvg = __w_pdfjs_require__(24), _xfa_text = __w_pdfjs_require__(25); - const DEFAULT_RANGE_CHUNK_SIZE = 65536, RENDERING_CANCELLED_TIMEOUT = 100, DELAYED_CLEANUP_TIMEOUT = 5e3, DefaultCanvasFactory = _util.isNodeJS ? _displayNode_utils.NodeCanvasFactory : _display_utils.DOMCanvasFactory; - exports.DefaultCanvasFactory = DefaultCanvasFactory; - const DefaultCMapReaderFactory = _util.isNodeJS ? _displayNode_utils.NodeCMapReaderFactory : _display_utils.DOMCMapReaderFactory; - exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory; - const DefaultFilterFactory = _util.isNodeJS ? _displayNode_utils.NodeFilterFactory : _display_utils.DOMFilterFactory; - exports.DefaultFilterFactory = DefaultFilterFactory; - const DefaultStandardFontDataFactory = _util.isNodeJS ? _displayNode_utils.NodeStandardFontDataFactory : _display_utils.DOMStandardFontDataFactory; - exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory; - function getDocument(p) { - if (typeof p == "string" || p instanceof URL ? p = { - url: p - } : (0, _util.isArrayBuffer)(p) && (p = { - data: p - }), typeof p != "object") - throw new Error("Invalid parameter in getDocument, need parameter object."); - if (!p.url && !p.data && !p.range) - throw new Error("Invalid parameter object: need either .data, .range or .url"); - const r = new PDFDocumentLoadingTask(), { - docId: T - } = r, m = p.url ? getUrlProp(p.url) : null, U = p.data ? getDataProp(p.data) : null, z = p.httpHeaders || null, E = p.withCredentials === !0, V = p.password ?? null, st = p.range instanceof PDFDataRangeTransport ? p.range : null, at = Number.isInteger(p.rangeChunkSize) && p.rangeChunkSize > 0 ? p.rangeChunkSize : DEFAULT_RANGE_CHUNK_SIZE; - let H = p.worker instanceof PDFWorker ? p.worker : null; - const lt = p.verbosity, gt = typeof p.docBaseUrl == "string" && !(0, _display_utils.isDataScheme)(p.docBaseUrl) ? p.docBaseUrl : null, wt = typeof p.cMapUrl == "string" ? p.cMapUrl : null, xt = p.cMapPacked !== !1, S = p.CMapReaderFactory || DefaultCMapReaderFactory, i = typeof p.standardFontDataUrl == "string" ? p.standardFontDataUrl : null, n = p.StandardFontDataFactory || DefaultStandardFontDataFactory, s = p.stopAtErrors !== !0, o = Number.isInteger(p.maxImageSize) && p.maxImageSize > -1 ? p.maxImageSize : -1, h = p.isEvalSupported !== !1, b = typeof p.isOffscreenCanvasSupported == "boolean" ? p.isOffscreenCanvasSupported : !_util.isNodeJS, M = Number.isInteger(p.canvasMaxAreaInBytes) ? p.canvasMaxAreaInBytes : -1, N = typeof p.disableFontFace == "boolean" ? p.disableFontFace : _util.isNodeJS, tt = p.fontExtraProperties === !0, Q = p.enableXfa === !0, nt = p.ownerDocument || globalThis.document, ct = p.disableRange === !0, yt = p.disableStream === !0, ut = p.disableAutoFetch === !0, Ft = p.pdfBug === !0, Bt = st ? st.length : p.length ?? NaN, St = typeof p.useSystemFonts == "boolean" ? p.useSystemFonts : !_util.isNodeJS && !N, Dt = typeof p.useWorkerFetch == "boolean" ? p.useWorkerFetch : S === _display_utils.DOMCMapReaderFactory && n === _display_utils.DOMStandardFontDataFactory && wt && i && (0, _display_utils.isValidFetchUrl)(wt, document.baseURI) && (0, _display_utils.isValidFetchUrl)(i, document.baseURI), ft = p.canvasFactory || new DefaultCanvasFactory({ - ownerDocument: nt - }), K = p.filterFactory || new DefaultFilterFactory({ - docId: T, - ownerDocument: nt - }), J = null; - (0, _util.setVerbosityLevel)(lt); - const ht = { - canvasFactory: ft, - filterFactory: K - }; - if (Dt || (ht.cMapReaderFactory = new S({ - baseUrl: wt, - isCompressed: xt - }), ht.standardFontDataFactory = new n({ - baseUrl: i - })), !H) { - const jt = { - verbosity: lt, - port: _worker_options.GlobalWorkerOptions.workerPort - }; - H = jt.port ? PDFWorker.fromPort(jt) : new PDFWorker(jt), r._worker = H; - } - const Et = { - docId: T, - apiVersion: "3.11.174", - data: U, - password: V, - disableAutoFetch: ut, - rangeChunkSize: at, - length: Bt, - docBaseUrl: gt, - enableXfa: Q, - evaluatorOptions: { - maxImageSize: o, - disableFontFace: N, - ignoreErrors: s, - isEvalSupported: h, - isOffscreenCanvasSupported: b, - canvasMaxAreaInBytes: M, - fontExtraProperties: tt, - useSystemFonts: St, - cMapUrl: Dt ? wt : null, - standardFontDataUrl: Dt ? i : null - } - }, Ct = { - ignoreErrors: s, - isEvalSupported: h, - disableFontFace: N, - fontExtraProperties: tt, - enableXfa: Q, - ownerDocument: nt, - disableAutoFetch: ut, - pdfBug: Ft, - styleElement: J - }; - return H.promise.then(function() { - if (r.destroyed) - throw new Error("Loading aborted"); - const jt = _fetchDocument(H, Et), Gt = new Promise(function(Ht) { - let Xt; - st ? Xt = new _transport_stream.PDFDataTransportStream({ - length: Bt, - initialData: st.initialData, - progressiveDone: st.progressiveDone, - contentDispositionFilename: st.contentDispositionFilename, - disableRange: ct, - disableStream: yt - }, st) : U || (Xt = ((Wt) => _util.isNodeJS ? new _displayNode_stream.PDFNodeStream(Wt) : (0, _display_utils.isValidFetchUrl)(Wt.url) ? new _displayFetch_stream.PDFFetchStream(Wt) : new _displayNetwork.PDFNetworkStream(Wt))({ - url: m, - length: Bt, - httpHeaders: z, - withCredentials: E, - rangeChunkSize: at, - disableRange: ct, - disableStream: yt - })), Ht(Xt); - }); - return Promise.all([jt, Gt]).then(function([Ht, Xt]) { - if (r.destroyed) - throw new Error("Loading aborted"); - const Vt = new _message_handler.MessageHandler(T, Ht, H.port), Wt = new WorkerTransport(Vt, r, Xt, Ct, ht); - r._transport = Wt, Vt.send("Ready", null); - }); - }).catch(r._capability.reject), r; - } - async function _fetchDocument(p, r) { - if (p.destroyed) - throw new Error("Worker was destroyed"); - const T = await p.messageHandler.sendWithPromise("GetDocRequest", r, r.data ? [r.data.buffer] : null); - if (p.destroyed) - throw new Error("Worker was destroyed"); - return T; - } - function getUrlProp(p) { - if (p instanceof URL) - return p.href; - try { - return new URL(p, window.location).href; - } catch { - if (_util.isNodeJS && typeof p == "string") - return p; - } - throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property."); - } - function getDataProp(p) { - if (_util.isNodeJS && typeof Buffer < "u" && p instanceof Buffer) - throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`."); - if (p instanceof Uint8Array && p.byteLength === p.buffer.byteLength) - return p; - if (typeof p == "string") - return (0, _util.stringToBytes)(p); - if (typeof p == "object" && !isNaN(p == null ? void 0 : p.length) || (0, _util.isArrayBuffer)(p)) - return new Uint8Array(p); - throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property."); - } - const d = class d { - constructor() { - this._capability = new _util.PromiseCapability(), this._transport = null, this._worker = null, this.docId = `d${ge(d, dt)._++}`, this.destroyed = !1, this.onPassword = null, this.onProgress = null; - } - get promise() { - return this._capability.promise; - } - async destroy() { - var r, T, m; - this.destroyed = !0; - try { - (r = this._worker) != null && r.port && (this._worker._pendingDestroy = !0), await ((T = this._transport) == null ? void 0 : T.destroy()); - } catch (U) { - throw (m = this._worker) != null && m.port && delete this._worker._pendingDestroy, U; - } - this._transport = null, this._worker && (this._worker.destroy(), this._worker = null); - } - }; - dt = new WeakMap(), L(d, dt, 0); - let PDFDocumentLoadingTask = d; - exports.PDFDocumentLoadingTask = PDFDocumentLoadingTask; - class PDFDataRangeTransport { - constructor(r, T, m = !1, U = null) { - this.length = r, this.initialData = T, this.progressiveDone = m, this.contentDispositionFilename = U, this._rangeListeners = [], this._progressListeners = [], this._progressiveReadListeners = [], this._progressiveDoneListeners = [], this._readyCapability = new _util.PromiseCapability(); - } - addRangeListener(r) { - this._rangeListeners.push(r); - } - addProgressListener(r) { - this._progressListeners.push(r); - } - addProgressiveReadListener(r) { - this._progressiveReadListeners.push(r); - } - addProgressiveDoneListener(r) { - this._progressiveDoneListeners.push(r); - } - onDataRange(r, T) { - for (const m of this._rangeListeners) - m(r, T); - } - onDataProgress(r, T) { - this._readyCapability.promise.then(() => { - for (const m of this._progressListeners) - m(r, T); - }); - } - onDataProgressiveRead(r) { - this._readyCapability.promise.then(() => { - for (const T of this._progressiveReadListeners) - T(r); - }); - } - onDataProgressiveDone() { - this._readyCapability.promise.then(() => { - for (const r of this._progressiveDoneListeners) - r(); - }); - } - transportReady() { - this._readyCapability.resolve(); - } - requestDataRange(r, T) { - (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange"); - } - abort() { - } - } - exports.PDFDataRangeTransport = PDFDataRangeTransport; - class PDFDocumentProxy { - constructor(r, T) { - this._pdfInfo = r, this._transport = T, Object.defineProperty(this, "getJavaScript", { - value: () => ((0, _display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."), this.getJSActions().then((m) => { - if (!m) - return m; - const U = []; - for (const z in m) - U.push(...m[z]); - return U; - })) - }); - } - get annotationStorage() { - return this._transport.annotationStorage; - } - get filterFactory() { - return this._transport.filterFactory; - } - get numPages() { - return this._pdfInfo.numPages; - } - get fingerprints() { - return this._pdfInfo.fingerprints; - } - get isPureXfa() { - return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa); - } - get allXfaHtml() { - return this._transport._htmlForXfa; - } - getPage(r) { - return this._transport.getPage(r); - } - getPageIndex(r) { - return this._transport.getPageIndex(r); - } - getDestinations() { - return this._transport.getDestinations(); - } - getDestination(r) { - return this._transport.getDestination(r); - } - getPageLabels() { - return this._transport.getPageLabels(); - } - getPageLayout() { - return this._transport.getPageLayout(); - } - getPageMode() { - return this._transport.getPageMode(); - } - getViewerPreferences() { - return this._transport.getViewerPreferences(); - } - getOpenAction() { - return this._transport.getOpenAction(); - } - getAttachments() { - return this._transport.getAttachments(); - } - getJSActions() { - return this._transport.getDocJSActions(); - } - getOutline() { - return this._transport.getOutline(); - } - getOptionalContentConfig() { - return this._transport.getOptionalContentConfig(); - } - getPermissions() { - return this._transport.getPermissions(); - } - getMetadata() { - return this._transport.getMetadata(); - } - getMarkInfo() { - return this._transport.getMarkInfo(); - } - getData() { - return this._transport.getData(); - } - saveDocument() { - return this._transport.saveDocument(); - } - getDownloadInfo() { - return this._transport.downloadInfoCapability.promise; - } - cleanup(r = !1) { - return this._transport.startCleanup(r || this.isPureXfa); - } - destroy() { - return this.loadingTask.destroy(); - } - get loadingParams() { - return this._transport.loadingParams; - } - get loadingTask() { - return this._transport.loadingTask; - } - getFieldObjects() { - return this._transport.getFieldObjects(); - } - hasJSActions() { - return this._transport.hasJSActions(); - } - getCalculationOrderIds() { - return this._transport.getCalculationOrderIds(); - } - } - exports.PDFDocumentProxy = PDFDocumentProxy; - class PDFPageProxy { - constructor(r, T, m, U = !1) { - L(this, P); - L(this, X); - L(this, et, null); - L(this, l, !1); - this._pageIndex = r, this._pageInfo = T, this._transport = m, this._stats = U ? new _display_utils.StatTimer() : null, this._pdfBug = U, this.commonObjs = m.commonObjs, this.objs = new PDFObjects(), this._maybeCleanupAfterRender = !1, this._intentStates = /* @__PURE__ */ new Map(), this.destroyed = !1; - } - get pageNumber() { - return this._pageIndex + 1; - } - get rotate() { - return this._pageInfo.rotate; - } - get ref() { - return this._pageInfo.ref; - } - get userUnit() { - return this._pageInfo.userUnit; - } - get view() { - return this._pageInfo.view; - } - getViewport({ - scale: r, - rotation: T = this.rotate, - offsetX: m = 0, - offsetY: U = 0, - dontFlip: z = !1 - } = {}) { - return new _display_utils.PageViewport({ - viewBox: this.view, - scale: r, - rotation: T, - offsetX: m, - offsetY: U, - dontFlip: z - }); - } - getAnnotations({ - intent: r = "display" - } = {}) { - const T = this._transport.getRenderingIntent(r); - return this._transport.getAnnotations(this._pageIndex, T.renderingIntent); - } - getJSActions() { - return this._transport.getPageJSActions(this._pageIndex); - } - get filterFactory() { - return this._transport.filterFactory; - } - get isPureXfa() { - return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa); - } - async getXfa() { - var r; - return ((r = this._transport._htmlForXfa) == null ? void 0 : r.children[this._pageIndex]) || null; - } - render({ - canvasContext: r, - viewport: T, - intent: m = "display", - annotationMode: U = _util.AnnotationMode.ENABLE, - transform: z = null, - background: E = null, - optionalContentConfigPromise: V = null, - annotationCanvasMap: st = null, - pageColors: at = null, - printAnnotationStorage: H = null - }) { - var n, s; - (n = this._stats) == null || n.time("Overall"); - const lt = this._transport.getRenderingIntent(m, U, H); - Z(this, l, !1), W(this, X, Ee).call(this), V || (V = this._transport.getOptionalContentConfig()); - let gt = this._intentStates.get(lt.cacheKey); - gt || (gt = /* @__PURE__ */ Object.create(null), this._intentStates.set(lt.cacheKey, gt)), gt.streamReaderCancelTimeout && (clearTimeout(gt.streamReaderCancelTimeout), gt.streamReaderCancelTimeout = null); - const wt = !!(lt.renderingIntent & _util.RenderingIntentFlag.PRINT); - gt.displayReadyCapability || (gt.displayReadyCapability = new _util.PromiseCapability(), gt.operatorList = { - fnArray: [], - argsArray: [], - lastChunk: !1, - separateAnnots: null - }, (s = this._stats) == null || s.time("Page Request"), this._pumpOperatorList(lt)); - const xt = (o) => { - var h, b; - gt.renderTasks.delete(S), (this._maybeCleanupAfterRender || wt) && Z(this, l, !0), W(this, P, he).call(this, !wt), o ? (S.capability.reject(o), this._abortOperatorList({ - intentState: gt, - reason: o instanceof Error ? o : new Error(o) - })) : S.capability.resolve(), (h = this._stats) == null || h.timeEnd("Rendering"), (b = this._stats) == null || b.timeEnd("Overall"); - }, S = new InternalRenderTask({ - callback: xt, - params: { - canvasContext: r, - viewport: T, - transform: z, - background: E - }, - objs: this.objs, - commonObjs: this.commonObjs, - annotationCanvasMap: st, - operatorList: gt.operatorList, - pageIndex: this._pageIndex, - canvasFactory: this._transport.canvasFactory, - filterFactory: this._transport.filterFactory, - useRequestAnimationFrame: !wt, - pdfBug: this._pdfBug, - pageColors: at - }); - (gt.renderTasks || (gt.renderTasks = /* @__PURE__ */ new Set())).add(S); - const i = S.task; - return Promise.all([gt.displayReadyCapability.promise, V]).then(([o, h]) => { - var b; - if (this.destroyed) { - xt(); - return; - } - (b = this._stats) == null || b.time("Rendering"), S.initializeGraphics({ - transparency: o, - optionalContentConfig: h - }), S.operatorListChanged(); - }).catch(xt), i; - } - getOperatorList({ - intent: r = "display", - annotationMode: T = _util.AnnotationMode.ENABLE, - printAnnotationStorage: m = null - } = {}) { - var st; - function U() { - E.operatorList.lastChunk && (E.opListReadCapability.resolve(E.operatorList), E.renderTasks.delete(V)); - } - const z = this._transport.getRenderingIntent(r, T, m, !0); - let E = this._intentStates.get(z.cacheKey); - E || (E = /* @__PURE__ */ Object.create(null), this._intentStates.set(z.cacheKey, E)); - let V; - return E.opListReadCapability || (V = /* @__PURE__ */ Object.create(null), V.operatorListChanged = U, E.opListReadCapability = new _util.PromiseCapability(), (E.renderTasks || (E.renderTasks = /* @__PURE__ */ new Set())).add(V), E.operatorList = { - fnArray: [], - argsArray: [], - lastChunk: !1, - separateAnnots: null - }, (st = this._stats) == null || st.time("Page Request"), this._pumpOperatorList(z)), E.opListReadCapability.promise; - } - streamTextContent({ - includeMarkedContent: r = !1, - disableNormalization: T = !1 - } = {}) { - return this._transport.messageHandler.sendWithStream("GetTextContent", { - pageIndex: this._pageIndex, - includeMarkedContent: r === !0, - disableNormalization: T === !0 - }, { - highWaterMark: 100, - size(U) { - return U.items.length; - } - }); - } - getTextContent(r = {}) { - if (this._transport._htmlForXfa) - return this.getXfa().then((m) => _xfa_text.XfaText.textContent(m)); - const T = this.streamTextContent(r); - return new Promise(function(m, U) { - function z() { - E.read().then(function({ - value: st, - done: at - }) { - if (at) { - m(V); - return; - } - Object.assign(V.styles, st.styles), V.items.push(...st.items), z(); - }, U); - } - const E = T.getReader(), V = { - items: [], - styles: /* @__PURE__ */ Object.create(null) - }; - z(); - }); - } - getStructTree() { - return this._transport.getStructTree(this._pageIndex); - } - _destroy() { - this.destroyed = !0; - const r = []; - for (const T of this._intentStates.values()) - if (this._abortOperatorList({ - intentState: T, - reason: new Error("Page was destroyed."), - force: !0 - }), !T.opListReadCapability) - for (const m of T.renderTasks) - r.push(m.completed), m.cancel(); - return this.objs.clear(), Z(this, l, !1), W(this, X, Ee).call(this), Promise.all(r); - } - cleanup(r = !1) { - Z(this, l, !0); - const T = W(this, P, he).call(this, !1); - return r && T && this._stats && (this._stats = new _display_utils.StatTimer()), T; - } - _startRenderPage(r, T) { - var U, z; - const m = this._intentStates.get(T); - m && ((U = this._stats) == null || U.timeEnd("Page Request"), (z = m.displayReadyCapability) == null || z.resolve(r)); - } - _renderPageChunk(r, T) { - for (let m = 0, U = r.length; m < U; m++) - T.operatorList.fnArray.push(r.fnArray[m]), T.operatorList.argsArray.push(r.argsArray[m]); - T.operatorList.lastChunk = r.lastChunk, T.operatorList.separateAnnots = r.separateAnnots; - for (const m of T.renderTasks) - m.operatorListChanged(); - r.lastChunk && W(this, P, he).call(this, !0); - } - _pumpOperatorList({ - renderingIntent: r, - cacheKey: T, - annotationStorageSerializable: m - }) { - const { - map: U, - transfers: z - } = m, V = this._transport.messageHandler.sendWithStream("GetOperatorList", { - pageIndex: this._pageIndex, - intent: r, - cacheKey: T, - annotationStorage: U - }, z).getReader(), st = this._intentStates.get(T); - st.streamReader = V; - const at = () => { - V.read().then(({ - value: H, - done: lt - }) => { - if (lt) { - st.streamReader = null; - return; - } - this._transport.destroyed || (this._renderPageChunk(H, st), at()); - }, (H) => { - if (st.streamReader = null, !this._transport.destroyed) { - if (st.operatorList) { - st.operatorList.lastChunk = !0; - for (const lt of st.renderTasks) - lt.operatorListChanged(); - W(this, P, he).call(this, !0); - } - if (st.displayReadyCapability) - st.displayReadyCapability.reject(H); - else if (st.opListReadCapability) - st.opListReadCapability.reject(H); - else - throw H; - } - }); - }; - at(); - } - _abortOperatorList({ - intentState: r, - reason: T, - force: m = !1 - }) { - if (r.streamReader) { - if (r.streamReaderCancelTimeout && (clearTimeout(r.streamReaderCancelTimeout), r.streamReaderCancelTimeout = null), !m) { - if (r.renderTasks.size > 0) - return; - if (T instanceof _display_utils.RenderingCancelledException) { - let U = RENDERING_CANCELLED_TIMEOUT; - T.extraDelay > 0 && T.extraDelay < 1e3 && (U += T.extraDelay), r.streamReaderCancelTimeout = setTimeout(() => { - r.streamReaderCancelTimeout = null, this._abortOperatorList({ - intentState: r, - reason: T, - force: !0 - }); - }, U); - return; - } - } - if (r.streamReader.cancel(new _util.AbortException(T.message)).catch(() => { - }), r.streamReader = null, !this._transport.destroyed) { - for (const [U, z] of this._intentStates) - if (z === r) { - this._intentStates.delete(U); - break; - } - this.cleanup(); - } - } - } - get stats() { - return this._stats; - } - } - et = new WeakMap(), l = new WeakMap(), P = new WeakSet(), he = function(r = !1) { - if (W(this, X, Ee).call(this), !t(this, l) || this.destroyed) - return !1; - if (r) - return Z(this, et, setTimeout(() => { - Z(this, et, null), W(this, P, he).call(this, !1); - }, DELAYED_CLEANUP_TIMEOUT)), !1; - for (const { - renderTasks: T, - operatorList: m - } of this._intentStates.values()) - if (T.size > 0 || !m.lastChunk) - return !1; - return this._intentStates.clear(), this.objs.clear(), Z(this, l, !1), !0; - }, X = new WeakSet(), Ee = function() { - t(this, et) && (clearTimeout(t(this, et)), Z(this, et, null)); - }, exports.PDFPageProxy = PDFPageProxy; - class LoopbackPort { - constructor() { - L(this, B, /* @__PURE__ */ new Set()); - L(this, F, Promise.resolve()); - } - postMessage(r, T) { - const m = { - data: structuredClone(r, T ? { - transfer: T - } : null) - }; - t(this, F).then(() => { - for (const U of t(this, B)) - U.call(this, m); - }); - } - addEventListener(r, T) { - t(this, B).add(T); - } - removeEventListener(r, T) { - t(this, B).delete(T); - } - terminate() { - t(this, B).clear(); - } - } - B = new WeakMap(), F = new WeakMap(), exports.LoopbackPort = LoopbackPort; - const PDFWorkerUtil = { - isWorkerDisabled: !1, - fallbackWorkerSrc: null, - fakeWorkerId: 0 - }; - exports.PDFWorkerUtil = PDFWorkerUtil; - { - if (_util.isNodeJS && typeof commonjsRequire == "function") - PDFWorkerUtil.isWorkerDisabled = !0, PDFWorkerUtil.fallbackWorkerSrc = "./pdf.worker.js"; - else if (typeof document == "object") { - const p = (g = document == null ? void 0 : document.currentScript) == null ? void 0 : g.src; - p && (PDFWorkerUtil.fallbackWorkerSrc = p.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2")); - } - PDFWorkerUtil.isSameOrigin = function(p, r) { - let T; - try { - if (T = new URL(p), !T.origin || T.origin === "null") - return !1; - } catch { - return !1; - } - const m = new URL(r, T); - return T.origin === m.origin; - }, PDFWorkerUtil.createCDNWrapper = function(p) { - const r = `importScripts("${p}");`; - return URL.createObjectURL(new Blob([r])); - }; - } - const _PDFWorker = class _PDFWorker { - constructor({ - name: p = null, - port: r = null, - verbosity: T = (0, _util.getVerbosityLevel)() - } = {}) { - var m; - if (this.name = p, this.destroyed = !1, this.verbosity = T, this._readyCapability = new _util.PromiseCapability(), this._port = null, this._webWorker = null, this._messageHandler = null, r) { - if ((m = t(_PDFWorker, O)) != null && m.has(r)) - throw new Error("Cannot use more than one PDFWorker per port."); - (t(_PDFWorker, O) || Z(_PDFWorker, O, /* @__PURE__ */ new WeakMap())).set(r, this), this._initializeFromPort(r); - return; - } - this._initialize(); - } - get promise() { - return this._readyCapability.promise; - } - get port() { - return this._port; - } - get messageHandler() { - return this._messageHandler; - } - _initializeFromPort(p) { - this._port = p, this._messageHandler = new _message_handler.MessageHandler("main", "worker", p), this._messageHandler.on("ready", function() { - }), this._readyCapability.resolve(), this._messageHandler.send("configure", { - verbosity: this.verbosity - }); - } - _initialize() { - if (!PDFWorkerUtil.isWorkerDisabled && !_PDFWorker._mainThreadWorkerMessageHandler) { - let { - workerSrc: p - } = _PDFWorker; - try { - PDFWorkerUtil.isSameOrigin(window.location.href, p) || (p = PDFWorkerUtil.createCDNWrapper(new URL(p, window.location).href)); - const r = new Worker(p), T = new _message_handler.MessageHandler("main", "worker", r), m = () => { - r.removeEventListener("error", U), T.destroy(), r.terminate(), this.destroyed ? this._readyCapability.reject(new Error("Worker was destroyed")) : this._setupFakeWorker(); - }, U = () => { - this._webWorker || m(); - }; - r.addEventListener("error", U), T.on("test", (E) => { - if (r.removeEventListener("error", U), this.destroyed) { - m(); - return; - } - E ? (this._messageHandler = T, this._port = r, this._webWorker = r, this._readyCapability.resolve(), T.send("configure", { - verbosity: this.verbosity - })) : (this._setupFakeWorker(), T.destroy(), r.terminate()); - }), T.on("ready", (E) => { - if (r.removeEventListener("error", U), this.destroyed) { - m(); - return; - } - try { - z(); - } catch { - this._setupFakeWorker(); - } - }); - const z = () => { - const E = new Uint8Array(); - T.send("test", E, [E.buffer]); - }; - z(); - return; - } catch { - (0, _util.info)("The worker has been disabled."); - } - } - this._setupFakeWorker(); - } - _setupFakeWorker() { - PDFWorkerUtil.isWorkerDisabled || ((0, _util.warn)("Setting up fake worker."), PDFWorkerUtil.isWorkerDisabled = !0), _PDFWorker._setupFakeWorkerGlobal.then((p) => { - if (this.destroyed) { - this._readyCapability.reject(new Error("Worker was destroyed")); - return; - } - const r = new LoopbackPort(); - this._port = r; - const T = `fake${PDFWorkerUtil.fakeWorkerId++}`, m = new _message_handler.MessageHandler(T + "_worker", T, r); - p.setup(m, r); - const U = new _message_handler.MessageHandler(T, T + "_worker", r); - this._messageHandler = U, this._readyCapability.resolve(), U.send("configure", { - verbosity: this.verbosity - }); - }).catch((p) => { - this._readyCapability.reject(new Error(`Setting up fake worker failed: "${p.message}".`)); - }); - } - destroy() { - var p; - this.destroyed = !0, this._webWorker && (this._webWorker.terminate(), this._webWorker = null), (p = t(_PDFWorker, O)) == null || p.delete(this._port), this._port = null, this._messageHandler && (this._messageHandler.destroy(), this._messageHandler = null); - } - static fromPort(p) { - var T; - if (!(p != null && p.port)) - throw new Error("PDFWorker.fromPort - invalid method signature."); - const r = (T = t(this, O)) == null ? void 0 : T.get(p.port); - if (r) { - if (r._pendingDestroy) - throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls."); - return r; - } - return new _PDFWorker(p); - } - static get workerSrc() { - if (_worker_options.GlobalWorkerOptions.workerSrc) - return _worker_options.GlobalWorkerOptions.workerSrc; - if (PDFWorkerUtil.fallbackWorkerSrc !== null) - return _util.isNodeJS || (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'), PDFWorkerUtil.fallbackWorkerSrc; - throw new Error('No "GlobalWorkerOptions.workerSrc" specified.'); - } - static get _mainThreadWorkerMessageHandler() { - var p; - try { - return ((p = globalThis.pdfjsWorker) == null ? void 0 : p.WorkerMessageHandler) || null; - } catch { - return null; - } - } - static get _setupFakeWorkerGlobal() { - const loader = async () => { - const mainWorkerMessageHandler = this._mainThreadWorkerMessageHandler; - if (mainWorkerMessageHandler) - return mainWorkerMessageHandler; - if (_util.isNodeJS && typeof commonjsRequire == "function") { - const worker = eval("require")(this.workerSrc); - return worker.WorkerMessageHandler; - } - return await (0, _display_utils.loadScript)(this.workerSrc), window.pdfjsWorker.WorkerMessageHandler; - }; - return (0, _util.shadow)(this, "_setupFakeWorkerGlobal", loader()); - } - }; - O = new WeakMap(), L(_PDFWorker, O, void 0); - let PDFWorker = _PDFWorker; - exports.PDFWorker = PDFWorker; - class WorkerTransport { - constructor(r, T, m, U, z) { - L(this, u); - L(this, I, /* @__PURE__ */ new Map()); - L(this, x, /* @__PURE__ */ new Map()); - L(this, v, /* @__PURE__ */ new Map()); - L(this, A, null); - this.messageHandler = r, this.loadingTask = T, this.commonObjs = new PDFObjects(), this.fontLoader = new _font_loader.FontLoader({ - ownerDocument: U.ownerDocument, - styleElement: U.styleElement - }), this._params = U, this.canvasFactory = z.canvasFactory, this.filterFactory = z.filterFactory, this.cMapReaderFactory = z.cMapReaderFactory, this.standardFontDataFactory = z.standardFontDataFactory, this.destroyed = !1, this.destroyCapability = null, this._networkStream = m, this._fullReader = null, this._lastProgress = null, this.downloadInfoCapability = new _util.PromiseCapability(), this.setupMessageHandler(); - } - get annotationStorage() { - return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage()); - } - getRenderingIntent(r, T = _util.AnnotationMode.ENABLE, m = null, U = !1) { - let z = _util.RenderingIntentFlag.DISPLAY, E = _annotation_storage.SerializableEmpty; - switch (r) { - case "any": - z = _util.RenderingIntentFlag.ANY; - break; - case "display": - break; - case "print": - z = _util.RenderingIntentFlag.PRINT; - break; - default: - (0, _util.warn)(`getRenderingIntent - invalid intent: ${r}`); - } - switch (T) { - case _util.AnnotationMode.DISABLE: - z += _util.RenderingIntentFlag.ANNOTATIONS_DISABLE; - break; - case _util.AnnotationMode.ENABLE: - break; - case _util.AnnotationMode.ENABLE_FORMS: - z += _util.RenderingIntentFlag.ANNOTATIONS_FORMS; - break; - case _util.AnnotationMode.ENABLE_STORAGE: - z += _util.RenderingIntentFlag.ANNOTATIONS_STORAGE, E = (z & _util.RenderingIntentFlag.PRINT && m instanceof _annotation_storage.PrintAnnotationStorage ? m : this.annotationStorage).serializable; - break; - default: - (0, _util.warn)(`getRenderingIntent - invalid annotationMode: ${T}`); - } - return U && (z += _util.RenderingIntentFlag.OPLIST), { - renderingIntent: z, - cacheKey: `${z}_${E.hash}`, - annotationStorageSerializable: E - }; - } - destroy() { - var m; - if (this.destroyCapability) - return this.destroyCapability.promise; - this.destroyed = !0, this.destroyCapability = new _util.PromiseCapability(), (m = t(this, A)) == null || m.reject(new Error("Worker was destroyed during onPassword callback")); - const r = []; - for (const U of t(this, x).values()) - r.push(U._destroy()); - t(this, x).clear(), t(this, v).clear(), this.hasOwnProperty("annotationStorage") && this.annotationStorage.resetModified(); - const T = this.messageHandler.sendWithPromise("Terminate", null); - return r.push(T), Promise.all(r).then(() => { - var U; - this.commonObjs.clear(), this.fontLoader.clear(), t(this, I).clear(), this.filterFactory.destroy(), (U = this._networkStream) == null || U.cancelAllRequests(new _util.AbortException("Worker was terminated.")), this.messageHandler && (this.messageHandler.destroy(), this.messageHandler = null), this.destroyCapability.resolve(); - }, this.destroyCapability.reject), this.destroyCapability.promise; - } - setupMessageHandler() { - const { - messageHandler: r, - loadingTask: T - } = this; - r.on("GetReader", (m, U) => { - (0, _util.assert)(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (z) => { - this._lastProgress = { - loaded: z.loaded, - total: z.total - }; - }, U.onPull = () => { - this._fullReader.read().then(function({ - value: z, - done: E - }) { - if (E) { - U.close(); - return; - } - (0, _util.assert)(z instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), U.enqueue(new Uint8Array(z), 1, [z]); - }).catch((z) => { - U.error(z); - }); - }, U.onCancel = (z) => { - this._fullReader.cancel(z), U.ready.catch((E) => { - if (!this.destroyed) - throw E; - }); - }; - }), r.on("ReaderHeadersReady", (m) => { - const U = new _util.PromiseCapability(), z = this._fullReader; - return z.headersReady.then(() => { - var E; - (!z.isStreamingSupported || !z.isRangeSupported) && (this._lastProgress && ((E = T.onProgress) == null || E.call(T, this._lastProgress)), z.onProgress = (V) => { - var st; - (st = T.onProgress) == null || st.call(T, { - loaded: V.loaded, - total: V.total - }); - }), U.resolve({ - isStreamingSupported: z.isStreamingSupported, - isRangeSupported: z.isRangeSupported, - contentLength: z.contentLength - }); - }, U.reject), U.promise; - }), r.on("GetRangeReader", (m, U) => { - (0, _util.assert)(this._networkStream, "GetRangeReader - no `IPDFStream` instance available."); - const z = this._networkStream.getRangeReader(m.begin, m.end); - if (!z) { - U.close(); - return; - } - U.onPull = () => { - z.read().then(function({ - value: E, - done: V - }) { - if (V) { - U.close(); - return; - } - (0, _util.assert)(E instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), U.enqueue(new Uint8Array(E), 1, [E]); - }).catch((E) => { - U.error(E); - }); - }, U.onCancel = (E) => { - z.cancel(E), U.ready.catch((V) => { - if (!this.destroyed) - throw V; - }); - }; - }), r.on("GetDoc", ({ - pdfInfo: m - }) => { - this._numPages = m.numPages, this._htmlForXfa = m.htmlForXfa, delete m.htmlForXfa, T._capability.resolve(new PDFDocumentProxy(m, this)); - }), r.on("DocException", function(m) { - let U; - switch (m.name) { - case "PasswordException": - U = new _util.PasswordException(m.message, m.code); - break; - case "InvalidPDFException": - U = new _util.InvalidPDFException(m.message); - break; - case "MissingPDFException": - U = new _util.MissingPDFException(m.message); - break; - case "UnexpectedResponseException": - U = new _util.UnexpectedResponseException(m.message, m.status); - break; - case "UnknownErrorException": - U = new _util.UnknownErrorException(m.message, m.details); - break; - default: - (0, _util.unreachable)("DocException - expected a valid Error."); - } - T._capability.reject(U); - }), r.on("PasswordRequest", (m) => { - if (Z(this, A, new _util.PromiseCapability()), T.onPassword) { - const U = (z) => { - z instanceof Error ? t(this, A).reject(z) : t(this, A).resolve({ - password: z - }); - }; - try { - T.onPassword(U, m.code); - } catch (z) { - t(this, A).reject(z); - } - } else - t(this, A).reject(new _util.PasswordException(m.message, m.code)); - return t(this, A).promise; - }), r.on("DataLoaded", (m) => { - var U; - (U = T.onProgress) == null || U.call(T, { - loaded: m.length, - total: m.length - }), this.downloadInfoCapability.resolve(m); - }), r.on("StartRenderPage", (m) => { - if (this.destroyed) - return; - t(this, x).get(m.pageIndex)._startRenderPage(m.transparency, m.cacheKey); - }), r.on("commonobj", ([m, U, z]) => { - var E; - if (!this.destroyed && !this.commonObjs.has(m)) - switch (U) { - case "Font": - const V = this._params; - if ("error" in z) { - const H = z.error; - (0, _util.warn)(`Error during font loading: ${H}`), this.commonObjs.resolve(m, H); - break; - } - const st = V.pdfBug && ((E = globalThis.FontInspector) != null && E.enabled) ? (H, lt) => globalThis.FontInspector.fontAdded(H, lt) : null, at = new _font_loader.FontFaceObject(z, { - isEvalSupported: V.isEvalSupported, - disableFontFace: V.disableFontFace, - ignoreErrors: V.ignoreErrors, - inspectFont: st - }); - this.fontLoader.bind(at).catch((H) => r.sendWithPromise("FontFallback", { - id: m - })).finally(() => { - !V.fontExtraProperties && at.data && (at.data = null), this.commonObjs.resolve(m, at); - }); - break; - case "FontPath": - case "Image": - case "Pattern": - this.commonObjs.resolve(m, z); - break; - default: - throw new Error(`Got unknown common object type ${U}`); - } - }), r.on("obj", ([m, U, z, E]) => { - var st; - if (this.destroyed) - return; - const V = t(this, x).get(U); - if (!V.objs.has(m)) - switch (z) { - case "Image": - if (V.objs.resolve(m, E), E) { - let at; - if (E.bitmap) { - const { - width: H, - height: lt - } = E; - at = H * lt * 4; - } else - at = ((st = E.data) == null ? void 0 : st.length) || 0; - at > _util.MAX_IMAGE_SIZE_TO_CACHE && (V._maybeCleanupAfterRender = !0); - } - break; - case "Pattern": - V.objs.resolve(m, E); - break; - default: - throw new Error(`Got unknown object type ${z}`); - } - }), r.on("DocProgress", (m) => { - var U; - this.destroyed || (U = T.onProgress) == null || U.call(T, { - loaded: m.loaded, - total: m.total - }); - }), r.on("FetchBuiltInCMap", (m) => this.destroyed ? Promise.reject(new Error("Worker was destroyed.")) : this.cMapReaderFactory ? this.cMapReaderFactory.fetch(m) : Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))), r.on("FetchStandardFontData", (m) => this.destroyed ? Promise.reject(new Error("Worker was destroyed.")) : this.standardFontDataFactory ? this.standardFontDataFactory.fetch(m) : Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))); - } - getData() { - return this.messageHandler.sendWithPromise("GetData", null); - } - saveDocument() { - var m; - this.annotationStorage.size <= 0 && (0, _util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."); - const { - map: r, - transfers: T - } = this.annotationStorage.serializable; - return this.messageHandler.sendWithPromise("SaveDocument", { - isPureXfa: !!this._htmlForXfa, - numPages: this._numPages, - annotationStorage: r, - filename: ((m = this._fullReader) == null ? void 0 : m.filename) ?? null - }, T).finally(() => { - this.annotationStorage.resetModified(); - }); - } - getPage(r) { - if (!Number.isInteger(r) || r <= 0 || r > this._numPages) - return Promise.reject(new Error("Invalid page request.")); - const T = r - 1, m = t(this, v).get(T); - if (m) - return m; - const U = this.messageHandler.sendWithPromise("GetPage", { - pageIndex: T - }).then((z) => { - if (this.destroyed) - throw new Error("Transport destroyed"); - const E = new PDFPageProxy(T, z, this, this._params.pdfBug); - return t(this, x).set(T, E), E; - }); - return t(this, v).set(T, U), U; - } - getPageIndex(r) { - return typeof r != "object" || r === null || !Number.isInteger(r.num) || r.num < 0 || !Number.isInteger(r.gen) || r.gen < 0 ? Promise.reject(new Error("Invalid pageIndex request.")) : this.messageHandler.sendWithPromise("GetPageIndex", { - num: r.num, - gen: r.gen - }); - } - getAnnotations(r, T) { - return this.messageHandler.sendWithPromise("GetAnnotations", { - pageIndex: r, - intent: T - }); - } - getFieldObjects() { - return W(this, u, we).call(this, "GetFieldObjects"); - } - hasJSActions() { - return W(this, u, we).call(this, "HasJSActions"); - } - getCalculationOrderIds() { - return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null); - } - getDestinations() { - return this.messageHandler.sendWithPromise("GetDestinations", null); - } - getDestination(r) { - return typeof r != "string" ? Promise.reject(new Error("Invalid destination request.")) : this.messageHandler.sendWithPromise("GetDestination", { - id: r - }); - } - getPageLabels() { - return this.messageHandler.sendWithPromise("GetPageLabels", null); - } - getPageLayout() { - return this.messageHandler.sendWithPromise("GetPageLayout", null); - } - getPageMode() { - return this.messageHandler.sendWithPromise("GetPageMode", null); - } - getViewerPreferences() { - return this.messageHandler.sendWithPromise("GetViewerPreferences", null); - } - getOpenAction() { - return this.messageHandler.sendWithPromise("GetOpenAction", null); - } - getAttachments() { - return this.messageHandler.sendWithPromise("GetAttachments", null); - } - getDocJSActions() { - return W(this, u, we).call(this, "GetDocJSActions"); - } - getPageJSActions(r) { - return this.messageHandler.sendWithPromise("GetPageJSActions", { - pageIndex: r - }); - } - getStructTree(r) { - return this.messageHandler.sendWithPromise("GetStructTree", { - pageIndex: r - }); - } - getOutline() { - return this.messageHandler.sendWithPromise("GetOutline", null); - } - getOptionalContentConfig() { - return this.messageHandler.sendWithPromise("GetOptionalContentConfig", null).then((r) => new _optional_content_config.OptionalContentConfig(r)); - } - getPermissions() { - return this.messageHandler.sendWithPromise("GetPermissions", null); - } - getMetadata() { - const r = "GetMetadata", T = t(this, I).get(r); - if (T) - return T; - const m = this.messageHandler.sendWithPromise(r, null).then((U) => { - var z, E; - return { - info: U[0], - metadata: U[1] ? new _metadata.Metadata(U[1]) : null, - contentDispositionFilename: ((z = this._fullReader) == null ? void 0 : z.filename) ?? null, - contentLength: ((E = this._fullReader) == null ? void 0 : E.contentLength) ?? null - }; - }); - return t(this, I).set(r, m), m; - } - getMarkInfo() { - return this.messageHandler.sendWithPromise("GetMarkInfo", null); - } - async startCleanup(r = !1) { - if (!this.destroyed) { - await this.messageHandler.sendWithPromise("Cleanup", null); - for (const T of t(this, x).values()) - if (!T.cleanup()) - throw new Error(`startCleanup: Page ${T.pageNumber} is currently rendering.`); - this.commonObjs.clear(), r || this.fontLoader.clear(), t(this, I).clear(), this.filterFactory.destroy(!0); - } - } - get loadingParams() { - const { - disableAutoFetch: r, - enableXfa: T - } = this._params; - return (0, _util.shadow)(this, "loadingParams", { - disableAutoFetch: r, - enableXfa: T - }); - } - } - I = new WeakMap(), x = new WeakMap(), v = new WeakMap(), A = new WeakMap(), u = new WeakSet(), we = function(r, T = null) { - const m = t(this, I).get(r); - if (m) - return m; - const U = this.messageHandler.sendWithPromise(r, T); - return t(this, I).set(r, U), U; - }; - class PDFObjects { - constructor() { - L(this, C); - L(this, w, /* @__PURE__ */ Object.create(null)); - } - get(r, T = null) { - if (T) { - const U = W(this, C, Be).call(this, r); - return U.capability.promise.then(() => T(U.data)), null; - } - const m = t(this, w)[r]; - if (!(m != null && m.capability.settled)) - throw new Error(`Requesting object that isn't resolved yet ${r}.`); - return m.data; - } - has(r) { - const T = t(this, w)[r]; - return (T == null ? void 0 : T.capability.settled) || !1; - } - resolve(r, T = null) { - const m = W(this, C, Be).call(this, r); - m.data = T, m.capability.resolve(); - } - clear() { - var r; - for (const T in t(this, w)) { - const { - data: m - } = t(this, w)[T]; - (r = m == null ? void 0 : m.bitmap) == null || r.close(); - } - Z(this, w, /* @__PURE__ */ Object.create(null)); - } - } - w = new WeakMap(), C = new WeakSet(), Be = function(r) { - var T; - return (T = t(this, w))[r] || (T[r] = { - capability: new _util.PromiseCapability(), - data: null - }); - }; - class RenderTask { - constructor(r) { - L(this, a, null); - Z(this, a, r), this.onContinue = null; - } - get promise() { - return t(this, a).capability.promise; - } - cancel(r = 0) { - t(this, a).cancel(null, r); - } - get separateAnnots() { - const { - separateAnnots: r - } = t(this, a).operatorList; - if (!r) - return !1; - const { - annotationCanvasMap: T - } = t(this, a); - return r.form || r.canvas && (T == null ? void 0 : T.size) > 0; - } - } - a = new WeakMap(), exports.RenderTask = RenderTask; - const k = class k { - constructor({ - callback: r, - params: T, - objs: m, - commonObjs: U, - annotationCanvasMap: z, - operatorList: E, - pageIndex: V, - canvasFactory: st, - filterFactory: at, - useRequestAnimationFrame: H = !1, - pdfBug: lt = !1, - pageColors: gt = null - }) { - this.callback = r, this.params = T, this.objs = m, this.commonObjs = U, this.annotationCanvasMap = z, this.operatorListIdx = null, this.operatorList = E, this._pageIndex = V, this.canvasFactory = st, this.filterFactory = at, this._pdfBug = lt, this.pageColors = gt, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = H === !0 && typeof window < "u", this.cancelled = !1, this.capability = new _util.PromiseCapability(), this.task = new RenderTask(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = T.canvasContext.canvas; - } - get completed() { - return this.capability.promise.catch(function() { - }); - } - initializeGraphics({ - transparency: r = !1, - optionalContentConfig: T - }) { - var V, st; - if (this.cancelled) - return; - if (this._canvas) { - if (t(k, c).has(this._canvas)) - throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed."); - t(k, c).add(this._canvas); - } - this._pdfBug && ((V = globalThis.StepperManager) != null && V.enabled) && (this.stepper = globalThis.StepperManager.create(this._pageIndex), this.stepper.init(this.operatorList), this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint()); - const { - canvasContext: m, - viewport: U, - transform: z, - background: E - } = this.params; - this.gfx = new _canvas.CanvasGraphics(m, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, { - optionalContentConfig: T - }, this.annotationCanvasMap, this.pageColors), this.gfx.beginDrawing({ - transform: z, - viewport: U, - transparency: r, - background: E - }), this.operatorListIdx = 0, this.graphicsReady = !0, (st = this.graphicsReadyCallback) == null || st.call(this); - } - cancel(r = null, T = 0) { - var m; - this.running = !1, this.cancelled = !0, (m = this.gfx) == null || m.endDrawing(), t(k, c).delete(this._canvas), this.callback(r || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, T)); - } - operatorListChanged() { - var r; - if (!this.graphicsReady) { - this.graphicsReadyCallback || (this.graphicsReadyCallback = this._continueBound); - return; - } - (r = this.stepper) == null || r.updateOperatorList(this.operatorList), !this.running && this._continue(); - } - _continue() { - this.running = !0, !this.cancelled && (this.task.onContinue ? this.task.onContinue(this._scheduleNextBound) : this._scheduleNext()); - } - _scheduleNext() { - this._useRequestAnimationFrame ? window.requestAnimationFrame(() => { - this._nextBound().catch(this._cancelBound); - }) : Promise.resolve().then(this._nextBound).catch(this._cancelBound); - } - async _next() { - this.cancelled || (this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper), this.operatorListIdx === this.operatorList.argsArray.length && (this.running = !1, this.operatorList.lastChunk && (this.gfx.endDrawing(), t(k, c).delete(this._canvas), this.callback()))); - } - }; - c = new WeakMap(), L(k, c, /* @__PURE__ */ new WeakSet()); - let InternalRenderTask = k; - const version = "3.11.174"; - exports.version = version; - const build = "ce8716743"; - exports.build = build; - }, - /* 3 */ - /***/ - (dt, d, et) => { - var F, g, O, Ai, x; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.SerializableEmpty = d.PrintAnnotationStorage = d.AnnotationStorage = void 0; - var l = et(1), P = et(4), rt = et(8); - const X = Object.freeze({ - map: null, - hash: "", - transfers: void 0 - }); - d.SerializableEmpty = X; - class pt { - constructor() { - L(this, O); - L(this, F, !1); - L(this, g, /* @__PURE__ */ new Map()); - this.onSetModified = null, this.onResetModified = null, this.onAnnotationEditor = null; - } - getValue(A, u) { - const _ = t(this, g).get(A); - return _ === void 0 ? u : Object.assign(u, _); - } - getRawValue(A) { - return t(this, g).get(A); - } - remove(A) { - if (t(this, g).delete(A), t(this, g).size === 0 && this.resetModified(), typeof this.onAnnotationEditor == "function") { - for (const u of t(this, g).values()) - if (u instanceof P.AnnotationEditor) - return; - this.onAnnotationEditor(null); - } - } - setValue(A, u) { - const _ = t(this, g).get(A); - let w = !1; - if (_ !== void 0) - for (const [C, y] of Object.entries(u)) - _[C] !== y && (w = !0, _[C] = y); - else - w = !0, t(this, g).set(A, u); - w && W(this, O, Ai).call(this), u instanceof P.AnnotationEditor && typeof this.onAnnotationEditor == "function" && this.onAnnotationEditor(u.constructor._type); - } - has(A) { - return t(this, g).has(A); - } - getAll() { - return t(this, g).size > 0 ? (0, l.objectFromMap)(t(this, g)) : null; - } - setAll(A) { - for (const [u, _] of Object.entries(A)) - this.setValue(u, _); - } - get size() { - return t(this, g).size; - } - resetModified() { - t(this, F) && (Z(this, F, !1), typeof this.onResetModified == "function" && this.onResetModified()); - } - get print() { - return new B(this); - } - get serializable() { - if (t(this, g).size === 0) - return X; - const A = /* @__PURE__ */ new Map(), u = new rt.MurmurHash3_64(), _ = [], w = /* @__PURE__ */ Object.create(null); - let C = !1; - for (const [y, a] of t(this, g)) { - const c = a instanceof P.AnnotationEditor ? a.serialize(!1, w) : a; - c && (A.set(y, c), u.update(`${y}:${JSON.stringify(c)}`), C || (C = !!c.bitmap)); - } - if (C) - for (const y of A.values()) - y.bitmap && _.push(y.bitmap); - return A.size > 0 ? { - map: A, - hash: u.hexdigest(), - transfers: _ - } : X; - } - } - F = new WeakMap(), g = new WeakMap(), O = new WeakSet(), Ai = function() { - t(this, F) || (Z(this, F, !0), typeof this.onSetModified == "function" && this.onSetModified()); - }, d.AnnotationStorage = pt; - class B extends pt { - constructor(u) { - super(); - L(this, x, void 0); - const { - map: _, - hash: w, - transfers: C - } = u.serializable, y = structuredClone(_, C ? { - transfer: C - } : null); - Z(this, x, { - map: y, - hash: w, - transfers: C - }); - } - get print() { - (0, l.unreachable)("Should not call PrintAnnotationStorage.print"); - } - get serializable() { - return t(this, x); - } - } - x = new WeakMap(), d.PrintAnnotationStorage = B; - }, - /* 4 */ - /***/ - (dt, d, et) => { - var B, F, g, O, I, x, v, A, u, _, w, C, y, a, c, Ue, p, je, T, He, U, We, E, yi, st, vi, H, Si, gt, Ge, xt, Ei; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.AnnotationEditor = void 0; - var l = et(5), P = et(1), rt = et(6); - const i = class i { - constructor(s) { - L(this, c); - L(this, p); - L(this, U); - L(this, E); - L(this, st); - L(this, H); - L(this, gt); - L(this, xt); - L(this, B, ""); - L(this, F, !1); - L(this, g, null); - L(this, O, null); - L(this, I, null); - L(this, x, !1); - L(this, v, null); - L(this, A, this.focusin.bind(this)); - L(this, u, this.focusout.bind(this)); - L(this, _, !1); - L(this, w, !1); - L(this, C, !1); - ee(this, "_initialOptions", /* @__PURE__ */ Object.create(null)); - ee(this, "_uiManager", null); - ee(this, "_focusEventsAllowed", !0); - ee(this, "_l10nPromise", null); - L(this, y, !1); - L(this, a, i._zIndex++); - this.constructor === i && (0, P.unreachable)("Cannot initialize AnnotationEditor."), this.parent = s.parent, this.id = s.id, this.width = this.height = null, this.pageIndex = s.parent.pageIndex, this.name = s.name, this.div = null, this._uiManager = s.uiManager, this.annotationElementId = null, this._willKeepAspectRatio = !1, this._initialOptions.isCentered = s.isCentered, this._structTreeParentId = null; - const { - rotation: o, - rawDims: { - pageWidth: h, - pageHeight: b, - pageX: M, - pageY: N - } - } = this.parent.viewport; - this.rotation = o, this.pageRotation = (360 + o - this._uiManager.viewParameters.rotation) % 360, this.pageDimensions = [h, b], this.pageTranslation = [M, N]; - const [tt, Q] = this.parentDimensions; - this.x = s.x / tt, this.y = s.y / Q, this.isAttachedToDOM = !1, this.deleted = !1; - } - get editorType() { - return Object.getPrototypeOf(this).constructor._type; - } - static get _defaultLineColor() { - return (0, P.shadow)(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText")); - } - static deleteAnnotationElement(s) { - const o = new pt({ - id: s.parent.getNextId(), - parent: s.parent, - uiManager: s._uiManager - }); - o.annotationElementId = s.annotationElementId, o.deleted = !0, o._uiManager.addToAnnotationStorage(o); - } - static initialize(s, o = null) { - if (i._l10nPromise || (i._l10nPromise = new Map(["editor_alt_text_button_label", "editor_alt_text_edit_button_label", "editor_alt_text_decorative_tooltip"].map((b) => [b, s.get(b)]))), o != null && o.strings) - for (const b of o.strings) - i._l10nPromise.set(b, s.get(b)); - if (i._borderLineWidth !== -1) - return; - const h = getComputedStyle(document.documentElement); - i._borderLineWidth = parseFloat(h.getPropertyValue("--outline-width")) || 0; - } - static updateDefaultParams(s, o) { - } - static get defaultPropertiesToUpdate() { - return []; - } - static isHandlingMimeForPasting(s) { - return !1; - } - static paste(s, o) { - (0, P.unreachable)("Not implemented"); - } - get propertiesToUpdate() { - return []; - } - get _isDraggable() { - return t(this, y); - } - set _isDraggable(s) { - var o; - Z(this, y, s), (o = this.div) == null || o.classList.toggle("draggable", s); - } - center() { - const [s, o] = this.pageDimensions; - switch (this.parentRotation) { - case 90: - this.x -= this.height * o / (s * 2), this.y += this.width * s / (o * 2); - break; - case 180: - this.x += this.width / 2, this.y += this.height / 2; - break; - case 270: - this.x += this.height * o / (s * 2), this.y -= this.width * s / (o * 2); - break; - default: - this.x -= this.width / 2, this.y -= this.height / 2; - break; - } - this.fixAndSetPosition(); - } - addCommands(s) { - this._uiManager.addCommands(s); - } - get currentLayer() { - return this._uiManager.currentLayer; - } - setInBackground() { - this.div.style.zIndex = 0; - } - setInForeground() { - this.div.style.zIndex = t(this, a); - } - setParent(s) { - s !== null && (this.pageIndex = s.pageIndex, this.pageDimensions = s.pageDimensions), this.parent = s; - } - focusin(s) { - this._focusEventsAllowed && (t(this, _) ? Z(this, _, !1) : this.parent.setSelected(this)); - } - focusout(s) { - var h; - if (!this._focusEventsAllowed || !this.isAttachedToDOM) - return; - const o = s.relatedTarget; - o != null && o.closest(`#${this.id}`) || (s.preventDefault(), (h = this.parent) != null && h.isMultipleSelection || this.commitOrRemove()); - } - commitOrRemove() { - this.isEmpty() ? this.remove() : this.commit(); - } - commit() { - this.addToAnnotationStorage(); - } - addToAnnotationStorage() { - this._uiManager.addToAnnotationStorage(this); - } - setAt(s, o, h, b) { - const [M, N] = this.parentDimensions; - [h, b] = this.screenToPageTranslation(h, b), this.x = (s + h) / M, this.y = (o + b) / N, this.fixAndSetPosition(); - } - translate(s, o) { - W(this, c, Ue).call(this, this.parentDimensions, s, o); - } - translateInPage(s, o) { - W(this, c, Ue).call(this, this.pageDimensions, s, o), this.div.scrollIntoView({ - block: "nearest" - }); - } - drag(s, o) { - const [h, b] = this.parentDimensions; - if (this.x += s / h, this.y += o / b, this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) { - const { - x: nt, - y: ct - } = this.div.getBoundingClientRect(); - this.parent.findNewParent(this, nt, ct) && (this.x -= Math.floor(this.x), this.y -= Math.floor(this.y)); - } - let { - x: M, - y: N - } = this; - const [tt, Q] = W(this, p, je).call(this); - M += tt, N += Q, this.div.style.left = `${(100 * M).toFixed(2)}%`, this.div.style.top = `${(100 * N).toFixed(2)}%`, this.div.scrollIntoView({ - block: "nearest" - }); - } - fixAndSetPosition() { - const [s, o] = this.pageDimensions; - let { - x: h, - y: b, - width: M, - height: N - } = this; - switch (M *= s, N *= o, h *= s, b *= o, this.rotation) { - case 0: - h = Math.max(0, Math.min(s - M, h)), b = Math.max(0, Math.min(o - N, b)); - break; - case 90: - h = Math.max(0, Math.min(s - N, h)), b = Math.min(o, Math.max(M, b)); - break; - case 180: - h = Math.min(s, Math.max(M, h)), b = Math.min(o, Math.max(N, b)); - break; - case 270: - h = Math.min(s, Math.max(N, h)), b = Math.max(0, Math.min(o - M, b)); - break; - } - this.x = h /= s, this.y = b /= o; - const [tt, Q] = W(this, p, je).call(this); - h += tt, b += Q; - const { - style: nt - } = this.div; - nt.left = `${(100 * h).toFixed(2)}%`, nt.top = `${(100 * b).toFixed(2)}%`, this.moveInDOM(); - } - screenToPageTranslation(s, o) { - var h; - return W(h = i, T, He).call(h, s, o, this.parentRotation); - } - pageTranslationToScreen(s, o) { - var h; - return W(h = i, T, He).call(h, s, o, 360 - this.parentRotation); - } - get parentScale() { - return this._uiManager.viewParameters.realScale; - } - get parentRotation() { - return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360; - } - get parentDimensions() { - const { - parentScale: s, - pageDimensions: [o, h] - } = this, b = o * s, M = h * s; - return P.FeatureTest.isCSSRoundSupported ? [Math.round(b), Math.round(M)] : [b, M]; - } - setDims(s, o) { - var M; - const [h, b] = this.parentDimensions; - this.div.style.width = `${(100 * s / h).toFixed(2)}%`, t(this, x) || (this.div.style.height = `${(100 * o / b).toFixed(2)}%`), (M = t(this, g)) == null || M.classList.toggle("small", s < i.SMALL_EDITOR_SIZE || o < i.SMALL_EDITOR_SIZE); - } - fixDims() { - const { - style: s - } = this.div, { - height: o, - width: h - } = s, b = h.endsWith("%"), M = !t(this, x) && o.endsWith("%"); - if (b && M) - return; - const [N, tt] = this.parentDimensions; - b || (s.width = `${(100 * parseFloat(h) / N).toFixed(2)}%`), !t(this, x) && !M && (s.height = `${(100 * parseFloat(o) / tt).toFixed(2)}%`); - } - getInitialTranslation() { - return [0, 0]; - } - async addAltTextButton() { - if (t(this, g)) - return; - const s = Z(this, g, document.createElement("button")); - s.className = "altText"; - const o = await i._l10nPromise.get("editor_alt_text_button_label"); - s.textContent = o, s.setAttribute("aria-label", o), s.tabIndex = "0", s.addEventListener("contextmenu", rt.noContextMenu), s.addEventListener("pointerdown", (h) => h.stopPropagation()), s.addEventListener("click", (h) => { - h.preventDefault(), this._uiManager.editAltText(this); - }, { - capture: !0 - }), s.addEventListener("keydown", (h) => { - h.target === s && h.key === "Enter" && (h.preventDefault(), this._uiManager.editAltText(this)); - }), W(this, gt, Ge).call(this), this.div.append(s), i.SMALL_EDITOR_SIZE || (i.SMALL_EDITOR_SIZE = Math.min(128, Math.round(s.getBoundingClientRect().width * 1.4))); - } - getClientDimensions() { - return this.div.getBoundingClientRect(); - } - get altTextData() { - return { - altText: t(this, B), - decorative: t(this, F) - }; - } - set altTextData({ - altText: s, - decorative: o - }) { - t(this, B) === s && t(this, F) === o || (Z(this, B, s), Z(this, F, o), W(this, gt, Ge).call(this)); - } - render() { - this.div = document.createElement("div"), this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360), this.div.className = this.name, this.div.setAttribute("id", this.id), this.div.setAttribute("tabIndex", 0), this.setInForeground(), this.div.addEventListener("focusin", t(this, A)), this.div.addEventListener("focusout", t(this, u)); - const [s, o] = this.parentDimensions; - this.parentRotation % 180 !== 0 && (this.div.style.maxWidth = `${(100 * o / s).toFixed(2)}%`, this.div.style.maxHeight = `${(100 * s / o).toFixed(2)}%`); - const [h, b] = this.getInitialTranslation(); - return this.translate(h, b), (0, l.bindEvents)(this, this.div, ["pointerdown"]), this.div; - } - pointerdown(s) { - const { - isMac: o - } = P.FeatureTest.platform; - if (s.button !== 0 || s.ctrlKey && o) { - s.preventDefault(); - return; - } - Z(this, _, !0), W(this, xt, Ei).call(this, s); - } - moveInDOM() { - var s; - (s = this.parent) == null || s.moveEditorInDOM(this); - } - _setParentAndPosition(s, o, h) { - s.changeParent(this), this.x = o, this.y = h, this.fixAndSetPosition(); - } - getRect(s, o) { - const h = this.parentScale, [b, M] = this.pageDimensions, [N, tt] = this.pageTranslation, Q = s / h, nt = o / h, ct = this.x * b, yt = this.y * M, ut = this.width * b, Ft = this.height * M; - switch (this.rotation) { - case 0: - return [ct + Q + N, M - yt - nt - Ft + tt, ct + Q + ut + N, M - yt - nt + tt]; - case 90: - return [ct + nt + N, M - yt + Q + tt, ct + nt + Ft + N, M - yt + Q + ut + tt]; - case 180: - return [ct - Q - ut + N, M - yt + nt + tt, ct - Q + N, M - yt + nt + Ft + tt]; - case 270: - return [ct - nt - Ft + N, M - yt - Q - ut + tt, ct - nt + N, M - yt - Q + tt]; - default: - throw new Error("Invalid rotation"); - } - } - getRectInCurrentCoords(s, o) { - const [h, b, M, N] = s, tt = M - h, Q = N - b; - switch (this.rotation) { - case 0: - return [h, o - N, tt, Q]; - case 90: - return [h, o - b, Q, tt]; - case 180: - return [M, o - b, tt, Q]; - case 270: - return [M, o - N, Q, tt]; - default: - throw new Error("Invalid rotation"); - } - } - onceAdded() { - } - isEmpty() { - return !1; - } - enableEditMode() { - Z(this, C, !0); - } - disableEditMode() { - Z(this, C, !1); - } - isInEditMode() { - return t(this, C); - } - shouldGetKeyboardEvents() { - return !1; - } - needsToBeRebuilt() { - return this.div && !this.isAttachedToDOM; - } - rebuild() { - var s, o; - (s = this.div) == null || s.addEventListener("focusin", t(this, A)), (o = this.div) == null || o.addEventListener("focusout", t(this, u)); - } - serialize(s = !1, o = null) { - (0, P.unreachable)("An editor must be serializable"); - } - static deserialize(s, o, h) { - const b = new this.prototype.constructor({ - parent: o, - id: o.getNextId(), - uiManager: h - }); - b.rotation = s.rotation; - const [M, N] = b.pageDimensions, [tt, Q, nt, ct] = b.getRectInCurrentCoords(s.rect, N); - return b.x = tt / M, b.y = Q / N, b.width = nt / M, b.height = ct / N, b; - } - remove() { - var s; - this.div.removeEventListener("focusin", t(this, A)), this.div.removeEventListener("focusout", t(this, u)), this.isEmpty() || this.commit(), this.parent ? this.parent.remove(this) : this._uiManager.removeEditor(this), (s = t(this, g)) == null || s.remove(), Z(this, g, null), Z(this, O, null); - } - get isResizable() { - return !1; - } - makeResizable() { - this.isResizable && (W(this, E, yi).call(this), t(this, v).classList.remove("hidden")); - } - select() { - var s; - this.makeResizable(), (s = this.div) == null || s.classList.add("selectedEditor"); - } - unselect() { - var s, o, h; - (s = t(this, v)) == null || s.classList.add("hidden"), (o = this.div) == null || o.classList.remove("selectedEditor"), (h = this.div) != null && h.contains(document.activeElement) && this._uiManager.currentLayer.div.focus(); - } - updateParams(s, o) { - } - disableEditing() { - t(this, g) && (t(this, g).hidden = !0); - } - enableEditing() { - t(this, g) && (t(this, g).hidden = !1); - } - enterInEditMode() { - } - get contentDiv() { - return this.div; - } - get isEditing() { - return t(this, w); - } - set isEditing(s) { - Z(this, w, s), this.parent && (s ? (this.parent.setSelected(this), this.parent.setActiveEditor(this)) : this.parent.setActiveEditor(null)); - } - setAspectRatio(s, o) { - Z(this, x, !0); - const h = s / o, { - style: b - } = this.div; - b.aspectRatio = h, b.height = "auto"; - } - static get MIN_SIZE() { - return 16; - } - }; - B = new WeakMap(), F = new WeakMap(), g = new WeakMap(), O = new WeakMap(), I = new WeakMap(), x = new WeakMap(), v = new WeakMap(), A = new WeakMap(), u = new WeakMap(), _ = new WeakMap(), w = new WeakMap(), C = new WeakMap(), y = new WeakMap(), a = new WeakMap(), c = new WeakSet(), Ue = function([s, o], h, b) { - [h, b] = this.screenToPageTranslation(h, b), this.x += h / s, this.y += b / o, this.fixAndSetPosition(); - }, p = new WeakSet(), je = function() { - const [s, o] = this.parentDimensions, { - _borderLineWidth: h - } = i, b = h / s, M = h / o; - switch (this.rotation) { - case 90: - return [-b, M]; - case 180: - return [b, M]; - case 270: - return [b, -M]; - default: - return [-b, -M]; - } - }, T = new WeakSet(), He = function(s, o, h) { - switch (h) { - case 90: - return [o, -s]; - case 180: - return [-s, -o]; - case 270: - return [-o, s]; - default: - return [s, o]; - } - }, U = new WeakSet(), We = function(s) { - switch (s) { - case 90: { - const [o, h] = this.pageDimensions; - return [0, -o / h, h / o, 0]; - } - case 180: - return [-1, 0, 0, -1]; - case 270: { - const [o, h] = this.pageDimensions; - return [0, o / h, -h / o, 0]; - } - default: - return [1, 0, 0, 1]; - } - }, E = new WeakSet(), yi = function() { - if (t(this, v)) - return; - Z(this, v, document.createElement("div")), t(this, v).classList.add("resizers"); - const s = ["topLeft", "topRight", "bottomRight", "bottomLeft"]; - this._willKeepAspectRatio || s.push("topMiddle", "middleRight", "bottomMiddle", "middleLeft"); - for (const o of s) { - const h = document.createElement("div"); - t(this, v).append(h), h.classList.add("resizer", o), h.addEventListener("pointerdown", W(this, st, vi).bind(this, o)), h.addEventListener("contextmenu", rt.noContextMenu); - } - this.div.prepend(t(this, v)); - }, st = new WeakSet(), vi = function(s, o) { - o.preventDefault(); - const { - isMac: h - } = P.FeatureTest.platform; - if (o.button !== 0 || o.ctrlKey && h) - return; - const b = W(this, H, Si).bind(this, s), M = this._isDraggable; - this._isDraggable = !1; - const N = { - passive: !0, - capture: !0 - }; - window.addEventListener("pointermove", b, N); - const tt = this.x, Q = this.y, nt = this.width, ct = this.height, yt = this.parent.div.style.cursor, ut = this.div.style.cursor; - this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(o.target).cursor; - const Ft = () => { - this._isDraggable = M, window.removeEventListener("pointerup", Ft), window.removeEventListener("blur", Ft), window.removeEventListener("pointermove", b, N), this.parent.div.style.cursor = yt, this.div.style.cursor = ut; - const Bt = this.x, St = this.y, Dt = this.width, ft = this.height; - Bt === tt && St === Q && Dt === nt && ft === ct || this.addCommands({ - cmd: () => { - this.width = Dt, this.height = ft, this.x = Bt, this.y = St; - const [K, J] = this.parentDimensions; - this.setDims(K * Dt, J * ft), this.fixAndSetPosition(); - }, - undo: () => { - this.width = nt, this.height = ct, this.x = tt, this.y = Q; - const [K, J] = this.parentDimensions; - this.setDims(K * nt, J * ct), this.fixAndSetPosition(); - }, - mustExec: !0 - }); - }; - window.addEventListener("pointerup", Ft), window.addEventListener("blur", Ft); - }, H = new WeakSet(), Si = function(s, o) { - const [h, b] = this.parentDimensions, M = this.x, N = this.y, tt = this.width, Q = this.height, nt = i.MIN_SIZE / h, ct = i.MIN_SIZE / b, yt = (bt) => Math.round(bt * 1e4) / 1e4, ut = W(this, U, We).call(this, this.rotation), Ft = (bt, At) => [ut[0] * bt + ut[2] * At, ut[1] * bt + ut[3] * At], Bt = W(this, U, We).call(this, 360 - this.rotation), St = (bt, At) => [Bt[0] * bt + Bt[2] * At, Bt[1] * bt + Bt[3] * At]; - let Dt, ft, K = !1, J = !1; - switch (s) { - case "topLeft": - K = !0, Dt = (bt, At) => [0, 0], ft = (bt, At) => [bt, At]; - break; - case "topMiddle": - Dt = (bt, At) => [bt / 2, 0], ft = (bt, At) => [bt / 2, At]; - break; - case "topRight": - K = !0, Dt = (bt, At) => [bt, 0], ft = (bt, At) => [0, At]; - break; - case "middleRight": - J = !0, Dt = (bt, At) => [bt, At / 2], ft = (bt, At) => [0, At / 2]; - break; - case "bottomRight": - K = !0, Dt = (bt, At) => [bt, At], ft = (bt, At) => [0, 0]; - break; - case "bottomMiddle": - Dt = (bt, At) => [bt / 2, At], ft = (bt, At) => [bt / 2, 0]; - break; - case "bottomLeft": - K = !0, Dt = (bt, At) => [0, At], ft = (bt, At) => [bt, 0]; - break; - case "middleLeft": - J = !0, Dt = (bt, At) => [0, At / 2], ft = (bt, At) => [bt, At / 2]; - break; - } - const ht = Dt(tt, Q), Et = ft(tt, Q); - let Ct = Ft(...Et); - const jt = yt(M + Ct[0]), Gt = yt(N + Ct[1]); - let Ht = 1, Xt = 1, [Vt, Wt] = this.screenToPageTranslation(o.movementX, o.movementY); - if ([Vt, Wt] = St(Vt / h, Wt / b), K) { - const bt = Math.hypot(tt, Q); - Ht = Xt = Math.max(Math.min(Math.hypot(Et[0] - ht[0] - Vt, Et[1] - ht[1] - Wt) / bt, 1 / tt, 1 / Q), nt / tt, ct / Q); - } else - J ? Ht = Math.max(nt, Math.min(1, Math.abs(Et[0] - ht[0] - Vt))) / tt : Xt = Math.max(ct, Math.min(1, Math.abs(Et[1] - ht[1] - Wt))) / Q; - const $t = yt(tt * Ht), ot = yt(Q * Xt); - Ct = Ft(...ft($t, ot)); - const Y = jt - Ct[0], G = Gt - Ct[1]; - this.width = $t, this.height = ot, this.x = Y, this.y = G, this.setDims(h * $t, b * ot), this.fixAndSetPosition(); - }, gt = new WeakSet(), Ge = async function() { - var h; - const s = t(this, g); - if (!s) - return; - if (!t(this, B) && !t(this, F)) { - s.classList.remove("done"), (h = t(this, O)) == null || h.remove(); - return; - } - i._l10nPromise.get("editor_alt_text_edit_button_label").then((b) => { - s.setAttribute("aria-label", b); - }); - let o = t(this, O); - if (!o) { - Z(this, O, o = document.createElement("span")), o.className = "tooltip", o.setAttribute("role", "tooltip"); - const b = o.id = `alt-text-tooltip-${this.id}`; - s.setAttribute("aria-describedby", b); - const M = 100; - s.addEventListener("mouseenter", () => { - Z(this, I, setTimeout(() => { - Z(this, I, null), t(this, O).classList.add("show"), this._uiManager._eventBus.dispatch("reporttelemetry", { - source: this, - details: { - type: "editing", - subtype: this.editorType, - data: { - action: "alt_text_tooltip" - } - } - }); - }, M)); - }), s.addEventListener("mouseleave", () => { - var N; - clearTimeout(t(this, I)), Z(this, I, null), (N = t(this, O)) == null || N.classList.remove("show"); - }); - } - s.classList.add("done"), o.innerText = t(this, F) ? await i._l10nPromise.get("editor_alt_text_decorative_tooltip") : t(this, B), o.parentNode || s.append(o); - }, xt = new WeakSet(), Ei = function(s) { - if (!this._isDraggable) - return; - const o = this._uiManager.isSelected(this); - this._uiManager.setUpDragSession(); - let h, b; - o && (h = { - passive: !0, - capture: !0 - }, b = (N) => { - const [tt, Q] = this.screenToPageTranslation(N.movementX, N.movementY); - this._uiManager.dragSelectedEditors(tt, Q); - }, window.addEventListener("pointermove", b, h)); - const M = () => { - if (window.removeEventListener("pointerup", M), window.removeEventListener("blur", M), o && window.removeEventListener("pointermove", b, h), Z(this, _, !1), !this._uiManager.endDragSession()) { - const { - isMac: N - } = P.FeatureTest.platform; - s.ctrlKey && !N || s.shiftKey || s.metaKey && N ? this.parent.toggleSelected(this) : this.parent.setSelected(this); - } - }; - window.addEventListener("pointerup", M), window.addEventListener("blur", M); - }, L(i, T), ee(i, "_borderLineWidth", -1), ee(i, "_colorManager", new l.ColorManager()), ee(i, "_zIndex", 1), ee(i, "SMALL_EDITOR_SIZE", 0); - let X = i; - d.AnnotationEditor = X; - class pt extends X { - constructor(s) { - super(s), this.annotationElementId = s.annotationElementId, this.deleted = !0; - } - serialize() { - return { - id: this.annotationElementId, - deleted: !0, - pageIndex: this.pageIndex - }; - } - } - }, - /* 5 */ - /***/ - (dt, d, et) => { - var x, v, A, u, _, ze, y, a, c, k, p, wi, m, U, z, E, V, st, at, H, lt, gt, wt, xt, S, i, n, s, o, h, b, M, N, tt, Q, nt, ct, yt, ut, Ft, Bt, St, Dt, ft, K, J, ht, Ci, Ct, Xe, Gt, Ve, Xt, Ce, Wt, qe, ot, $e, G, re, At, me, Zt, Ti, vt, Pi, Tt, Ye, Nt, be, _t, Ke; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.KeyboardManager = d.CommandManager = d.ColorManager = d.AnnotationEditorUIManager = void 0, d.bindEvents = rt, d.opacityToHex = X; - var l = et(1), P = et(6); - function rt(R, e, f) { - for (const D of f) - e.addEventListener(D, R[D].bind(R)); - } - function X(R) { - return Math.round(Math.min(255, Math.max(1, 255 * R))).toString(16).padStart(2, "0"); - } - class pt { - constructor() { - L(this, x, 0); - } - getId() { - return `${l.AnnotationEditorPrefix}${ge(this, x)._++}`; - } - } - x = new WeakMap(); - const C = class C { - constructor() { - L(this, _); - L(this, v, (0, l.getUuid)()); - L(this, A, 0); - L(this, u, null); - } - static get _isSVGFittingCanvas() { - const e = 'data:image/svg+xml;charset=UTF-8,', D = new OffscreenCanvas(1, 3).getContext("2d"), j = new Image(); - j.src = e; - const q = j.decode().then(() => (D.drawImage(j, 0, 0, 1, 1, 0, 0, 1, 3), new Uint32Array(D.getImageData(0, 0, 1, 1).data.buffer)[0] === 0)); - return (0, l.shadow)(this, "_isSVGFittingCanvas", q); - } - async getFromFile(e) { - const { - lastModified: f, - name: D, - size: j, - type: q - } = e; - return W(this, _, ze).call(this, `${f}_${D}_${j}_${q}`, e); - } - async getFromUrl(e) { - return W(this, _, ze).call(this, e, e); - } - async getFromId(e) { - t(this, u) || Z(this, u, /* @__PURE__ */ new Map()); - const f = t(this, u).get(e); - return f ? f.bitmap ? (f.refCounter += 1, f) : f.file ? this.getFromFile(f.file) : this.getFromUrl(f.url) : null; - } - getSvgUrl(e) { - const f = t(this, u).get(e); - return f != null && f.isSvg ? f.svgUrl : null; - } - deleteId(e) { - t(this, u) || Z(this, u, /* @__PURE__ */ new Map()); - const f = t(this, u).get(e); - f && (f.refCounter -= 1, f.refCounter === 0 && (f.bitmap = null)); - } - isValidId(e) { - return e.startsWith(`image_${t(this, v)}_`); - } - }; - v = new WeakMap(), A = new WeakMap(), u = new WeakMap(), _ = new WeakSet(), ze = async function(e, f) { - t(this, u) || Z(this, u, /* @__PURE__ */ new Map()); - let D = t(this, u).get(e); - if (D === null) - return null; - if (D != null && D.bitmap) - return D.refCounter += 1, D; - try { - D || (D = { - bitmap: null, - id: `image_${t(this, v)}_${ge(this, A)._++}`, - refCounter: 0, - isSvg: !1 - }); - let j; - if (typeof f == "string") { - D.url = f; - const q = await fetch(f); - if (!q.ok) - throw new Error(q.statusText); - j = await q.blob(); - } else - j = D.file = f; - if (j.type === "image/svg+xml") { - const q = C._isSVGFittingCanvas, it = new FileReader(), mt = new Image(), kt = new Promise((Pt, zt) => { - mt.onload = () => { - D.bitmap = mt, D.isSvg = !0, Pt(); - }, it.onload = async () => { - const Mt = D.svgUrl = it.result; - mt.src = await q ? `${Mt}#svgView(preserveAspectRatio(none))` : Mt; - }, mt.onerror = it.onerror = zt; - }); - it.readAsDataURL(j), await kt; - } else - D.bitmap = await createImageBitmap(j); - D.refCounter = 1; - } catch (j) { - console.error(j), D = null; - } - return t(this, u).set(e, D), D && t(this, u).set(D.id, D), D; - }; - let B = C; - class F { - constructor(e = 128) { - L(this, y, []); - L(this, a, !1); - L(this, c, void 0); - L(this, k, -1); - Z(this, c, e); - } - add({ - cmd: e, - undo: f, - mustExec: D, - type: j = NaN, - overwriteIfSameType: q = !1, - keepUndo: it = !1 - }) { - if (D && e(), t(this, a)) - return; - const mt = { - cmd: e, - undo: f, - type: j - }; - if (t(this, k) === -1) { - t(this, y).length > 0 && (t(this, y).length = 0), Z(this, k, 0), t(this, y).push(mt); - return; - } - if (q && t(this, y)[t(this, k)].type === j) { - it && (mt.undo = t(this, y)[t(this, k)].undo), t(this, y)[t(this, k)] = mt; - return; - } - const kt = t(this, k) + 1; - kt === t(this, c) ? t(this, y).splice(0, 1) : (Z(this, k, kt), kt < t(this, y).length && t(this, y).splice(kt)), t(this, y).push(mt); - } - undo() { - t(this, k) !== -1 && (Z(this, a, !0), t(this, y)[t(this, k)].undo(), Z(this, a, !1), Z(this, k, t(this, k) - 1)); - } - redo() { - t(this, k) < t(this, y).length - 1 && (Z(this, k, t(this, k) + 1), Z(this, a, !0), t(this, y)[t(this, k)].cmd(), Z(this, a, !1)); - } - hasSomethingToUndo() { - return t(this, k) !== -1; - } - hasSomethingToRedo() { - return t(this, k) < t(this, y).length - 1; - } - destroy() { - Z(this, y, null); - } - } - y = new WeakMap(), a = new WeakMap(), c = new WeakMap(), k = new WeakMap(), d.CommandManager = F; - class g { - constructor(e) { - L(this, p); - this.buffer = [], this.callbacks = /* @__PURE__ */ new Map(), this.allKeys = /* @__PURE__ */ new Set(); - const { - isMac: f - } = l.FeatureTest.platform; - for (const [D, j, q = {}] of e) - for (const it of D) { - const mt = it.startsWith("mac+"); - f && mt ? (this.callbacks.set(it.slice(4), { - callback: j, - options: q - }), this.allKeys.add(it.split("+").at(-1))) : !f && !mt && (this.callbacks.set(it, { - callback: j, - options: q - }), this.allKeys.add(it.split("+").at(-1))); - } - } - exec(e, f) { - if (!this.allKeys.has(f.key)) - return; - const D = this.callbacks.get(W(this, p, wi).call(this, f)); - if (!D) - return; - const { - callback: j, - options: { - bubbles: q = !1, - args: it = [], - checker: mt = null - } - } = D; - mt && !mt(e, f) || (j.bind(e, ...it)(), q || (f.stopPropagation(), f.preventDefault())); - } - } - p = new WeakSet(), wi = function(e) { - e.altKey && this.buffer.push("alt"), e.ctrlKey && this.buffer.push("ctrl"), e.metaKey && this.buffer.push("meta"), e.shiftKey && this.buffer.push("shift"), this.buffer.push(e.key); - const f = this.buffer.join("+"); - return this.buffer.length = 0, f; - }, d.KeyboardManager = g; - const T = class T { - get _colors() { - const e = /* @__PURE__ */ new Map([["CanvasText", null], ["Canvas", null]]); - return (0, P.getColorValues)(e), (0, l.shadow)(this, "_colors", e); - } - convert(e) { - const f = (0, P.getRGB)(e); - if (!window.matchMedia("(forced-colors: active)").matches) - return f; - for (const [D, j] of this._colors) - if (j.every((q, it) => q === f[it])) - return T._colorsMapping.get(D); - return f; - } - getHexCode(e) { - const f = this._colors.get(e); - return f ? l.Util.makeHexColor(...f) : e; - } - }; - ee(T, "_colorsMapping", /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]])); - let O = T; - d.ColorManager = O; - const It = class It { - constructor(e, f, D, j, q, it) { - L(this, ht); - L(this, Ct); - L(this, Gt); - L(this, Xt); - L(this, Wt); - L(this, ot); - L(this, G); - L(this, At); - L(this, Zt); - L(this, vt); - L(this, Tt); - L(this, Nt); - L(this, _t); - L(this, m, null); - L(this, U, /* @__PURE__ */ new Map()); - L(this, z, /* @__PURE__ */ new Map()); - L(this, E, null); - L(this, V, null); - L(this, st, new F()); - L(this, at, 0); - L(this, H, /* @__PURE__ */ new Set()); - L(this, lt, null); - L(this, gt, null); - L(this, wt, /* @__PURE__ */ new Set()); - L(this, xt, null); - L(this, S, new pt()); - L(this, i, !1); - L(this, n, !1); - L(this, s, null); - L(this, o, l.AnnotationEditorType.NONE); - L(this, h, /* @__PURE__ */ new Set()); - L(this, b, null); - L(this, M, this.blur.bind(this)); - L(this, N, this.focus.bind(this)); - L(this, tt, this.copy.bind(this)); - L(this, Q, this.cut.bind(this)); - L(this, nt, this.paste.bind(this)); - L(this, ct, this.keydown.bind(this)); - L(this, yt, this.onEditingAction.bind(this)); - L(this, ut, this.onPageChanging.bind(this)); - L(this, Ft, this.onScaleChanging.bind(this)); - L(this, Bt, this.onRotationChanging.bind(this)); - L(this, St, { - isEditing: !1, - isEmpty: !0, - hasSomethingToUndo: !1, - hasSomethingToRedo: !1, - hasSelectedEditor: !1 - }); - L(this, Dt, [0, 0]); - L(this, ft, null); - L(this, K, null); - L(this, J, null); - Z(this, K, e), Z(this, J, f), Z(this, E, D), this._eventBus = j, this._eventBus._on("editingaction", t(this, yt)), this._eventBus._on("pagechanging", t(this, ut)), this._eventBus._on("scalechanging", t(this, Ft)), this._eventBus._on("rotationchanging", t(this, Bt)), Z(this, V, q.annotationStorage), Z(this, xt, q.filterFactory), Z(this, b, it), this.viewParameters = { - realScale: P.PixelsPerInch.PDF_TO_CSS_UNITS, - rotation: 0 - }; - } - static get _keyboardManager() { - const e = It.prototype, f = (q) => { - const { - activeElement: it - } = document; - return it && t(q, K).contains(it) && q.hasSomethingToControl(); - }, D = this.TRANSLATE_SMALL, j = this.TRANSLATE_BIG; - return (0, l.shadow)(this, "_keyboardManager", new g([[["ctrl+a", "mac+meta+a"], e.selectAll], [["ctrl+z", "mac+meta+z"], e.undo], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], e.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], e.delete], [["Escape", "mac+Escape"], e.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], e.translateSelectedEditors, { - args: [-D, 0], - checker: f - }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], e.translateSelectedEditors, { - args: [-j, 0], - checker: f - }], [["ArrowRight", "mac+ArrowRight"], e.translateSelectedEditors, { - args: [D, 0], - checker: f - }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], e.translateSelectedEditors, { - args: [j, 0], - checker: f - }], [["ArrowUp", "mac+ArrowUp"], e.translateSelectedEditors, { - args: [0, -D], - checker: f - }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], e.translateSelectedEditors, { - args: [0, -j], - checker: f - }], [["ArrowDown", "mac+ArrowDown"], e.translateSelectedEditors, { - args: [0, D], - checker: f - }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], e.translateSelectedEditors, { - args: [0, j], - checker: f - }]])); - } - destroy() { - W(this, Xt, Ce).call(this), W(this, Ct, Xe).call(this), this._eventBus._off("editingaction", t(this, yt)), this._eventBus._off("pagechanging", t(this, ut)), this._eventBus._off("scalechanging", t(this, Ft)), this._eventBus._off("rotationchanging", t(this, Bt)); - for (const e of t(this, z).values()) - e.destroy(); - t(this, z).clear(), t(this, U).clear(), t(this, wt).clear(), Z(this, m, null), t(this, h).clear(), t(this, st).destroy(), t(this, E).destroy(); - } - get hcmFilter() { - return (0, l.shadow)(this, "hcmFilter", t(this, b) ? t(this, xt).addHCMFilter(t(this, b).foreground, t(this, b).background) : "none"); - } - get direction() { - return (0, l.shadow)(this, "direction", getComputedStyle(t(this, K)).direction); - } - editAltText(e) { - var f; - (f = t(this, E)) == null || f.editAltText(this, e); - } - onPageChanging({ - pageNumber: e - }) { - Z(this, at, e - 1); - } - focusMainContainer() { - t(this, K).focus(); - } - findParent(e, f) { - for (const D of t(this, z).values()) { - const { - x: j, - y: q, - width: it, - height: mt - } = D.div.getBoundingClientRect(); - if (e >= j && e <= j + it && f >= q && f <= q + mt) - return D; - } - return null; - } - disableUserSelect(e = !1) { - t(this, J).classList.toggle("noUserSelect", e); - } - addShouldRescale(e) { - t(this, wt).add(e); - } - removeShouldRescale(e) { - t(this, wt).delete(e); - } - onScaleChanging({ - scale: e - }) { - this.commitOrRemove(), this.viewParameters.realScale = e * P.PixelsPerInch.PDF_TO_CSS_UNITS; - for (const f of t(this, wt)) - f.onScaleChanging(); - } - onRotationChanging({ - pagesRotation: e - }) { - this.commitOrRemove(), this.viewParameters.rotation = e; - } - addToAnnotationStorage(e) { - !e.isEmpty() && t(this, V) && !t(this, V).has(e.id) && t(this, V).setValue(e.id, e); - } - blur() { - if (!this.hasSelection) - return; - const { - activeElement: e - } = document; - for (const f of t(this, h)) - if (f.div.contains(e)) { - Z(this, s, [f, e]), f._focusEventsAllowed = !1; - break; - } - } - focus() { - if (!t(this, s)) - return; - const [e, f] = t(this, s); - Z(this, s, null), f.addEventListener("focusin", () => { - e._focusEventsAllowed = !0; - }, { - once: !0 - }), f.focus(); - } - addEditListeners() { - W(this, Gt, Ve).call(this), W(this, Wt, qe).call(this); - } - removeEditListeners() { - W(this, Xt, Ce).call(this), W(this, ot, $e).call(this); - } - copy(e) { - var D; - if (e.preventDefault(), (D = t(this, m)) == null || D.commitOrRemove(), !this.hasSelection) - return; - const f = []; - for (const j of t(this, h)) { - const q = j.serialize(!0); - q && f.push(q); - } - f.length !== 0 && e.clipboardData.setData("application/pdfjs", JSON.stringify(f)); - } - cut(e) { - this.copy(e), this.delete(); - } - paste(e) { - e.preventDefault(); - const { - clipboardData: f - } = e; - for (const q of f.items) - for (const it of t(this, gt)) - if (it.isHandlingMimeForPasting(q.type)) { - it.paste(q, this.currentLayer); - return; - } - let D = f.getData("application/pdfjs"); - if (!D) - return; - try { - D = JSON.parse(D); - } catch (q) { - (0, l.warn)(`paste: "${q.message}".`); - return; - } - if (!Array.isArray(D)) - return; - this.unselectAll(); - const j = this.currentLayer; - try { - const q = []; - for (const kt of D) { - const Pt = j.deserialize(kt); - if (!Pt) - return; - q.push(Pt); - } - const it = () => { - for (const kt of q) - W(this, Tt, Ye).call(this, kt); - W(this, _t, Ke).call(this, q); - }, mt = () => { - for (const kt of q) - kt.remove(); - }; - this.addCommands({ - cmd: it, - undo: mt, - mustExec: !0 - }); - } catch (q) { - (0, l.warn)(`paste: "${q.message}".`); - } - } - keydown(e) { - var f; - (f = this.getActive()) != null && f.shouldGetKeyboardEvents() || It._keyboardManager.exec(this, e); - } - onEditingAction(e) { - ["undo", "redo", "delete", "selectAll"].includes(e.name) && this[e.name](); - } - setEditingState(e) { - e ? (W(this, ht, Ci).call(this), W(this, Gt, Ve).call(this), W(this, Wt, qe).call(this), W(this, G, re).call(this, { - isEditing: t(this, o) !== l.AnnotationEditorType.NONE, - isEmpty: W(this, Nt, be).call(this), - hasSomethingToUndo: t(this, st).hasSomethingToUndo(), - hasSomethingToRedo: t(this, st).hasSomethingToRedo(), - hasSelectedEditor: !1 - })) : (W(this, Ct, Xe).call(this), W(this, Xt, Ce).call(this), W(this, ot, $e).call(this), W(this, G, re).call(this, { - isEditing: !1 - }), this.disableUserSelect(!1)); - } - registerEditorTypes(e) { - if (!t(this, gt)) { - Z(this, gt, e); - for (const f of t(this, gt)) - W(this, At, me).call(this, f.defaultPropertiesToUpdate); - } - } - getId() { - return t(this, S).getId(); - } - get currentLayer() { - return t(this, z).get(t(this, at)); - } - getLayer(e) { - return t(this, z).get(e); - } - get currentPageIndex() { - return t(this, at); - } - addLayer(e) { - t(this, z).set(e.pageIndex, e), t(this, i) ? e.enable() : e.disable(); - } - removeLayer(e) { - t(this, z).delete(e.pageIndex); - } - updateMode(e, f = null) { - if (t(this, o) !== e) { - if (Z(this, o, e), e === l.AnnotationEditorType.NONE) { - this.setEditingState(!1), W(this, vt, Pi).call(this); - return; - } - this.setEditingState(!0), W(this, Zt, Ti).call(this), this.unselectAll(); - for (const D of t(this, z).values()) - D.updateMode(e); - if (f) { - for (const D of t(this, U).values()) - if (D.annotationElementId === f) { - this.setSelected(D), D.enterInEditMode(); - break; - } - } - } - } - updateToolbar(e) { - e !== t(this, o) && this._eventBus.dispatch("switchannotationeditormode", { - source: this, - mode: e - }); - } - updateParams(e, f) { - if (t(this, gt)) { - if (e === l.AnnotationEditorParamsType.CREATE) { - this.currentLayer.addNewEditor(e); - return; - } - for (const D of t(this, h)) - D.updateParams(e, f); - for (const D of t(this, gt)) - D.updateDefaultParams(e, f); - } - } - enableWaiting(e = !1) { - if (t(this, n) !== e) { - Z(this, n, e); - for (const f of t(this, z).values()) - e ? f.disableClick() : f.enableClick(), f.div.classList.toggle("waiting", e); - } - } - getEditors(e) { - const f = []; - for (const D of t(this, U).values()) - D.pageIndex === e && f.push(D); - return f; - } - getEditor(e) { - return t(this, U).get(e); - } - addEditor(e) { - t(this, U).set(e.id, e); - } - removeEditor(e) { - var f; - t(this, U).delete(e.id), this.unselect(e), (!e.annotationElementId || !t(this, H).has(e.annotationElementId)) && ((f = t(this, V)) == null || f.remove(e.id)); - } - addDeletedAnnotationElement(e) { - t(this, H).add(e.annotationElementId), e.deleted = !0; - } - isDeletedAnnotationElement(e) { - return t(this, H).has(e); - } - removeDeletedAnnotationElement(e) { - t(this, H).delete(e.annotationElementId), e.deleted = !1; - } - setActiveEditor(e) { - t(this, m) !== e && (Z(this, m, e), e && W(this, At, me).call(this, e.propertiesToUpdate)); - } - toggleSelected(e) { - if (t(this, h).has(e)) { - t(this, h).delete(e), e.unselect(), W(this, G, re).call(this, { - hasSelectedEditor: this.hasSelection - }); - return; - } - t(this, h).add(e), e.select(), W(this, At, me).call(this, e.propertiesToUpdate), W(this, G, re).call(this, { - hasSelectedEditor: !0 - }); - } - setSelected(e) { - for (const f of t(this, h)) - f !== e && f.unselect(); - t(this, h).clear(), t(this, h).add(e), e.select(), W(this, At, me).call(this, e.propertiesToUpdate), W(this, G, re).call(this, { - hasSelectedEditor: !0 - }); - } - isSelected(e) { - return t(this, h).has(e); - } - unselect(e) { - e.unselect(), t(this, h).delete(e), W(this, G, re).call(this, { - hasSelectedEditor: this.hasSelection - }); - } - get hasSelection() { - return t(this, h).size !== 0; - } - undo() { - t(this, st).undo(), W(this, G, re).call(this, { - hasSomethingToUndo: t(this, st).hasSomethingToUndo(), - hasSomethingToRedo: !0, - isEmpty: W(this, Nt, be).call(this) - }); - } - redo() { - t(this, st).redo(), W(this, G, re).call(this, { - hasSomethingToUndo: !0, - hasSomethingToRedo: t(this, st).hasSomethingToRedo(), - isEmpty: W(this, Nt, be).call(this) - }); - } - addCommands(e) { - t(this, st).add(e), W(this, G, re).call(this, { - hasSomethingToUndo: !0, - hasSomethingToRedo: !1, - isEmpty: W(this, Nt, be).call(this) - }); - } - delete() { - if (this.commitOrRemove(), !this.hasSelection) - return; - const e = [...t(this, h)], f = () => { - for (const j of e) - j.remove(); - }, D = () => { - for (const j of e) - W(this, Tt, Ye).call(this, j); - }; - this.addCommands({ - cmd: f, - undo: D, - mustExec: !0 - }); - } - commitOrRemove() { - var e; - (e = t(this, m)) == null || e.commitOrRemove(); - } - hasSomethingToControl() { - return t(this, m) || this.hasSelection; - } - selectAll() { - for (const e of t(this, h)) - e.commit(); - W(this, _t, Ke).call(this, t(this, U).values()); - } - unselectAll() { - if (t(this, m)) { - t(this, m).commitOrRemove(); - return; - } - if (this.hasSelection) { - for (const e of t(this, h)) - e.unselect(); - t(this, h).clear(), W(this, G, re).call(this, { - hasSelectedEditor: !1 - }); - } - } - translateSelectedEditors(e, f, D = !1) { - if (D || this.commitOrRemove(), !this.hasSelection) - return; - t(this, Dt)[0] += e, t(this, Dt)[1] += f; - const [j, q] = t(this, Dt), it = [...t(this, h)], mt = 1e3; - t(this, ft) && clearTimeout(t(this, ft)), Z(this, ft, setTimeout(() => { - Z(this, ft, null), t(this, Dt)[0] = t(this, Dt)[1] = 0, this.addCommands({ - cmd: () => { - for (const kt of it) - t(this, U).has(kt.id) && kt.translateInPage(j, q); - }, - undo: () => { - for (const kt of it) - t(this, U).has(kt.id) && kt.translateInPage(-j, -q); - }, - mustExec: !1 - }); - }, mt)); - for (const kt of it) - kt.translateInPage(e, f); - } - setUpDragSession() { - if (this.hasSelection) { - this.disableUserSelect(!0), Z(this, lt, /* @__PURE__ */ new Map()); - for (const e of t(this, h)) - t(this, lt).set(e, { - savedX: e.x, - savedY: e.y, - savedPageIndex: e.pageIndex, - newX: 0, - newY: 0, - newPageIndex: -1 - }); - } - } - endDragSession() { - if (!t(this, lt)) - return !1; - this.disableUserSelect(!1); - const e = t(this, lt); - Z(this, lt, null); - let f = !1; - for (const [{ - x: j, - y: q, - pageIndex: it - }, mt] of e) - mt.newX = j, mt.newY = q, mt.newPageIndex = it, f || (f = j !== mt.savedX || q !== mt.savedY || it !== mt.savedPageIndex); - if (!f) - return !1; - const D = (j, q, it, mt) => { - if (t(this, U).has(j.id)) { - const kt = t(this, z).get(mt); - kt ? j._setParentAndPosition(kt, q, it) : (j.pageIndex = mt, j.x = q, j.y = it); - } - }; - return this.addCommands({ - cmd: () => { - for (const [j, { - newX: q, - newY: it, - newPageIndex: mt - }] of e) - D(j, q, it, mt); - }, - undo: () => { - for (const [j, { - savedX: q, - savedY: it, - savedPageIndex: mt - }] of e) - D(j, q, it, mt); - }, - mustExec: !0 - }), !0; - } - dragSelectedEditors(e, f) { - if (t(this, lt)) - for (const D of t(this, lt).keys()) - D.drag(e, f); - } - rebuild(e) { - if (e.parent === null) { - const f = this.getLayer(e.pageIndex); - f ? (f.changeParent(e), f.addOrRebuild(e)) : (this.addEditor(e), this.addToAnnotationStorage(e), e.rebuild()); - } else - e.parent.addOrRebuild(e); - } - isActive(e) { - return t(this, m) === e; - } - getActive() { - return t(this, m); - } - getMode() { - return t(this, o); - } - get imageManager() { - return (0, l.shadow)(this, "imageManager", new B()); - } - }; - m = new WeakMap(), U = new WeakMap(), z = new WeakMap(), E = new WeakMap(), V = new WeakMap(), st = new WeakMap(), at = new WeakMap(), H = new WeakMap(), lt = new WeakMap(), gt = new WeakMap(), wt = new WeakMap(), xt = new WeakMap(), S = new WeakMap(), i = new WeakMap(), n = new WeakMap(), s = new WeakMap(), o = new WeakMap(), h = new WeakMap(), b = new WeakMap(), M = new WeakMap(), N = new WeakMap(), tt = new WeakMap(), Q = new WeakMap(), nt = new WeakMap(), ct = new WeakMap(), yt = new WeakMap(), ut = new WeakMap(), Ft = new WeakMap(), Bt = new WeakMap(), St = new WeakMap(), Dt = new WeakMap(), ft = new WeakMap(), K = new WeakMap(), J = new WeakMap(), ht = new WeakSet(), Ci = function() { - window.addEventListener("focus", t(this, N)), window.addEventListener("blur", t(this, M)); - }, Ct = new WeakSet(), Xe = function() { - window.removeEventListener("focus", t(this, N)), window.removeEventListener("blur", t(this, M)); - }, Gt = new WeakSet(), Ve = function() { - window.addEventListener("keydown", t(this, ct), { - capture: !0 - }); - }, Xt = new WeakSet(), Ce = function() { - window.removeEventListener("keydown", t(this, ct), { - capture: !0 - }); - }, Wt = new WeakSet(), qe = function() { - document.addEventListener("copy", t(this, tt)), document.addEventListener("cut", t(this, Q)), document.addEventListener("paste", t(this, nt)); - }, ot = new WeakSet(), $e = function() { - document.removeEventListener("copy", t(this, tt)), document.removeEventListener("cut", t(this, Q)), document.removeEventListener("paste", t(this, nt)); - }, G = new WeakSet(), re = function(e) { - Object.entries(e).some(([D, j]) => t(this, St)[D] !== j) && this._eventBus.dispatch("annotationeditorstateschanged", { - source: this, - details: Object.assign(t(this, St), e) - }); - }, At = new WeakSet(), me = function(e) { - this._eventBus.dispatch("annotationeditorparamschanged", { - source: this, - details: e - }); - }, Zt = new WeakSet(), Ti = function() { - if (!t(this, i)) { - Z(this, i, !0); - for (const e of t(this, z).values()) - e.enable(); - } - }, vt = new WeakSet(), Pi = function() { - if (this.unselectAll(), t(this, i)) { - Z(this, i, !1); - for (const e of t(this, z).values()) - e.disable(); - } - }, Tt = new WeakSet(), Ye = function(e) { - const f = t(this, z).get(e.pageIndex); - f ? f.addOrRebuild(e) : this.addEditor(e); - }, Nt = new WeakSet(), be = function() { - if (t(this, U).size === 0) - return !0; - if (t(this, U).size === 1) - for (const e of t(this, U).values()) - return e.isEmpty(); - return !1; - }, _t = new WeakSet(), Ke = function(e) { - t(this, h).clear(); - for (const f of e) - f.isEmpty() || (t(this, h).add(f), f.select()); - W(this, G, re).call(this, { - hasSelectedEditor: !0 - }); - }, ee(It, "TRANSLATE_SMALL", 1), ee(It, "TRANSLATE_BIG", 10); - let I = It; - d.AnnotationEditorUIManager = I; - }, - /* 6 */ - /***/ - (dt, d, et) => { - var at, H, lt, gt, wt, xt, S, i, n, s, o, h, de, M, ue, tt, Je, nt, Te, yt, Pe, Ft, _e, St, Ae; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.StatTimer = d.RenderingCancelledException = d.PixelsPerInch = d.PageViewport = d.PDFDateString = d.DOMStandardFontDataFactory = d.DOMSVGFactory = d.DOMFilterFactory = d.DOMCanvasFactory = d.DOMCMapReaderFactory = void 0, d.deprecated = k, d.getColorValues = U, d.getCurrentTransform = z, d.getCurrentTransformInverse = E, d.getFilenameFromUrl = _, d.getPdfFilenameFromUrl = w, d.getRGB = m, d.getXfaPageViewport = T, d.isDataScheme = A, d.isPdfFile = u, d.isValidFetchUrl = y, d.loadScript = c, d.noContextMenu = a, d.setLayerDimensions = V; - var l = et(7), P = et(1); - const rt = "http://www.w3.org/2000/svg", st = class st { - }; - ee(st, "CSS", 96), ee(st, "PDF", 72), ee(st, "PDF_TO_CSS_UNITS", st.CSS / st.PDF); - let X = st; - d.PixelsPerInch = X; - class pt extends l.BaseFilterFactory { - constructor({ - docId: J, - ownerDocument: ht = globalThis.document - } = {}) { - super(); - L(this, h); - L(this, M); - L(this, tt); - L(this, nt); - L(this, yt); - L(this, Ft); - L(this, St); - L(this, at, void 0); - L(this, H, void 0); - L(this, lt, void 0); - L(this, gt, void 0); - L(this, wt, void 0); - L(this, xt, void 0); - L(this, S, void 0); - L(this, i, void 0); - L(this, n, void 0); - L(this, s, void 0); - L(this, o, 0); - Z(this, lt, J), Z(this, gt, ht); - } - addFilter(J) { - if (!J) - return "none"; - let ht = t(this, h, de).get(J); - if (ht) - return ht; - let Et, Ct, jt, Gt; - if (J.length === 1) { - const Wt = J[0], $t = new Array(256); - for (let ot = 0; ot < 256; ot++) - $t[ot] = Wt[ot] / 255; - Gt = Et = Ct = jt = $t.join(","); - } else { - const [Wt, $t, ot] = J, Y = new Array(256), G = new Array(256), bt = new Array(256); - for (let At = 0; At < 256; At++) - Y[At] = Wt[At] / 255, G[At] = $t[At] / 255, bt[At] = ot[At] / 255; - Et = Y.join(","), Ct = G.join(","), jt = bt.join(","), Gt = `${Et}${Ct}${jt}`; - } - if (ht = t(this, h, de).get(Gt), ht) - return t(this, h, de).set(J, ht), ht; - const Ht = `g_${t(this, lt)}_transfer_map_${ge(this, o)._++}`, Xt = `url(#${Ht})`; - t(this, h, de).set(J, Xt), t(this, h, de).set(Gt, Xt); - const Vt = W(this, nt, Te).call(this, Ht); - return W(this, Ft, _e).call(this, Et, Ct, jt, Vt), Xt; - } - addHCMFilter(J, ht) { - var $t; - const Et = `${J}-${ht}`; - if (t(this, xt) === Et) - return t(this, S); - if (Z(this, xt, Et), Z(this, S, "none"), ($t = t(this, wt)) == null || $t.remove(), !J || !ht) - return t(this, S); - const Ct = W(this, St, Ae).call(this, J); - J = P.Util.makeHexColor(...Ct); - const jt = W(this, St, Ae).call(this, ht); - if (ht = P.Util.makeHexColor(...jt), t(this, M, ue).style.color = "", J === "#000000" && ht === "#ffffff" || J === ht) - return t(this, S); - const Gt = new Array(256); - for (let ot = 0; ot <= 255; ot++) { - const Y = ot / 255; - Gt[ot] = Y <= 0.03928 ? Y / 12.92 : ((Y + 0.055) / 1.055) ** 2.4; - } - const Ht = Gt.join(","), Xt = `g_${t(this, lt)}_hcm_filter`, Vt = Z(this, i, W(this, nt, Te).call(this, Xt)); - W(this, Ft, _e).call(this, Ht, Ht, Ht, Vt), W(this, tt, Je).call(this, Vt); - const Wt = (ot, Y) => { - const G = Ct[ot] / 255, bt = jt[ot] / 255, At = new Array(Y + 1); - for (let te = 0; te <= Y; te++) - At[te] = G + te / Y * (bt - G); - return At.join(","); - }; - return W(this, Ft, _e).call(this, Wt(0, 5), Wt(1, 5), Wt(2, 5), Vt), Z(this, S, `url(#${Xt})`), t(this, S); - } - addHighlightHCMFilter(J, ht, Et, Ct) { - var bt; - const jt = `${J}-${ht}-${Et}-${Ct}`; - if (t(this, n) === jt) - return t(this, s); - if (Z(this, n, jt), Z(this, s, "none"), (bt = t(this, i)) == null || bt.remove(), !J || !ht) - return t(this, s); - const [Gt, Ht] = [J, ht].map(W(this, St, Ae).bind(this)); - let Xt = Math.round(0.2126 * Gt[0] + 0.7152 * Gt[1] + 0.0722 * Gt[2]), Vt = Math.round(0.2126 * Ht[0] + 0.7152 * Ht[1] + 0.0722 * Ht[2]), [Wt, $t] = [Et, Ct].map(W(this, St, Ae).bind(this)); - Vt < Xt && ([Xt, Vt, Wt, $t] = [Vt, Xt, $t, Wt]), t(this, M, ue).style.color = ""; - const ot = (At, te, Zt) => { - const $ = new Array(256), vt = (Vt - Xt) / Zt, Lt = At / 255, Tt = (te - At) / (255 * Zt); - let Ot = 0; - for (let Nt = 0; Nt <= Zt; Nt++) { - const Jt = Math.round(Xt + Nt * vt), _t = Lt + Nt * Tt; - for (let Yt = Ot; Yt <= Jt; Yt++) - $[Yt] = _t; - Ot = Jt + 1; - } - for (let Nt = Ot; Nt < 256; Nt++) - $[Nt] = $[Ot - 1]; - return $.join(","); - }, Y = `g_${t(this, lt)}_hcm_highlight_filter`, G = Z(this, i, W(this, nt, Te).call(this, Y)); - return W(this, tt, Je).call(this, G), W(this, Ft, _e).call(this, ot(Wt[0], $t[0], 5), ot(Wt[1], $t[1], 5), ot(Wt[2], $t[2], 5), G), Z(this, s, `url(#${Y})`), t(this, s); - } - destroy(J = !1) { - J && (t(this, S) || t(this, s)) || (t(this, H) && (t(this, H).parentNode.parentNode.remove(), Z(this, H, null)), t(this, at) && (t(this, at).clear(), Z(this, at, null)), Z(this, o, 0)); - } - } - at = new WeakMap(), H = new WeakMap(), lt = new WeakMap(), gt = new WeakMap(), wt = new WeakMap(), xt = new WeakMap(), S = new WeakMap(), i = new WeakMap(), n = new WeakMap(), s = new WeakMap(), o = new WeakMap(), h = new WeakSet(), de = function() { - return t(this, at) || Z(this, at, /* @__PURE__ */ new Map()); - }, M = new WeakSet(), ue = function() { - if (!t(this, H)) { - const J = t(this, gt).createElement("div"), { - style: ht - } = J; - ht.visibility = "hidden", ht.contain = "strict", ht.width = ht.height = 0, ht.position = "absolute", ht.top = ht.left = 0, ht.zIndex = -1; - const Et = t(this, gt).createElementNS(rt, "svg"); - Et.setAttribute("width", 0), Et.setAttribute("height", 0), Z(this, H, t(this, gt).createElementNS(rt, "defs")), J.append(Et), Et.append(t(this, H)), t(this, gt).body.append(J); - } - return t(this, H); - }, tt = new WeakSet(), Je = function(J) { - const ht = t(this, gt).createElementNS(rt, "feColorMatrix"); - ht.setAttribute("type", "matrix"), ht.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"), J.append(ht); - }, nt = new WeakSet(), Te = function(J) { - const ht = t(this, gt).createElementNS(rt, "filter"); - return ht.setAttribute("color-interpolation-filters", "sRGB"), ht.setAttribute("id", J), t(this, M, ue).append(ht), ht; - }, yt = new WeakSet(), Pe = function(J, ht, Et) { - const Ct = t(this, gt).createElementNS(rt, ht); - Ct.setAttribute("type", "discrete"), Ct.setAttribute("tableValues", Et), J.append(Ct); - }, Ft = new WeakSet(), _e = function(J, ht, Et, Ct) { - const jt = t(this, gt).createElementNS(rt, "feComponentTransfer"); - Ct.append(jt), W(this, yt, Pe).call(this, jt, "feFuncR", J), W(this, yt, Pe).call(this, jt, "feFuncG", ht), W(this, yt, Pe).call(this, jt, "feFuncB", Et); - }, St = new WeakSet(), Ae = function(J) { - return t(this, M, ue).style.color = J, m(getComputedStyle(t(this, M, ue)).getPropertyValue("color")); - }, d.DOMFilterFactory = pt; - class B extends l.BaseCanvasFactory { - constructor({ - ownerDocument: K = globalThis.document - } = {}) { - super(), this._document = K; - } - _createCanvas(K, J) { - const ht = this._document.createElement("canvas"); - return ht.width = K, ht.height = J, ht; - } - } - d.DOMCanvasFactory = B; - async function F(ft, K = !1) { - if (y(ft, document.baseURI)) { - const J = await fetch(ft); - if (!J.ok) - throw new Error(J.statusText); - return K ? new Uint8Array(await J.arrayBuffer()) : (0, P.stringToBytes)(await J.text()); - } - return new Promise((J, ht) => { - const Et = new XMLHttpRequest(); - Et.open("GET", ft, !0), K && (Et.responseType = "arraybuffer"), Et.onreadystatechange = () => { - if (Et.readyState === XMLHttpRequest.DONE) { - if (Et.status === 200 || Et.status === 0) { - let Ct; - if (K && Et.response ? Ct = new Uint8Array(Et.response) : !K && Et.responseText && (Ct = (0, P.stringToBytes)(Et.responseText)), Ct) { - J(Ct); - return; - } - } - ht(new Error(Et.statusText)); - } - }, Et.send(null); - }); - } - class g extends l.BaseCMapReaderFactory { - _fetchData(K, J) { - return F(K, this.isCompressed).then((ht) => ({ - cMapData: ht, - compressionType: J - })); - } - } - d.DOMCMapReaderFactory = g; - class O extends l.BaseStandardFontDataFactory { - _fetchData(K) { - return F(K, !0); - } - } - d.DOMStandardFontDataFactory = O; - class I extends l.BaseSVGFactory { - _createSVG(K) { - return document.createElementNS(rt, K); - } - } - d.DOMSVGFactory = I; - class x { - constructor({ - viewBox: K, - scale: J, - rotation: ht, - offsetX: Et = 0, - offsetY: Ct = 0, - dontFlip: jt = !1 - }) { - this.viewBox = K, this.scale = J, this.rotation = ht, this.offsetX = Et, this.offsetY = Ct; - const Gt = (K[2] + K[0]) / 2, Ht = (K[3] + K[1]) / 2; - let Xt, Vt, Wt, $t; - switch (ht %= 360, ht < 0 && (ht += 360), ht) { - case 180: - Xt = -1, Vt = 0, Wt = 0, $t = 1; - break; - case 90: - Xt = 0, Vt = 1, Wt = 1, $t = 0; - break; - case 270: - Xt = 0, Vt = -1, Wt = -1, $t = 0; - break; - case 0: - Xt = 1, Vt = 0, Wt = 0, $t = -1; - break; - default: - throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees."); - } - jt && (Wt = -Wt, $t = -$t); - let ot, Y, G, bt; - Xt === 0 ? (ot = Math.abs(Ht - K[1]) * J + Et, Y = Math.abs(Gt - K[0]) * J + Ct, G = (K[3] - K[1]) * J, bt = (K[2] - K[0]) * J) : (ot = Math.abs(Gt - K[0]) * J + Et, Y = Math.abs(Ht - K[1]) * J + Ct, G = (K[2] - K[0]) * J, bt = (K[3] - K[1]) * J), this.transform = [Xt * J, Vt * J, Wt * J, $t * J, ot - Xt * J * Gt - Wt * J * Ht, Y - Vt * J * Gt - $t * J * Ht], this.width = G, this.height = bt; - } - get rawDims() { - const { - viewBox: K - } = this; - return (0, P.shadow)(this, "rawDims", { - pageWidth: K[2] - K[0], - pageHeight: K[3] - K[1], - pageX: K[0], - pageY: K[1] - }); - } - clone({ - scale: K = this.scale, - rotation: J = this.rotation, - offsetX: ht = this.offsetX, - offsetY: Et = this.offsetY, - dontFlip: Ct = !1 - } = {}) { - return new x({ - viewBox: this.viewBox.slice(), - scale: K, - rotation: J, - offsetX: ht, - offsetY: Et, - dontFlip: Ct - }); - } - convertToViewportPoint(K, J) { - return P.Util.applyTransform([K, J], this.transform); - } - convertToViewportRectangle(K) { - const J = P.Util.applyTransform([K[0], K[1]], this.transform), ht = P.Util.applyTransform([K[2], K[3]], this.transform); - return [J[0], J[1], ht[0], ht[1]]; - } - convertToPdfPoint(K, J) { - return P.Util.applyInverseTransform([K, J], this.transform); - } - } - d.PageViewport = x; - class v extends P.BaseException { - constructor(K, J = 0) { - super(K, "RenderingCancelledException"), this.extraDelay = J; - } - } - d.RenderingCancelledException = v; - function A(ft) { - const K = ft.length; - let J = 0; - for (; J < K && ft[J].trim() === ""; ) - J++; - return ft.substring(J, J + 5).toLowerCase() === "data:"; - } - function u(ft) { - return typeof ft == "string" && /\.pdf$/i.test(ft); - } - function _(ft, K = !1) { - return K || ([ft] = ft.split(/[#?]/, 1)), ft.substring(ft.lastIndexOf("/") + 1); - } - function w(ft, K = "document.pdf") { - if (typeof ft != "string") - return K; - if (A(ft)) - return (0, P.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), K; - const J = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/, ht = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i, Et = J.exec(ft); - let Ct = ht.exec(Et[1]) || ht.exec(Et[2]) || ht.exec(Et[3]); - if (Ct && (Ct = Ct[0], Ct.includes("%"))) - try { - Ct = ht.exec(decodeURIComponent(Ct))[0]; - } catch { - } - return Ct || K; - } - class C { - constructor() { - ee(this, "started", /* @__PURE__ */ Object.create(null)); - ee(this, "times", []); - } - time(K) { - K in this.started && (0, P.warn)(`Timer is already running for ${K}`), this.started[K] = Date.now(); - } - timeEnd(K) { - K in this.started || (0, P.warn)(`Timer has not been started for ${K}`), this.times.push({ - name: K, - start: this.started[K], - end: Date.now() - }), delete this.started[K]; - } - toString() { - const K = []; - let J = 0; - for (const { - name: ht - } of this.times) - J = Math.max(ht.length, J); - for (const { - name: ht, - start: Et, - end: Ct - } of this.times) - K.push(`${ht.padEnd(J)} ${Ct - Et}ms -`); - return K.join(""); - } - } - d.StatTimer = C; - function y(ft, K) { - try { - const { - protocol: J - } = K ? new URL(ft, K) : new URL(ft); - return J === "http:" || J === "https:"; - } catch { - return !1; - } - } - function a(ft) { - ft.preventDefault(); - } - function c(ft, K = !1) { - return new Promise((J, ht) => { - const Et = document.createElement("script"); - Et.src = ft, Et.onload = function(Ct) { - K && Et.remove(), J(Ct); - }, Et.onerror = function() { - ht(new Error(`Cannot load script at: ${Et.src}`)); - }, (document.head || document.documentElement).append(Et); - }); - } - function k(ft) { - console.log("Deprecated API usage: " + ft); - } - let p; - class r { - static toDateObject(K) { - if (!K || typeof K != "string") - return null; - p || (p = new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")); - const J = p.exec(K); - if (!J) - return null; - const ht = parseInt(J[1], 10); - let Et = parseInt(J[2], 10); - Et = Et >= 1 && Et <= 12 ? Et - 1 : 0; - let Ct = parseInt(J[3], 10); - Ct = Ct >= 1 && Ct <= 31 ? Ct : 1; - let jt = parseInt(J[4], 10); - jt = jt >= 0 && jt <= 23 ? jt : 0; - let Gt = parseInt(J[5], 10); - Gt = Gt >= 0 && Gt <= 59 ? Gt : 0; - let Ht = parseInt(J[6], 10); - Ht = Ht >= 0 && Ht <= 59 ? Ht : 0; - const Xt = J[7] || "Z"; - let Vt = parseInt(J[8], 10); - Vt = Vt >= 0 && Vt <= 23 ? Vt : 0; - let Wt = parseInt(J[9], 10) || 0; - return Wt = Wt >= 0 && Wt <= 59 ? Wt : 0, Xt === "-" ? (jt += Vt, Gt += Wt) : Xt === "+" && (jt -= Vt, Gt -= Wt), new Date(Date.UTC(ht, Et, Ct, jt, Gt, Ht)); - } - } - d.PDFDateString = r; - function T(ft, { - scale: K = 1, - rotation: J = 0 - }) { - const { - width: ht, - height: Et - } = ft.attributes.style, Ct = [0, 0, parseInt(ht), parseInt(Et)]; - return new x({ - viewBox: Ct, - scale: K, - rotation: J - }); - } - function m(ft) { - if (ft.startsWith("#")) { - const K = parseInt(ft.slice(1), 16); - return [(K & 16711680) >> 16, (K & 65280) >> 8, K & 255]; - } - return ft.startsWith("rgb(") ? ft.slice(4, -1).split(",").map((K) => parseInt(K)) : ft.startsWith("rgba(") ? ft.slice(5, -1).split(",").map((K) => parseInt(K)).slice(0, 3) : ((0, P.warn)(`Not a valid color format: "${ft}"`), [0, 0, 0]); - } - function U(ft) { - const K = document.createElement("span"); - K.style.visibility = "hidden", document.body.append(K); - for (const J of ft.keys()) { - K.style.color = J; - const ht = window.getComputedStyle(K).color; - ft.set(J, m(ht)); - } - K.remove(); - } - function z(ft) { - const { - a: K, - b: J, - c: ht, - d: Et, - e: Ct, - f: jt - } = ft.getTransform(); - return [K, J, ht, Et, Ct, jt]; - } - function E(ft) { - const { - a: K, - b: J, - c: ht, - d: Et, - e: Ct, - f: jt - } = ft.getTransform().invertSelf(); - return [K, J, ht, Et, Ct, jt]; - } - function V(ft, K, J = !1, ht = !0) { - if (K instanceof x) { - const { - pageWidth: Et, - pageHeight: Ct - } = K.rawDims, { - style: jt - } = ft, Gt = P.FeatureTest.isCSSRoundSupported, Ht = `var(--scale-factor) * ${Et}px`, Xt = `var(--scale-factor) * ${Ct}px`, Vt = Gt ? `round(${Ht}, 1px)` : `calc(${Ht})`, Wt = Gt ? `round(${Xt}, 1px)` : `calc(${Xt})`; - !J || K.rotation % 180 === 0 ? (jt.width = Vt, jt.height = Wt) : (jt.width = Wt, jt.height = Vt); - } - ht && ft.setAttribute("data-main-rotation", K.rotation); - } - }, - /* 7 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.BaseStandardFontDataFactory = d.BaseSVGFactory = d.BaseFilterFactory = d.BaseCanvasFactory = d.BaseCMapReaderFactory = void 0; - var l = et(1); - class P { - constructor() { - this.constructor === P && (0, l.unreachable)("Cannot initialize BaseFilterFactory."); - } - addFilter(g) { - return "none"; - } - addHCMFilter(g, O) { - return "none"; - } - addHighlightHCMFilter(g, O, I, x) { - return "none"; - } - destroy(g = !1) { - } - } - d.BaseFilterFactory = P; - class rt { - constructor() { - this.constructor === rt && (0, l.unreachable)("Cannot initialize BaseCanvasFactory."); - } - create(g, O) { - if (g <= 0 || O <= 0) - throw new Error("Invalid canvas size"); - const I = this._createCanvas(g, O); - return { - canvas: I, - context: I.getContext("2d") - }; - } - reset(g, O, I) { - if (!g.canvas) - throw new Error("Canvas is not specified"); - if (O <= 0 || I <= 0) - throw new Error("Invalid canvas size"); - g.canvas.width = O, g.canvas.height = I; - } - destroy(g) { - if (!g.canvas) - throw new Error("Canvas is not specified"); - g.canvas.width = 0, g.canvas.height = 0, g.canvas = null, g.context = null; - } - _createCanvas(g, O) { - (0, l.unreachable)("Abstract method `_createCanvas` called."); - } - } - d.BaseCanvasFactory = rt; - class X { - constructor({ - baseUrl: g = null, - isCompressed: O = !0 - }) { - this.constructor === X && (0, l.unreachable)("Cannot initialize BaseCMapReaderFactory."), this.baseUrl = g, this.isCompressed = O; - } - async fetch({ - name: g - }) { - if (!this.baseUrl) - throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.'); - if (!g) - throw new Error("CMap name must be specified."); - const O = this.baseUrl + g + (this.isCompressed ? ".bcmap" : ""), I = this.isCompressed ? l.CMapCompressionType.BINARY : l.CMapCompressionType.NONE; - return this._fetchData(O, I).catch((x) => { - throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${O}`); - }); - } - _fetchData(g, O) { - (0, l.unreachable)("Abstract method `_fetchData` called."); - } - } - d.BaseCMapReaderFactory = X; - class pt { - constructor({ - baseUrl: g = null - }) { - this.constructor === pt && (0, l.unreachable)("Cannot initialize BaseStandardFontDataFactory."), this.baseUrl = g; - } - async fetch({ - filename: g - }) { - if (!this.baseUrl) - throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.'); - if (!g) - throw new Error("Font filename must be specified."); - const O = `${this.baseUrl}${g}`; - return this._fetchData(O).catch((I) => { - throw new Error(`Unable to load font data at: ${O}`); - }); - } - _fetchData(g) { - (0, l.unreachable)("Abstract method `_fetchData` called."); - } - } - d.BaseStandardFontDataFactory = pt; - class B { - constructor() { - this.constructor === B && (0, l.unreachable)("Cannot initialize BaseSVGFactory."); - } - create(g, O, I = !1) { - if (g <= 0 || O <= 0) - throw new Error("Invalid SVG dimensions"); - const x = this._createSVG("svg:svg"); - return x.setAttribute("version", "1.1"), I || (x.setAttribute("width", `${g}px`), x.setAttribute("height", `${O}px`)), x.setAttribute("preserveAspectRatio", "none"), x.setAttribute("viewBox", `0 0 ${g} ${O}`), x; - } - createElement(g) { - if (typeof g != "string") - throw new Error("Invalid SVG element type"); - return this._createSVG(g); - } - _createSVG(g) { - (0, l.unreachable)("Abstract method `_createSVG` called."); - } - } - d.BaseSVGFactory = B; - }, - /* 8 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.MurmurHash3_64 = void 0; - var l = et(1); - const P = 3285377520, rt = 4294901760, X = 65535; - class pt { - constructor(F) { - this.h1 = F ? F & 4294967295 : P, this.h2 = F ? F & 4294967295 : P; - } - update(F) { - let g, O; - if (typeof F == "string") { - g = new Uint8Array(F.length * 2), O = 0; - for (let k = 0, p = F.length; k < p; k++) { - const r = F.charCodeAt(k); - r <= 255 ? g[O++] = r : (g[O++] = r >>> 8, g[O++] = r & 255); - } - } else if ((0, l.isArrayBuffer)(F)) - g = F.slice(), O = g.byteLength; - else - throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array."); - const I = O >> 2, x = O - I * 4, v = new Uint32Array(g.buffer, 0, I); - let A = 0, u = 0, _ = this.h1, w = this.h2; - const C = 3432918353, y = 461845907, a = C & X, c = y & X; - for (let k = 0; k < I; k++) - k & 1 ? (A = v[k], A = A * C & rt | A * a & X, A = A << 15 | A >>> 17, A = A * y & rt | A * c & X, _ ^= A, _ = _ << 13 | _ >>> 19, _ = _ * 5 + 3864292196) : (u = v[k], u = u * C & rt | u * a & X, u = u << 15 | u >>> 17, u = u * y & rt | u * c & X, w ^= u, w = w << 13 | w >>> 19, w = w * 5 + 3864292196); - switch (A = 0, x) { - case 3: - A ^= g[I * 4 + 2] << 16; - case 2: - A ^= g[I * 4 + 1] << 8; - case 1: - A ^= g[I * 4], A = A * C & rt | A * a & X, A = A << 15 | A >>> 17, A = A * y & rt | A * c & X, I & 1 ? _ ^= A : w ^= A; - } - this.h1 = _, this.h2 = w; - } - hexdigest() { - let F = this.h1, g = this.h2; - return F ^= g >>> 1, F = F * 3981806797 & rt | F * 36045 & X, g = g * 4283543511 & rt | ((g << 16 | F >>> 16) * 2950163797 & rt) >>> 16, F ^= g >>> 1, F = F * 444984403 & rt | F * 60499 & X, g = g * 3301882366 & rt | ((g << 16 | F >>> 16) * 3120437893 & rt) >>> 16, F ^= g >>> 1, (F >>> 0).toString(16).padStart(8, "0") + (g >>> 0).toString(16).padStart(8, "0"); - } - } - d.MurmurHash3_64 = pt; - }, - /* 9 */ - /***/ - (dt, d, et) => { - var X; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.FontLoader = d.FontFaceObject = void 0; - var l = et(1); - class P { - constructor({ - ownerDocument: B = globalThis.document, - styleElement: F = null - }) { - L(this, X, /* @__PURE__ */ new Set()); - this._document = B, this.nativeFontFaces = /* @__PURE__ */ new Set(), this.styleElement = null, this.loadingRequests = [], this.loadTestFontId = 0; - } - addNativeFontFace(B) { - this.nativeFontFaces.add(B), this._document.fonts.add(B); - } - removeNativeFontFace(B) { - this.nativeFontFaces.delete(B), this._document.fonts.delete(B); - } - insertRule(B) { - this.styleElement || (this.styleElement = this._document.createElement("style"), this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)); - const F = this.styleElement.sheet; - F.insertRule(B, F.cssRules.length); - } - clear() { - for (const B of this.nativeFontFaces) - this._document.fonts.delete(B); - this.nativeFontFaces.clear(), t(this, X).clear(), this.styleElement && (this.styleElement.remove(), this.styleElement = null); - } - async loadSystemFont(B) { - if (!(!B || t(this, X).has(B.loadedName))) { - if ((0, l.assert)(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) { - const { - loadedName: F, - src: g, - style: O - } = B, I = new FontFace(F, g, O); - this.addNativeFontFace(I); - try { - await I.load(), t(this, X).add(F); - } catch { - (0, l.warn)(`Cannot load system font: ${B.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(I); - } - return; - } - (0, l.unreachable)("Not implemented: loadSystemFont without the Font Loading API."); - } - } - async bind(B) { - if (B.attached || B.missingFile && !B.systemFontInfo) - return; - if (B.attached = !0, B.systemFontInfo) { - await this.loadSystemFont(B.systemFontInfo); - return; - } - if (this.isFontLoadingAPISupported) { - const g = B.createNativeFontFace(); - if (g) { - this.addNativeFontFace(g); - try { - await g.loaded; - } catch (O) { - throw (0, l.warn)(`Failed to load font '${g.family}': '${O}'.`), B.disableFontFace = !0, O; - } - } - return; - } - const F = B.createFontFaceRule(); - if (F) { - if (this.insertRule(F), this.isSyncFontLoadingSupported) - return; - await new Promise((g) => { - const O = this._queueLoadingCallback(g); - this._prepareFontLoadEvent(B, O); - }); - } - } - get isFontLoadingAPISupported() { - var F; - const B = !!((F = this._document) != null && F.fonts); - return (0, l.shadow)(this, "isFontLoadingAPISupported", B); - } - get isSyncFontLoadingSupported() { - let B = !1; - return (l.isNodeJS || typeof navigator < "u" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) && (B = !0), (0, l.shadow)(this, "isSyncFontLoadingSupported", B); - } - _queueLoadingCallback(B) { - function F() { - for ((0, l.assert)(!O.done, "completeRequest() cannot be called twice."), O.done = !0; g.length > 0 && g[0].done; ) { - const I = g.shift(); - setTimeout(I.callback, 0); - } - } - const { - loadingRequests: g - } = this, O = { - done: !1, - complete: F, - callback: B - }; - return g.push(O), O; - } - get _loadTestFont() { - const B = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="); - return (0, l.shadow)(this, "_loadTestFont", B); - } - _prepareFontLoadEvent(B, F) { - function g(m, U) { - return m.charCodeAt(U) << 24 | m.charCodeAt(U + 1) << 16 | m.charCodeAt(U + 2) << 8 | m.charCodeAt(U + 3) & 255; - } - function O(m, U, z, E) { - const V = m.substring(0, U), st = m.substring(U + z); - return V + E + st; - } - let I, x; - const v = this._document.createElement("canvas"); - v.width = 1, v.height = 1; - const A = v.getContext("2d"); - let u = 0; - function _(m, U) { - if (++u > 30) { - (0, l.warn)("Load test font never loaded."), U(); - return; - } - if (A.font = "30px " + m, A.fillText(".", 0, 20), A.getImageData(0, 0, 1, 1).data[3] > 0) { - U(); - return; - } - setTimeout(_.bind(null, m, U)); - } - const w = `lt${Date.now()}${this.loadTestFontId++}`; - let C = this._loadTestFont; - C = O(C, 976, w.length, w); - const a = 16, c = 1482184792; - let k = g(C, a); - for (I = 0, x = w.length - 3; I < x; I += 4) - k = k - c + g(w, I) | 0; - I < w.length && (k = k - c + g(w + "XXX", I) | 0), C = O(C, a, 4, (0, l.string32)(k)); - const p = `url(data:font/opentype;base64,${btoa(C)});`, r = `@font-face {font-family:"${w}";src:${p}}`; - this.insertRule(r); - const T = this._document.createElement("div"); - T.style.visibility = "hidden", T.style.width = T.style.height = "10px", T.style.position = "absolute", T.style.top = T.style.left = "0px"; - for (const m of [B.loadedName, w]) { - const U = this._document.createElement("span"); - U.textContent = "Hi", U.style.fontFamily = m, T.append(U); - } - this._document.body.append(T), _(w, () => { - T.remove(), F.complete(); - }); - } - } - X = new WeakMap(), d.FontLoader = P; - class rt { - constructor(B, { - isEvalSupported: F = !0, - disableFontFace: g = !1, - ignoreErrors: O = !1, - inspectFont: I = null - }) { - this.compiledGlyphs = /* @__PURE__ */ Object.create(null); - for (const x in B) - this[x] = B[x]; - this.isEvalSupported = F !== !1, this.disableFontFace = g === !0, this.ignoreErrors = O === !0, this._inspectFont = I; - } - createNativeFontFace() { - var F; - if (!this.data || this.disableFontFace) - return null; - let B; - if (!this.cssFontInfo) - B = new FontFace(this.loadedName, this.data, {}); - else { - const g = { - weight: this.cssFontInfo.fontWeight - }; - this.cssFontInfo.italicAngle && (g.style = `oblique ${this.cssFontInfo.italicAngle}deg`), B = new FontFace(this.cssFontInfo.fontFamily, this.data, g); - } - return (F = this._inspectFont) == null || F.call(this, this), B; - } - createFontFaceRule() { - var O; - if (!this.data || this.disableFontFace) - return null; - const B = (0, l.bytesToString)(this.data), F = `url(data:${this.mimetype};base64,${btoa(B)});`; - let g; - if (!this.cssFontInfo) - g = `@font-face {font-family:"${this.loadedName}";src:${F}}`; - else { - let I = `font-weight: ${this.cssFontInfo.fontWeight};`; - this.cssFontInfo.italicAngle && (I += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`), g = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${I}src:${F}}`; - } - return (O = this._inspectFont) == null || O.call(this, this, F), g; - } - getPathGenerator(B, F) { - if (this.compiledGlyphs[F] !== void 0) - return this.compiledGlyphs[F]; - let g; - try { - g = B.get(this.loadedName + "_path_" + F); - } catch (O) { - if (!this.ignoreErrors) - throw O; - return (0, l.warn)(`getPathGenerator - ignoring character: "${O}".`), this.compiledGlyphs[F] = function(I, x) { - }; - } - if (this.isEvalSupported && l.FeatureTest.isEvalSupported) { - const O = []; - for (const I of g) { - const x = I.args !== void 0 ? I.args.join(",") : ""; - O.push("c.", I.cmd, "(", x, `); -`); - } - return this.compiledGlyphs[F] = new Function("c", "size", O.join("")); - } - return this.compiledGlyphs[F] = function(O, I) { - for (const x of g) - x.cmd === "scale" && (x.args = [I, -I]), O[x.cmd].apply(O, x.args); - }; - } - } - d.FontFaceObject = rt; - }, - /* 10 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.NodeStandardFontDataFactory = d.NodeFilterFactory = d.NodeCanvasFactory = d.NodeCMapReaderFactory = void 0; - var l = et(7); - et(1); - const P = function(F) { - return new Promise((g, O) => { - require$$5.readFile(F, (x, v) => { - if (x || !v) { - O(new Error(x)); - return; - } - g(new Uint8Array(v)); - }); - }); - }; - class rt extends l.BaseFilterFactory { - } - d.NodeFilterFactory = rt; - class X extends l.BaseCanvasFactory { - _createCanvas(g, O) { - return require$$5.createCanvas(g, O); - } - } - d.NodeCanvasFactory = X; - class pt extends l.BaseCMapReaderFactory { - _fetchData(g, O) { - return P(g).then((I) => ({ - cMapData: I, - compressionType: O - })); - } - } - d.NodeCMapReaderFactory = pt; - class B extends l.BaseStandardFontDataFactory { - _fetchData(g) { - return P(g); - } - } - d.NodeStandardFontDataFactory = B; - }, - /* 11 */ - /***/ - (dt, d, et) => { - var H, Qe, gt, Ze; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.CanvasGraphics = void 0; - var l = et(1), P = et(6), rt = et(12), X = et(13); - const pt = 16, B = 100, F = 4096, g = 15, O = 10, I = 1e3, x = 16; - function v(S, i) { - if (S._removeMirroring) - throw new Error("Context is already forwarding operations."); - S.__originalSave = S.save, S.__originalRestore = S.restore, S.__originalRotate = S.rotate, S.__originalScale = S.scale, S.__originalTranslate = S.translate, S.__originalTransform = S.transform, S.__originalSetTransform = S.setTransform, S.__originalResetTransform = S.resetTransform, S.__originalClip = S.clip, S.__originalMoveTo = S.moveTo, S.__originalLineTo = S.lineTo, S.__originalBezierCurveTo = S.bezierCurveTo, S.__originalRect = S.rect, S.__originalClosePath = S.closePath, S.__originalBeginPath = S.beginPath, S._removeMirroring = () => { - S.save = S.__originalSave, S.restore = S.__originalRestore, S.rotate = S.__originalRotate, S.scale = S.__originalScale, S.translate = S.__originalTranslate, S.transform = S.__originalTransform, S.setTransform = S.__originalSetTransform, S.resetTransform = S.__originalResetTransform, S.clip = S.__originalClip, S.moveTo = S.__originalMoveTo, S.lineTo = S.__originalLineTo, S.bezierCurveTo = S.__originalBezierCurveTo, S.rect = S.__originalRect, S.closePath = S.__originalClosePath, S.beginPath = S.__originalBeginPath, delete S._removeMirroring; - }, S.save = function() { - i.save(), this.__originalSave(); - }, S.restore = function() { - i.restore(), this.__originalRestore(); - }, S.translate = function(s, o) { - i.translate(s, o), this.__originalTranslate(s, o); - }, S.scale = function(s, o) { - i.scale(s, o), this.__originalScale(s, o); - }, S.transform = function(s, o, h, b, M, N) { - i.transform(s, o, h, b, M, N), this.__originalTransform(s, o, h, b, M, N); - }, S.setTransform = function(s, o, h, b, M, N) { - i.setTransform(s, o, h, b, M, N), this.__originalSetTransform(s, o, h, b, M, N); - }, S.resetTransform = function() { - i.resetTransform(), this.__originalResetTransform(); - }, S.rotate = function(s) { - i.rotate(s), this.__originalRotate(s); - }, S.clip = function(s) { - i.clip(s), this.__originalClip(s); - }, S.moveTo = function(n, s) { - i.moveTo(n, s), this.__originalMoveTo(n, s); - }, S.lineTo = function(n, s) { - i.lineTo(n, s), this.__originalLineTo(n, s); - }, S.bezierCurveTo = function(n, s, o, h, b, M) { - i.bezierCurveTo(n, s, o, h, b, M), this.__originalBezierCurveTo(n, s, o, h, b, M); - }, S.rect = function(n, s, o, h) { - i.rect(n, s, o, h), this.__originalRect(n, s, o, h); - }, S.closePath = function() { - i.closePath(), this.__originalClosePath(); - }, S.beginPath = function() { - i.beginPath(), this.__originalBeginPath(); - }; - } - class A { - constructor(i) { - this.canvasFactory = i, this.cache = /* @__PURE__ */ Object.create(null); - } - getCanvas(i, n, s) { - let o; - return this.cache[i] !== void 0 ? (o = this.cache[i], this.canvasFactory.reset(o, n, s)) : (o = this.canvasFactory.create(n, s), this.cache[i] = o), o; - } - delete(i) { - delete this.cache[i]; - } - clear() { - for (const i in this.cache) { - const n = this.cache[i]; - this.canvasFactory.destroy(n), delete this.cache[i]; - } - } - } - function u(S, i, n, s, o, h, b, M, N, tt) { - const [Q, nt, ct, yt, ut, Ft] = (0, P.getCurrentTransform)(S); - if (nt === 0 && ct === 0) { - const Dt = b * Q + ut, ft = Math.round(Dt), K = M * yt + Ft, J = Math.round(K), ht = (b + N) * Q + ut, Et = Math.abs(Math.round(ht) - ft) || 1, Ct = (M + tt) * yt + Ft, jt = Math.abs(Math.round(Ct) - J) || 1; - return S.setTransform(Math.sign(Q), 0, 0, Math.sign(yt), ft, J), S.drawImage(i, n, s, o, h, 0, 0, Et, jt), S.setTransform(Q, nt, ct, yt, ut, Ft), [Et, jt]; - } - if (Q === 0 && yt === 0) { - const Dt = M * ct + ut, ft = Math.round(Dt), K = b * nt + Ft, J = Math.round(K), ht = (M + tt) * ct + ut, Et = Math.abs(Math.round(ht) - ft) || 1, Ct = (b + N) * nt + Ft, jt = Math.abs(Math.round(Ct) - J) || 1; - return S.setTransform(0, Math.sign(nt), Math.sign(ct), 0, ft, J), S.drawImage(i, n, s, o, h, 0, 0, jt, Et), S.setTransform(Q, nt, ct, yt, ut, Ft), [jt, Et]; - } - S.drawImage(i, n, s, o, h, b, M, N, tt); - const Bt = Math.hypot(Q, nt), St = Math.hypot(ct, yt); - return [Bt * N, St * tt]; - } - function _(S) { - const { - width: i, - height: n - } = S; - if (i > I || n > I) - return null; - const s = 1e3, o = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]), h = i + 1; - let b = new Uint8Array(h * (n + 1)), M, N, tt; - const Q = i + 7 & -8; - let nt = new Uint8Array(Q * n), ct = 0; - for (const St of S.data) { - let Dt = 128; - for (; Dt > 0; ) - nt[ct++] = St & Dt ? 0 : 255, Dt >>= 1; - } - let yt = 0; - for (ct = 0, nt[ct] !== 0 && (b[0] = 1, ++yt), N = 1; N < i; N++) - nt[ct] !== nt[ct + 1] && (b[N] = nt[ct] ? 2 : 1, ++yt), ct++; - for (nt[ct] !== 0 && (b[N] = 2, ++yt), M = 1; M < n; M++) { - ct = M * Q, tt = M * h, nt[ct - Q] !== nt[ct] && (b[tt] = nt[ct] ? 1 : 8, ++yt); - let St = (nt[ct] ? 4 : 0) + (nt[ct - Q] ? 8 : 0); - for (N = 1; N < i; N++) - St = (St >> 2) + (nt[ct + 1] ? 4 : 0) + (nt[ct - Q + 1] ? 8 : 0), o[St] && (b[tt + N] = o[St], ++yt), ct++; - if (nt[ct - Q] !== nt[ct] && (b[tt + N] = nt[ct] ? 2 : 4, ++yt), yt > s) - return null; - } - for (ct = Q * (n - 1), tt = M * h, nt[ct] !== 0 && (b[tt] = 8, ++yt), N = 1; N < i; N++) - nt[ct] !== nt[ct + 1] && (b[tt + N] = nt[ct] ? 4 : 8, ++yt), ct++; - if (nt[ct] !== 0 && (b[tt + N] = 4, ++yt), yt > s) - return null; - const ut = new Int32Array([0, h, -1, 0, -h, 0, 0, 0, 1]), Ft = new Path2D(); - for (M = 0; yt && M <= n; M++) { - let St = M * h; - const Dt = St + i; - for (; St < Dt && !b[St]; ) - St++; - if (St === Dt) - continue; - Ft.moveTo(St % h, M); - const ft = St; - let K = b[St]; - do { - const J = ut[K]; - do - St += J; - while (!b[St]); - const ht = b[St]; - ht !== 5 && ht !== 10 ? (K = ht, b[St] = 0) : (K = ht & 51 * K >> 4, b[St] &= K >> 2 | K << 2), Ft.lineTo(St % h, St / h | 0), b[St] || --yt; - } while (ft !== St); - --M; - } - return nt = null, b = null, function(St) { - St.save(), St.scale(1 / i, -1 / n), St.translate(0, -n), St.fill(Ft), St.beginPath(), St.restore(); - }; - } - class w { - constructor(i, n) { - this.alphaIsShape = !1, this.fontSize = 0, this.fontSizeScale = 1, this.textMatrix = l.IDENTITY_MATRIX, this.textMatrixScale = 1, this.fontMatrix = l.FONT_IDENTITY_MATRIX, this.leading = 0, this.x = 0, this.y = 0, this.lineX = 0, this.lineY = 0, this.charSpacing = 0, this.wordSpacing = 0, this.textHScale = 1, this.textRenderingMode = l.TextRenderingMode.FILL, this.textRise = 0, this.fillColor = "#000000", this.strokeColor = "#000000", this.patternFill = !1, this.fillAlpha = 1, this.strokeAlpha = 1, this.lineWidth = 1, this.activeSMask = null, this.transferMaps = "none", this.startNewPathAndClipBox([0, 0, i, n]); - } - clone() { - const i = Object.create(this); - return i.clipBox = this.clipBox.slice(), i; - } - setCurrentPoint(i, n) { - this.x = i, this.y = n; - } - updatePathMinMax(i, n, s) { - [n, s] = l.Util.applyTransform([n, s], i), this.minX = Math.min(this.minX, n), this.minY = Math.min(this.minY, s), this.maxX = Math.max(this.maxX, n), this.maxY = Math.max(this.maxY, s); - } - updateRectMinMax(i, n) { - const s = l.Util.applyTransform(n, i), o = l.Util.applyTransform(n.slice(2), i); - this.minX = Math.min(this.minX, s[0], o[0]), this.minY = Math.min(this.minY, s[1], o[1]), this.maxX = Math.max(this.maxX, s[0], o[0]), this.maxY = Math.max(this.maxY, s[1], o[1]); - } - updateScalingPathMinMax(i, n) { - l.Util.scaleMinMax(i, n), this.minX = Math.min(this.minX, n[0]), this.maxX = Math.max(this.maxX, n[1]), this.minY = Math.min(this.minY, n[2]), this.maxY = Math.max(this.maxY, n[3]); - } - updateCurvePathMinMax(i, n, s, o, h, b, M, N, tt, Q) { - const nt = l.Util.bezierBoundingBox(n, s, o, h, b, M, N, tt); - if (Q) { - Q[0] = Math.min(Q[0], nt[0], nt[2]), Q[1] = Math.max(Q[1], nt[0], nt[2]), Q[2] = Math.min(Q[2], nt[1], nt[3]), Q[3] = Math.max(Q[3], nt[1], nt[3]); - return; - } - this.updateRectMinMax(i, nt); - } - getPathBoundingBox(i = rt.PathType.FILL, n = null) { - const s = [this.minX, this.minY, this.maxX, this.maxY]; - if (i === rt.PathType.STROKE) { - n || (0, l.unreachable)("Stroke bounding box must include transform."); - const o = l.Util.singularValueDecompose2dScale(n), h = o[0] * this.lineWidth / 2, b = o[1] * this.lineWidth / 2; - s[0] -= h, s[1] -= b, s[2] += h, s[3] += b; - } - return s; - } - updateClipFromPath() { - const i = l.Util.intersect(this.clipBox, this.getPathBoundingBox()); - this.startNewPathAndClipBox(i || [0, 0, 0, 0]); - } - isEmptyClip() { - return this.minX === 1 / 0; - } - startNewPathAndClipBox(i) { - this.clipBox = i, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = 0, this.maxY = 0; - } - getClippedPathBoundingBox(i = rt.PathType.FILL, n = null) { - return l.Util.intersect(this.clipBox, this.getPathBoundingBox(i, n)); - } - } - function C(S, i) { - if (typeof ImageData < "u" && i instanceof ImageData) { - S.putImageData(i, 0, 0); - return; - } - const n = i.height, s = i.width, o = n % x, h = (n - o) / x, b = o === 0 ? h : h + 1, M = S.createImageData(s, x); - let N = 0, tt; - const Q = i.data, nt = M.data; - let ct, yt, ut, Ft; - if (i.kind === l.ImageKind.GRAYSCALE_1BPP) { - const Bt = Q.byteLength, St = new Uint32Array(nt.buffer, 0, nt.byteLength >> 2), Dt = St.length, ft = s + 7 >> 3, K = 4294967295, J = l.FeatureTest.isLittleEndian ? 4278190080 : 255; - for (ct = 0; ct < b; ct++) { - for (ut = ct < h ? x : o, tt = 0, yt = 0; yt < ut; yt++) { - const ht = Bt - N; - let Et = 0; - const Ct = ht > ft ? s : ht * 8 - 7, jt = Ct & -8; - let Gt = 0, Ht = 0; - for (; Et < jt; Et += 8) - Ht = Q[N++], St[tt++] = Ht & 128 ? K : J, St[tt++] = Ht & 64 ? K : J, St[tt++] = Ht & 32 ? K : J, St[tt++] = Ht & 16 ? K : J, St[tt++] = Ht & 8 ? K : J, St[tt++] = Ht & 4 ? K : J, St[tt++] = Ht & 2 ? K : J, St[tt++] = Ht & 1 ? K : J; - for (; Et < Ct; Et++) - Gt === 0 && (Ht = Q[N++], Gt = 128), St[tt++] = Ht & Gt ? K : J, Gt >>= 1; - } - for (; tt < Dt; ) - St[tt++] = 0; - S.putImageData(M, 0, ct * x); - } - } else if (i.kind === l.ImageKind.RGBA_32BPP) { - for (yt = 0, Ft = s * x * 4, ct = 0; ct < h; ct++) - nt.set(Q.subarray(N, N + Ft)), N += Ft, S.putImageData(M, 0, yt), yt += x; - ct < b && (Ft = s * o * 4, nt.set(Q.subarray(N, N + Ft)), S.putImageData(M, 0, yt)); - } else if (i.kind === l.ImageKind.RGB_24BPP) - for (ut = x, Ft = s * ut, ct = 0; ct < b; ct++) { - for (ct >= h && (ut = o, Ft = s * ut), tt = 0, yt = Ft; yt--; ) - nt[tt++] = Q[N++], nt[tt++] = Q[N++], nt[tt++] = Q[N++], nt[tt++] = 255; - S.putImageData(M, 0, ct * x); - } - else - throw new Error(`bad image kind: ${i.kind}`); - } - function y(S, i) { - if (i.bitmap) { - S.drawImage(i.bitmap, 0, 0); - return; - } - const n = i.height, s = i.width, o = n % x, h = (n - o) / x, b = o === 0 ? h : h + 1, M = S.createImageData(s, x); - let N = 0; - const tt = i.data, Q = M.data; - for (let nt = 0; nt < b; nt++) { - const ct = nt < h ? x : o; - ({ - srcPos: N - } = (0, X.convertBlackAndWhiteToRGBA)({ - src: tt, - srcPos: N, - dest: Q, - width: s, - height: ct, - nonBlackColor: 0 - })), S.putImageData(M, 0, nt * x); - } - } - function a(S, i) { - const n = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"]; - for (const s of n) - S[s] !== void 0 && (i[s] = S[s]); - S.setLineDash !== void 0 && (i.setLineDash(S.getLineDash()), i.lineDashOffset = S.lineDashOffset); - } - function c(S) { - if (S.strokeStyle = S.fillStyle = "#000000", S.fillRule = "nonzero", S.globalAlpha = 1, S.lineWidth = 1, S.lineCap = "butt", S.lineJoin = "miter", S.miterLimit = 10, S.globalCompositeOperation = "source-over", S.font = "10px sans-serif", S.setLineDash !== void 0 && (S.setLineDash([]), S.lineDashOffset = 0), !l.isNodeJS) { - const { - filter: i - } = S; - i !== "none" && i !== "" && (S.filter = "none"); - } - } - function k(S, i, n, s) { - const o = S.length; - for (let h = 3; h < o; h += 4) { - const b = S[h]; - if (b === 0) - S[h - 3] = i, S[h - 2] = n, S[h - 1] = s; - else if (b < 255) { - const M = 255 - b; - S[h - 3] = S[h - 3] * b + i * M >> 8, S[h - 2] = S[h - 2] * b + n * M >> 8, S[h - 1] = S[h - 1] * b + s * M >> 8; - } - } - } - function p(S, i, n) { - const s = S.length, o = 1 / 255; - for (let h = 3; h < s; h += 4) { - const b = n ? n[S[h]] : S[h]; - i[h] = i[h] * b * o | 0; - } - } - function r(S, i, n) { - const s = S.length; - for (let o = 3; o < s; o += 4) { - const h = S[o - 3] * 77 + S[o - 2] * 152 + S[o - 1] * 28; - i[o] = n ? i[o] * n[h >> 8] >> 8 : i[o] * h >> 16; - } - } - function T(S, i, n, s, o, h, b, M, N, tt, Q) { - const nt = !!h, ct = nt ? h[0] : 0, yt = nt ? h[1] : 0, ut = nt ? h[2] : 0, Ft = o === "Luminosity" ? r : p, St = Math.min(s, Math.ceil(1048576 / n)); - for (let Dt = 0; Dt < s; Dt += St) { - const ft = Math.min(St, s - Dt), K = S.getImageData(M - tt, Dt + (N - Q), n, ft), J = i.getImageData(M, Dt + N, n, ft); - nt && k(K.data, ct, yt, ut), Ft(K.data, J.data, b), i.putImageData(J, M, Dt + N); - } - } - function m(S, i, n, s) { - const o = s[0], h = s[1], b = s[2] - o, M = s[3] - h; - b === 0 || M === 0 || (T(i.context, n, b, M, i.subtype, i.backdrop, i.transferMap, o, h, i.offsetX, i.offsetY), S.save(), S.globalAlpha = 1, S.globalCompositeOperation = "source-over", S.setTransform(1, 0, 0, 1, 0, 0), S.drawImage(n.canvas, 0, 0), S.restore()); - } - function U(S, i) { - const n = l.Util.singularValueDecompose2dScale(S); - n[0] = Math.fround(n[0]), n[1] = Math.fround(n[1]); - const s = Math.fround((globalThis.devicePixelRatio || 1) * P.PixelsPerInch.PDF_TO_CSS_UNITS); - return i !== void 0 ? i : n[0] <= s || n[1] <= s; - } - const z = ["butt", "round", "square"], E = ["miter", "round", "bevel"], V = {}, st = {}, xt = class xt { - constructor(i, n, s, o, h, { - optionalContentConfig: b, - markedContentStack: M = null - }, N, tt) { - L(this, H); - L(this, gt); - this.ctx = i, this.current = new w(this.ctx.canvas.width, this.ctx.canvas.height), this.stateStack = [], this.pendingClip = null, this.pendingEOFill = !1, this.res = null, this.xobjs = null, this.commonObjs = n, this.objs = s, this.canvasFactory = o, this.filterFactory = h, this.groupStack = [], this.processingType3 = null, this.baseTransform = null, this.baseTransformStack = [], this.groupLevel = 0, this.smaskStack = [], this.smaskCounter = 0, this.tempSMask = null, this.suspendedCtx = null, this.contentVisible = !0, this.markedContentStack = M || [], this.optionalContentConfig = b, this.cachedCanvases = new A(this.canvasFactory), this.cachedPatterns = /* @__PURE__ */ new Map(), this.annotationCanvasMap = N, this.viewportScale = 1, this.outputScaleX = 1, this.outputScaleY = 1, this.pageColors = tt, this._cachedScaleForStroking = [-1, 0], this._cachedGetSinglePixelWidth = null, this._cachedBitmapsMap = /* @__PURE__ */ new Map(); - } - getObject(i, n = null) { - return typeof i == "string" ? i.startsWith("g_") ? this.commonObjs.get(i) : this.objs.get(i) : n; - } - beginDrawing({ - transform: i, - viewport: n, - transparency: s = !1, - background: o = null - }) { - const h = this.ctx.canvas.width, b = this.ctx.canvas.height, M = this.ctx.fillStyle; - if (this.ctx.fillStyle = o || "#ffffff", this.ctx.fillRect(0, 0, h, b), this.ctx.fillStyle = M, s) { - const N = this.cachedCanvases.getCanvas("transparent", h, b); - this.compositeCtx = this.ctx, this.transparentCanvas = N.canvas, this.ctx = N.context, this.ctx.save(), this.ctx.transform(...(0, P.getCurrentTransform)(this.compositeCtx)); - } - this.ctx.save(), c(this.ctx), i && (this.ctx.transform(...i), this.outputScaleX = i[0], this.outputScaleY = i[0]), this.ctx.transform(...n.transform), this.viewportScale = n.scale, this.baseTransform = (0, P.getCurrentTransform)(this.ctx); - } - executeOperatorList(i, n, s, o) { - const h = i.argsArray, b = i.fnArray; - let M = n || 0; - const N = h.length; - if (N === M) - return M; - const tt = N - M > O && typeof s == "function", Q = tt ? Date.now() + g : 0; - let nt = 0; - const ct = this.commonObjs, yt = this.objs; - let ut; - for (; ; ) { - if (o !== void 0 && M === o.nextBreakPoint) - return o.breakIt(M, s), M; - if (ut = b[M], ut !== l.OPS.dependency) - this[ut].apply(this, h[M]); - else - for (const Ft of h[M]) { - const Bt = Ft.startsWith("g_") ? ct : yt; - if (!Bt.has(Ft)) - return Bt.get(Ft, s), M; - } - if (M++, M === N) - return M; - if (tt && ++nt > O) { - if (Date.now() > Q) - return s(), M; - nt = 0; - } - } - } - endDrawing() { - W(this, H, Qe).call(this), this.cachedCanvases.clear(), this.cachedPatterns.clear(); - for (const i of this._cachedBitmapsMap.values()) { - for (const n of i.values()) - typeof HTMLCanvasElement < "u" && n instanceof HTMLCanvasElement && (n.width = n.height = 0); - i.clear(); - } - this._cachedBitmapsMap.clear(), W(this, gt, Ze).call(this); - } - _scaleImage(i, n) { - const s = i.width, o = i.height; - let h = Math.max(Math.hypot(n[0], n[1]), 1), b = Math.max(Math.hypot(n[2], n[3]), 1), M = s, N = o, tt = "prescale1", Q, nt; - for (; h > 2 && M > 1 || b > 2 && N > 1; ) { - let ct = M, yt = N; - h > 2 && M > 1 && (ct = M >= 16384 ? Math.floor(M / 2) - 1 || 1 : Math.ceil(M / 2), h /= M / ct), b > 2 && N > 1 && (yt = N >= 16384 ? Math.floor(N / 2) - 1 || 1 : Math.ceil(N) / 2, b /= N / yt), Q = this.cachedCanvases.getCanvas(tt, ct, yt), nt = Q.context, nt.clearRect(0, 0, ct, yt), nt.drawImage(i, 0, 0, M, N, 0, 0, ct, yt), i = Q.canvas, M = ct, N = yt, tt = tt === "prescale1" ? "prescale2" : "prescale1"; - } - return { - img: i, - paintWidth: M, - paintHeight: N - }; - } - _createMaskCanvas(i) { - const n = this.ctx, { - width: s, - height: o - } = i, h = this.current.fillColor, b = this.current.patternFill, M = (0, P.getCurrentTransform)(n); - let N, tt, Q, nt; - if ((i.bitmap || i.data) && i.count > 1) { - const Et = i.bitmap || i.data.buffer; - tt = JSON.stringify(b ? M : [M.slice(0, 4), h]), N = this._cachedBitmapsMap.get(Et), N || (N = /* @__PURE__ */ new Map(), this._cachedBitmapsMap.set(Et, N)); - const Ct = N.get(tt); - if (Ct && !b) { - const jt = Math.round(Math.min(M[0], M[2]) + M[4]), Gt = Math.round(Math.min(M[1], M[3]) + M[5]); - return { - canvas: Ct, - offsetX: jt, - offsetY: Gt - }; - } - Q = Ct; - } - Q || (nt = this.cachedCanvases.getCanvas("maskCanvas", s, o), y(nt.context, i)); - let ct = l.Util.transform(M, [1 / s, 0, 0, -1 / o, 0, 0]); - ct = l.Util.transform(ct, [1, 0, 0, 1, 0, -o]); - const yt = l.Util.applyTransform([0, 0], ct), ut = l.Util.applyTransform([s, o], ct), Ft = l.Util.normalizeRect([yt[0], yt[1], ut[0], ut[1]]), Bt = Math.round(Ft[2] - Ft[0]) || 1, St = Math.round(Ft[3] - Ft[1]) || 1, Dt = this.cachedCanvases.getCanvas("fillCanvas", Bt, St), ft = Dt.context, K = Math.min(yt[0], ut[0]), J = Math.min(yt[1], ut[1]); - ft.translate(-K, -J), ft.transform(...ct), Q || (Q = this._scaleImage(nt.canvas, (0, P.getCurrentTransformInverse)(ft)), Q = Q.img, N && b && N.set(tt, Q)), ft.imageSmoothingEnabled = U((0, P.getCurrentTransform)(ft), i.interpolate), u(ft, Q, 0, 0, Q.width, Q.height, 0, 0, s, o), ft.globalCompositeOperation = "source-in"; - const ht = l.Util.transform((0, P.getCurrentTransformInverse)(ft), [1, 0, 0, 1, -K, -J]); - return ft.fillStyle = b ? h.getPattern(n, this, ht, rt.PathType.FILL) : h, ft.fillRect(0, 0, s, o), N && !b && (this.cachedCanvases.delete("fillCanvas"), N.set(tt, Dt.canvas)), { - canvas: Dt.canvas, - offsetX: Math.round(K), - offsetY: Math.round(J) - }; - } - setLineWidth(i) { - i !== this.current.lineWidth && (this._cachedScaleForStroking[0] = -1), this.current.lineWidth = i, this.ctx.lineWidth = i; - } - setLineCap(i) { - this.ctx.lineCap = z[i]; - } - setLineJoin(i) { - this.ctx.lineJoin = E[i]; - } - setMiterLimit(i) { - this.ctx.miterLimit = i; - } - setDash(i, n) { - const s = this.ctx; - s.setLineDash !== void 0 && (s.setLineDash(i), s.lineDashOffset = n); - } - setRenderingIntent(i) { - } - setFlatness(i) { - } - setGState(i) { - for (const [n, s] of i) - switch (n) { - case "LW": - this.setLineWidth(s); - break; - case "LC": - this.setLineCap(s); - break; - case "LJ": - this.setLineJoin(s); - break; - case "ML": - this.setMiterLimit(s); - break; - case "D": - this.setDash(s[0], s[1]); - break; - case "RI": - this.setRenderingIntent(s); - break; - case "FL": - this.setFlatness(s); - break; - case "Font": - this.setFont(s[0], s[1]); - break; - case "CA": - this.current.strokeAlpha = s; - break; - case "ca": - this.current.fillAlpha = s, this.ctx.globalAlpha = s; - break; - case "BM": - this.ctx.globalCompositeOperation = s; - break; - case "SMask": - this.current.activeSMask = s ? this.tempSMask : null, this.tempSMask = null, this.checkSMaskState(); - break; - case "TR": - this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(s); - break; - } - } - get inSMaskMode() { - return !!this.suspendedCtx; - } - checkSMaskState() { - const i = this.inSMaskMode; - this.current.activeSMask && !i ? this.beginSMaskMode() : !this.current.activeSMask && i && this.endSMaskMode(); - } - beginSMaskMode() { - if (this.inSMaskMode) - throw new Error("beginSMaskMode called while already in smask mode"); - const i = this.ctx.canvas.width, n = this.ctx.canvas.height, s = "smaskGroupAt" + this.groupLevel, o = this.cachedCanvases.getCanvas(s, i, n); - this.suspendedCtx = this.ctx, this.ctx = o.context; - const h = this.ctx; - h.setTransform(...(0, P.getCurrentTransform)(this.suspendedCtx)), a(this.suspendedCtx, h), v(h, this.suspendedCtx), this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); - } - endSMaskMode() { - if (!this.inSMaskMode) - throw new Error("endSMaskMode called while not in smask mode"); - this.ctx._removeMirroring(), a(this.ctx, this.suspendedCtx), this.ctx = this.suspendedCtx, this.suspendedCtx = null; - } - compose(i) { - if (!this.current.activeSMask) - return; - i ? (i[0] = Math.floor(i[0]), i[1] = Math.floor(i[1]), i[2] = Math.ceil(i[2]), i[3] = Math.ceil(i[3])) : i = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height]; - const n = this.current.activeSMask, s = this.suspendedCtx; - m(s, n, this.ctx, i), this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height), this.ctx.restore(); - } - save() { - this.inSMaskMode ? (a(this.ctx, this.suspendedCtx), this.suspendedCtx.save()) : this.ctx.save(); - const i = this.current; - this.stateStack.push(i), this.current = i.clone(); - } - restore() { - this.stateStack.length === 0 && this.inSMaskMode && this.endSMaskMode(), this.stateStack.length !== 0 && (this.current = this.stateStack.pop(), this.inSMaskMode ? (this.suspendedCtx.restore(), a(this.suspendedCtx, this.ctx)) : this.ctx.restore(), this.checkSMaskState(), this.pendingClip = null, this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null); - } - transform(i, n, s, o, h, b) { - this.ctx.transform(i, n, s, o, h, b), this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null; - } - constructPath(i, n, s) { - const o = this.ctx, h = this.current; - let b = h.x, M = h.y, N, tt; - const Q = (0, P.getCurrentTransform)(o), nt = Q[0] === 0 && Q[3] === 0 || Q[1] === 0 && Q[2] === 0, ct = nt ? s.slice(0) : null; - for (let yt = 0, ut = 0, Ft = i.length; yt < Ft; yt++) - switch (i[yt] | 0) { - case l.OPS.rectangle: - b = n[ut++], M = n[ut++]; - const Bt = n[ut++], St = n[ut++], Dt = b + Bt, ft = M + St; - o.moveTo(b, M), Bt === 0 || St === 0 ? o.lineTo(Dt, ft) : (o.lineTo(Dt, M), o.lineTo(Dt, ft), o.lineTo(b, ft)), nt || h.updateRectMinMax(Q, [b, M, Dt, ft]), o.closePath(); - break; - case l.OPS.moveTo: - b = n[ut++], M = n[ut++], o.moveTo(b, M), nt || h.updatePathMinMax(Q, b, M); - break; - case l.OPS.lineTo: - b = n[ut++], M = n[ut++], o.lineTo(b, M), nt || h.updatePathMinMax(Q, b, M); - break; - case l.OPS.curveTo: - N = b, tt = M, b = n[ut + 4], M = n[ut + 5], o.bezierCurveTo(n[ut], n[ut + 1], n[ut + 2], n[ut + 3], b, M), h.updateCurvePathMinMax(Q, N, tt, n[ut], n[ut + 1], n[ut + 2], n[ut + 3], b, M, ct), ut += 6; - break; - case l.OPS.curveTo2: - N = b, tt = M, o.bezierCurveTo(b, M, n[ut], n[ut + 1], n[ut + 2], n[ut + 3]), h.updateCurvePathMinMax(Q, N, tt, b, M, n[ut], n[ut + 1], n[ut + 2], n[ut + 3], ct), b = n[ut + 2], M = n[ut + 3], ut += 4; - break; - case l.OPS.curveTo3: - N = b, tt = M, b = n[ut + 2], M = n[ut + 3], o.bezierCurveTo(n[ut], n[ut + 1], b, M, b, M), h.updateCurvePathMinMax(Q, N, tt, n[ut], n[ut + 1], b, M, b, M, ct), ut += 4; - break; - case l.OPS.closePath: - o.closePath(); - break; - } - nt && h.updateScalingPathMinMax(Q, ct), h.setCurrentPoint(b, M); - } - closePath() { - this.ctx.closePath(); - } - stroke(i = !0) { - const n = this.ctx, s = this.current.strokeColor; - n.globalAlpha = this.current.strokeAlpha, this.contentVisible && (typeof s == "object" && (s != null && s.getPattern) ? (n.save(), n.strokeStyle = s.getPattern(n, this, (0, P.getCurrentTransformInverse)(n), rt.PathType.STROKE), this.rescaleAndStroke(!1), n.restore()) : this.rescaleAndStroke(!0)), i && this.consumePath(this.current.getClippedPathBoundingBox()), n.globalAlpha = this.current.fillAlpha; - } - closeStroke() { - this.closePath(), this.stroke(); - } - fill(i = !0) { - const n = this.ctx, s = this.current.fillColor, o = this.current.patternFill; - let h = !1; - o && (n.save(), n.fillStyle = s.getPattern(n, this, (0, P.getCurrentTransformInverse)(n), rt.PathType.FILL), h = !0); - const b = this.current.getClippedPathBoundingBox(); - this.contentVisible && b !== null && (this.pendingEOFill ? (n.fill("evenodd"), this.pendingEOFill = !1) : n.fill()), h && n.restore(), i && this.consumePath(b); - } - eoFill() { - this.pendingEOFill = !0, this.fill(); - } - fillStroke() { - this.fill(!1), this.stroke(!1), this.consumePath(); - } - eoFillStroke() { - this.pendingEOFill = !0, this.fillStroke(); - } - closeFillStroke() { - this.closePath(), this.fillStroke(); - } - closeEOFillStroke() { - this.pendingEOFill = !0, this.closePath(), this.fillStroke(); - } - endPath() { - this.consumePath(); - } - clip() { - this.pendingClip = V; - } - eoClip() { - this.pendingClip = st; - } - beginText() { - this.current.textMatrix = l.IDENTITY_MATRIX, this.current.textMatrixScale = 1, this.current.x = this.current.lineX = 0, this.current.y = this.current.lineY = 0; - } - endText() { - const i = this.pendingTextPaths, n = this.ctx; - if (i === void 0) { - n.beginPath(); - return; - } - n.save(), n.beginPath(); - for (const s of i) - n.setTransform(...s.transform), n.translate(s.x, s.y), s.addToPath(n, s.fontSize); - n.restore(), n.clip(), n.beginPath(), delete this.pendingTextPaths; - } - setCharSpacing(i) { - this.current.charSpacing = i; - } - setWordSpacing(i) { - this.current.wordSpacing = i; - } - setHScale(i) { - this.current.textHScale = i / 100; - } - setLeading(i) { - this.current.leading = -i; - } - setFont(i, n) { - var Q; - const s = this.commonObjs.get(i), o = this.current; - if (!s) - throw new Error(`Can't find font for ${i}`); - if (o.fontMatrix = s.fontMatrix || l.FONT_IDENTITY_MATRIX, (o.fontMatrix[0] === 0 || o.fontMatrix[3] === 0) && (0, l.warn)("Invalid font matrix for font " + i), n < 0 ? (n = -n, o.fontDirection = -1) : o.fontDirection = 1, this.current.font = s, this.current.fontSize = n, s.isType3Font) - return; - const h = s.loadedName || "sans-serif", b = ((Q = s.systemFontInfo) == null ? void 0 : Q.css) || `"${h}", ${s.fallbackName}`; - let M = "normal"; - s.black ? M = "900" : s.bold && (M = "bold"); - const N = s.italic ? "italic" : "normal"; - let tt = n; - n < pt ? tt = pt : n > B && (tt = B), this.current.fontSizeScale = n / tt, this.ctx.font = `${N} ${M} ${tt}px ${b}`; - } - setTextRenderingMode(i) { - this.current.textRenderingMode = i; - } - setTextRise(i) { - this.current.textRise = i; - } - moveText(i, n) { - this.current.x = this.current.lineX += i, this.current.y = this.current.lineY += n; - } - setLeadingMoveText(i, n) { - this.setLeading(-n), this.moveText(i, n); - } - setTextMatrix(i, n, s, o, h, b) { - this.current.textMatrix = [i, n, s, o, h, b], this.current.textMatrixScale = Math.hypot(i, n), this.current.x = this.current.lineX = 0, this.current.y = this.current.lineY = 0; - } - nextLine() { - this.moveText(0, this.current.leading); - } - paintChar(i, n, s, o) { - const h = this.ctx, b = this.current, M = b.font, N = b.textRenderingMode, tt = b.fontSize / b.fontSizeScale, Q = N & l.TextRenderingMode.FILL_STROKE_MASK, nt = !!(N & l.TextRenderingMode.ADD_TO_PATH_FLAG), ct = b.patternFill && !M.missingFile; - let yt; - (M.disableFontFace || nt || ct) && (yt = M.getPathGenerator(this.commonObjs, i)), M.disableFontFace || ct ? (h.save(), h.translate(n, s), h.beginPath(), yt(h, tt), o && h.setTransform(...o), (Q === l.TextRenderingMode.FILL || Q === l.TextRenderingMode.FILL_STROKE) && h.fill(), (Q === l.TextRenderingMode.STROKE || Q === l.TextRenderingMode.FILL_STROKE) && h.stroke(), h.restore()) : ((Q === l.TextRenderingMode.FILL || Q === l.TextRenderingMode.FILL_STROKE) && h.fillText(i, n, s), (Q === l.TextRenderingMode.STROKE || Q === l.TextRenderingMode.FILL_STROKE) && h.strokeText(i, n, s)), nt && (this.pendingTextPaths || (this.pendingTextPaths = [])).push({ - transform: (0, P.getCurrentTransform)(h), - x: n, - y: s, - fontSize: tt, - addToPath: yt - }); - } - get isFontSubpixelAAEnabled() { - const { - context: i - } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10); - i.scale(1.5, 1), i.fillText("I", 0, 10); - const n = i.getImageData(0, 0, 10, 10).data; - let s = !1; - for (let o = 3; o < n.length; o += 4) - if (n[o] > 0 && n[o] < 255) { - s = !0; - break; - } - return (0, l.shadow)(this, "isFontSubpixelAAEnabled", s); - } - showText(i) { - const n = this.current, s = n.font; - if (s.isType3Font) - return this.showType3Text(i); - const o = n.fontSize; - if (o === 0) - return; - const h = this.ctx, b = n.fontSizeScale, M = n.charSpacing, N = n.wordSpacing, tt = n.fontDirection, Q = n.textHScale * tt, nt = i.length, ct = s.vertical, yt = ct ? 1 : -1, ut = s.defaultVMetrics, Ft = o * n.fontMatrix[0], Bt = n.textRenderingMode === l.TextRenderingMode.FILL && !s.disableFontFace && !n.patternFill; - h.save(), h.transform(...n.textMatrix), h.translate(n.x, n.y + n.textRise), tt > 0 ? h.scale(Q, -1) : h.scale(Q, 1); - let St; - if (n.patternFill) { - h.save(); - const ht = n.fillColor.getPattern(h, this, (0, P.getCurrentTransformInverse)(h), rt.PathType.FILL); - St = (0, P.getCurrentTransform)(h), h.restore(), h.fillStyle = ht; - } - let Dt = n.lineWidth; - const ft = n.textMatrixScale; - if (ft === 0 || Dt === 0) { - const ht = n.textRenderingMode & l.TextRenderingMode.FILL_STROKE_MASK; - (ht === l.TextRenderingMode.STROKE || ht === l.TextRenderingMode.FILL_STROKE) && (Dt = this.getSinglePixelWidth()); - } else - Dt /= ft; - if (b !== 1 && (h.scale(b, b), Dt /= b), h.lineWidth = Dt, s.isInvalidPDFjsFont) { - const ht = []; - let Et = 0; - for (const Ct of i) - ht.push(Ct.unicode), Et += Ct.width; - h.fillText(ht.join(""), 0, 0), n.x += Et * Ft * Q, h.restore(), this.compose(); - return; - } - let K = 0, J; - for (J = 0; J < nt; ++J) { - const ht = i[J]; - if (typeof ht == "number") { - K += yt * ht * o / 1e3; - continue; - } - let Et = !1; - const Ct = (ht.isSpace ? N : 0) + M, jt = ht.fontChar, Gt = ht.accent; - let Ht, Xt, Vt = ht.width; - if (ct) { - const $t = ht.vmetric || ut, ot = -(ht.vmetric ? $t[1] : Vt * 0.5) * Ft, Y = $t[2] * Ft; - Vt = $t ? -$t[0] : Vt, Ht = ot / b, Xt = (K + Y) / b; - } else - Ht = K / b, Xt = 0; - if (s.remeasure && Vt > 0) { - const $t = h.measureText(jt).width * 1e3 / o * b; - if (Vt < $t && this.isFontSubpixelAAEnabled) { - const ot = Vt / $t; - Et = !0, h.save(), h.scale(ot, 1), Ht /= ot; - } else - Vt !== $t && (Ht += (Vt - $t) / 2e3 * o / b); - } - if (this.contentVisible && (ht.isInFont || s.missingFile)) { - if (Bt && !Gt) - h.fillText(jt, Ht, Xt); - else if (this.paintChar(jt, Ht, Xt, St), Gt) { - const $t = Ht + o * Gt.offset.x / b, ot = Xt - o * Gt.offset.y / b; - this.paintChar(Gt.fontChar, $t, ot, St); - } - } - const Wt = ct ? Vt * Ft - Ct * tt : Vt * Ft + Ct * tt; - K += Wt, Et && h.restore(); - } - ct ? n.y -= K : n.x += K * Q, h.restore(), this.compose(); - } - showType3Text(i) { - const n = this.ctx, s = this.current, o = s.font, h = s.fontSize, b = s.fontDirection, M = o.vertical ? 1 : -1, N = s.charSpacing, tt = s.wordSpacing, Q = s.textHScale * b, nt = s.fontMatrix || l.FONT_IDENTITY_MATRIX, ct = i.length, yt = s.textRenderingMode === l.TextRenderingMode.INVISIBLE; - let ut, Ft, Bt, St; - if (!(yt || h === 0)) { - for (this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null, n.save(), n.transform(...s.textMatrix), n.translate(s.x, s.y), n.scale(Q, b), ut = 0; ut < ct; ++ut) { - if (Ft = i[ut], typeof Ft == "number") { - St = M * Ft * h / 1e3, this.ctx.translate(St, 0), s.x += St * Q; - continue; - } - const Dt = (Ft.isSpace ? tt : 0) + N, ft = o.charProcOperatorList[Ft.operatorListId]; - if (!ft) { - (0, l.warn)(`Type3 character "${Ft.operatorListId}" is not available.`); - continue; - } - this.contentVisible && (this.processingType3 = Ft, this.save(), n.scale(h, h), n.transform(...nt), this.executeOperatorList(ft), this.restore()), Bt = l.Util.applyTransform([Ft.width, 0], nt)[0] * h + Dt, n.translate(Bt, 0), s.x += Bt * Q; - } - n.restore(), this.processingType3 = null; - } - } - setCharWidth(i, n) { - } - setCharWidthAndBounds(i, n, s, o, h, b) { - this.ctx.rect(s, o, h - s, b - o), this.ctx.clip(), this.endPath(); - } - getColorN_Pattern(i) { - let n; - if (i[0] === "TilingPattern") { - const s = i[1], o = this.baseTransform || (0, P.getCurrentTransform)(this.ctx), h = { - createCanvasGraphics: (b) => new xt(b, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, { - optionalContentConfig: this.optionalContentConfig, - markedContentStack: this.markedContentStack - }) - }; - n = new rt.TilingPattern(i, s, this.ctx, h, o); - } else - n = this._getPattern(i[1], i[2]); - return n; - } - setStrokeColorN() { - this.current.strokeColor = this.getColorN_Pattern(arguments); - } - setFillColorN() { - this.current.fillColor = this.getColorN_Pattern(arguments), this.current.patternFill = !0; - } - setStrokeRGBColor(i, n, s) { - const o = l.Util.makeHexColor(i, n, s); - this.ctx.strokeStyle = o, this.current.strokeColor = o; - } - setFillRGBColor(i, n, s) { - const o = l.Util.makeHexColor(i, n, s); - this.ctx.fillStyle = o, this.current.fillColor = o, this.current.patternFill = !1; - } - _getPattern(i, n = null) { - let s; - return this.cachedPatterns.has(i) ? s = this.cachedPatterns.get(i) : (s = (0, rt.getShadingPattern)(this.getObject(i)), this.cachedPatterns.set(i, s)), n && (s.matrix = n), s; - } - shadingFill(i) { - if (!this.contentVisible) - return; - const n = this.ctx; - this.save(); - const s = this._getPattern(i); - n.fillStyle = s.getPattern(n, this, (0, P.getCurrentTransformInverse)(n), rt.PathType.SHADING); - const o = (0, P.getCurrentTransformInverse)(n); - if (o) { - const { - width: h, - height: b - } = n.canvas, [M, N, tt, Q] = l.Util.getAxialAlignedBoundingBox([0, 0, h, b], o); - this.ctx.fillRect(M, N, tt - M, Q - N); - } else - this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); - this.compose(this.current.getClippedPathBoundingBox()), this.restore(); - } - beginInlineImage() { - (0, l.unreachable)("Should not call beginInlineImage"); - } - beginImageData() { - (0, l.unreachable)("Should not call beginImageData"); - } - paintFormXObjectBegin(i, n) { - if (this.contentVisible && (this.save(), this.baseTransformStack.push(this.baseTransform), Array.isArray(i) && i.length === 6 && this.transform(...i), this.baseTransform = (0, P.getCurrentTransform)(this.ctx), n)) { - const s = n[2] - n[0], o = n[3] - n[1]; - this.ctx.rect(n[0], n[1], s, o), this.current.updateRectMinMax((0, P.getCurrentTransform)(this.ctx), n), this.clip(), this.endPath(); - } - } - paintFormXObjectEnd() { - this.contentVisible && (this.restore(), this.baseTransform = this.baseTransformStack.pop()); - } - beginGroup(i) { - if (!this.contentVisible) - return; - this.save(), this.inSMaskMode && (this.endSMaskMode(), this.current.activeSMask = null); - const n = this.ctx; - i.isolated || (0, l.info)("TODO: Support non-isolated groups."), i.knockout && (0, l.warn)("Knockout groups not supported."); - const s = (0, P.getCurrentTransform)(n); - if (i.matrix && n.transform(...i.matrix), !i.bbox) - throw new Error("Bounding box is required."); - let o = l.Util.getAxialAlignedBoundingBox(i.bbox, (0, P.getCurrentTransform)(n)); - const h = [0, 0, n.canvas.width, n.canvas.height]; - o = l.Util.intersect(o, h) || [0, 0, 0, 0]; - const b = Math.floor(o[0]), M = Math.floor(o[1]); - let N = Math.max(Math.ceil(o[2]) - b, 1), tt = Math.max(Math.ceil(o[3]) - M, 1), Q = 1, nt = 1; - N > F && (Q = N / F, N = F), tt > F && (nt = tt / F, tt = F), this.current.startNewPathAndClipBox([0, 0, N, tt]); - let ct = "groupAt" + this.groupLevel; - i.smask && (ct += "_smask_" + this.smaskCounter++ % 2); - const yt = this.cachedCanvases.getCanvas(ct, N, tt), ut = yt.context; - ut.scale(1 / Q, 1 / nt), ut.translate(-b, -M), ut.transform(...s), i.smask ? this.smaskStack.push({ - canvas: yt.canvas, - context: ut, - offsetX: b, - offsetY: M, - scaleX: Q, - scaleY: nt, - subtype: i.smask.subtype, - backdrop: i.smask.backdrop, - transferMap: i.smask.transferMap || null, - startTransformInverse: null - }) : (n.setTransform(1, 0, 0, 1, 0, 0), n.translate(b, M), n.scale(Q, nt), n.save()), a(n, ut), this.ctx = ut, this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]), this.groupStack.push(n), this.groupLevel++; - } - endGroup(i) { - if (!this.contentVisible) - return; - this.groupLevel--; - const n = this.ctx, s = this.groupStack.pop(); - if (this.ctx = s, this.ctx.imageSmoothingEnabled = !1, i.smask) - this.tempSMask = this.smaskStack.pop(), this.restore(); - else { - this.ctx.restore(); - const o = (0, P.getCurrentTransform)(this.ctx); - this.restore(), this.ctx.save(), this.ctx.setTransform(...o); - const h = l.Util.getAxialAlignedBoundingBox([0, 0, n.canvas.width, n.canvas.height], o); - this.ctx.drawImage(n.canvas, 0, 0), this.ctx.restore(), this.compose(h); - } - } - beginAnnotation(i, n, s, o, h) { - if (W(this, H, Qe).call(this), c(this.ctx), this.ctx.save(), this.save(), this.baseTransform && this.ctx.setTransform(...this.baseTransform), Array.isArray(n) && n.length === 4) { - const b = n[2] - n[0], M = n[3] - n[1]; - if (h && this.annotationCanvasMap) { - s = s.slice(), s[4] -= n[0], s[5] -= n[1], n = n.slice(), n[0] = n[1] = 0, n[2] = b, n[3] = M; - const [N, tt] = l.Util.singularValueDecompose2dScale((0, P.getCurrentTransform)(this.ctx)), { - viewportScale: Q - } = this, nt = Math.ceil(b * this.outputScaleX * Q), ct = Math.ceil(M * this.outputScaleY * Q); - this.annotationCanvas = this.canvasFactory.create(nt, ct); - const { - canvas: yt, - context: ut - } = this.annotationCanvas; - this.annotationCanvasMap.set(i, yt), this.annotationCanvas.savedCtx = this.ctx, this.ctx = ut, this.ctx.save(), this.ctx.setTransform(N, 0, 0, -tt, 0, M * tt), c(this.ctx); - } else - c(this.ctx), this.ctx.rect(n[0], n[1], b, M), this.ctx.clip(), this.endPath(); - } - this.current = new w(this.ctx.canvas.width, this.ctx.canvas.height), this.transform(...s), this.transform(...o); - } - endAnnotation() { - this.annotationCanvas && (this.ctx.restore(), W(this, gt, Ze).call(this), this.ctx = this.annotationCanvas.savedCtx, delete this.annotationCanvas.savedCtx, delete this.annotationCanvas); - } - paintImageMaskXObject(i) { - if (!this.contentVisible) - return; - const n = i.count; - i = this.getObject(i.data, i), i.count = n; - const s = this.ctx, o = this.processingType3; - if (o && (o.compiled === void 0 && (o.compiled = _(i)), o.compiled)) { - o.compiled(s); - return; - } - const h = this._createMaskCanvas(i), b = h.canvas; - s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.drawImage(b, h.offsetX, h.offsetY), s.restore(), this.compose(); - } - paintImageMaskXObjectRepeat(i, n, s = 0, o = 0, h, b) { - if (!this.contentVisible) - return; - i = this.getObject(i.data, i); - const M = this.ctx; - M.save(); - const N = (0, P.getCurrentTransform)(M); - M.transform(n, s, o, h, 0, 0); - const tt = this._createMaskCanvas(i); - M.setTransform(1, 0, 0, 1, tt.offsetX - N[4], tt.offsetY - N[5]); - for (let Q = 0, nt = b.length; Q < nt; Q += 2) { - const ct = l.Util.transform(N, [n, s, o, h, b[Q], b[Q + 1]]), [yt, ut] = l.Util.applyTransform([0, 0], ct); - M.drawImage(tt.canvas, yt, ut); - } - M.restore(), this.compose(); - } - paintImageMaskXObjectGroup(i) { - if (!this.contentVisible) - return; - const n = this.ctx, s = this.current.fillColor, o = this.current.patternFill; - for (const h of i) { - const { - data: b, - width: M, - height: N, - transform: tt - } = h, Q = this.cachedCanvases.getCanvas("maskCanvas", M, N), nt = Q.context; - nt.save(); - const ct = this.getObject(b, h); - y(nt, ct), nt.globalCompositeOperation = "source-in", nt.fillStyle = o ? s.getPattern(nt, this, (0, P.getCurrentTransformInverse)(n), rt.PathType.FILL) : s, nt.fillRect(0, 0, M, N), nt.restore(), n.save(), n.transform(...tt), n.scale(1, -1), u(n, Q.canvas, 0, 0, M, N, 0, -1, 1, 1), n.restore(); - } - this.compose(); - } - paintImageXObject(i) { - if (!this.contentVisible) - return; - const n = this.getObject(i); - if (!n) { - (0, l.warn)("Dependent image isn't ready yet"); - return; - } - this.paintInlineImageXObject(n); - } - paintImageXObjectRepeat(i, n, s, o) { - if (!this.contentVisible) - return; - const h = this.getObject(i); - if (!h) { - (0, l.warn)("Dependent image isn't ready yet"); - return; - } - const b = h.width, M = h.height, N = []; - for (let tt = 0, Q = o.length; tt < Q; tt += 2) - N.push({ - transform: [n, 0, 0, s, o[tt], o[tt + 1]], - x: 0, - y: 0, - w: b, - h: M - }); - this.paintInlineImageXObjectGroup(h, N); - } - applyTransferMapsToCanvas(i) { - return this.current.transferMaps !== "none" && (i.filter = this.current.transferMaps, i.drawImage(i.canvas, 0, 0), i.filter = "none"), i.canvas; - } - applyTransferMapsToBitmap(i) { - if (this.current.transferMaps === "none") - return i.bitmap; - const { - bitmap: n, - width: s, - height: o - } = i, h = this.cachedCanvases.getCanvas("inlineImage", s, o), b = h.context; - return b.filter = this.current.transferMaps, b.drawImage(n, 0, 0), b.filter = "none", h.canvas; - } - paintInlineImageXObject(i) { - if (!this.contentVisible) - return; - const n = i.width, s = i.height, o = this.ctx; - if (this.save(), !l.isNodeJS) { - const { - filter: M - } = o; - M !== "none" && M !== "" && (o.filter = "none"); - } - o.scale(1 / n, -1 / s); - let h; - if (i.bitmap) - h = this.applyTransferMapsToBitmap(i); - else if (typeof HTMLElement == "function" && i instanceof HTMLElement || !i.data) - h = i; - else { - const N = this.cachedCanvases.getCanvas("inlineImage", n, s).context; - C(N, i), h = this.applyTransferMapsToCanvas(N); - } - const b = this._scaleImage(h, (0, P.getCurrentTransformInverse)(o)); - o.imageSmoothingEnabled = U((0, P.getCurrentTransform)(o), i.interpolate), u(o, b.img, 0, 0, b.paintWidth, b.paintHeight, 0, -s, n, s), this.compose(), this.restore(); - } - paintInlineImageXObjectGroup(i, n) { - if (!this.contentVisible) - return; - const s = this.ctx; - let o; - if (i.bitmap) - o = i.bitmap; - else { - const h = i.width, b = i.height, N = this.cachedCanvases.getCanvas("inlineImage", h, b).context; - C(N, i), o = this.applyTransferMapsToCanvas(N); - } - for (const h of n) - s.save(), s.transform(...h.transform), s.scale(1, -1), u(s, o, h.x, h.y, h.w, h.h, 0, -1, 1, 1), s.restore(); - this.compose(); - } - paintSolidColorImageMask() { - this.contentVisible && (this.ctx.fillRect(0, 0, 1, 1), this.compose()); - } - markPoint(i) { - } - markPointProps(i, n) { - } - beginMarkedContent(i) { - this.markedContentStack.push({ - visible: !0 - }); - } - beginMarkedContentProps(i, n) { - i === "OC" ? this.markedContentStack.push({ - visible: this.optionalContentConfig.isVisible(n) - }) : this.markedContentStack.push({ - visible: !0 - }), this.contentVisible = this.isContentVisible(); - } - endMarkedContent() { - this.markedContentStack.pop(), this.contentVisible = this.isContentVisible(); - } - beginCompat() { - } - endCompat() { - } - consumePath(i) { - const n = this.current.isEmptyClip(); - this.pendingClip && this.current.updateClipFromPath(), this.pendingClip || this.compose(i); - const s = this.ctx; - this.pendingClip && (n || (this.pendingClip === st ? s.clip("evenodd") : s.clip()), this.pendingClip = null), this.current.startNewPathAndClipBox(this.current.clipBox), s.beginPath(); - } - getSinglePixelWidth() { - if (!this._cachedGetSinglePixelWidth) { - const i = (0, P.getCurrentTransform)(this.ctx); - if (i[1] === 0 && i[2] === 0) - this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(i[0]), Math.abs(i[3])); - else { - const n = Math.abs(i[0] * i[3] - i[2] * i[1]), s = Math.hypot(i[0], i[2]), o = Math.hypot(i[1], i[3]); - this._cachedGetSinglePixelWidth = Math.max(s, o) / n; - } - } - return this._cachedGetSinglePixelWidth; - } - getScaleForStroking() { - if (this._cachedScaleForStroking[0] === -1) { - const { - lineWidth: i - } = this.current, { - a: n, - b: s, - c: o, - d: h - } = this.ctx.getTransform(); - let b, M; - if (s === 0 && o === 0) { - const N = Math.abs(n), tt = Math.abs(h); - if (N === tt) - if (i === 0) - b = M = 1 / N; - else { - const Q = N * i; - b = M = Q < 1 ? 1 / Q : 1; - } - else if (i === 0) - b = 1 / N, M = 1 / tt; - else { - const Q = N * i, nt = tt * i; - b = Q < 1 ? 1 / Q : 1, M = nt < 1 ? 1 / nt : 1; - } - } else { - const N = Math.abs(n * h - s * o), tt = Math.hypot(n, s), Q = Math.hypot(o, h); - if (i === 0) - b = Q / N, M = tt / N; - else { - const nt = i * N; - b = Q > nt ? Q / nt : 1, M = tt > nt ? tt / nt : 1; - } - } - this._cachedScaleForStroking[0] = b, this._cachedScaleForStroking[1] = M; - } - return this._cachedScaleForStroking; - } - rescaleAndStroke(i) { - const { - ctx: n - } = this, { - lineWidth: s - } = this.current, [o, h] = this.getScaleForStroking(); - if (n.lineWidth = s || 1, o === 1 && h === 1) { - n.stroke(); - return; - } - const b = n.getLineDash(); - if (i && n.save(), n.scale(o, h), b.length > 0) { - const M = Math.max(o, h); - n.setLineDash(b.map((N) => N / M)), n.lineDashOffset /= M; - } - n.stroke(), i && n.restore(); - } - isContentVisible() { - for (let i = this.markedContentStack.length - 1; i >= 0; i--) - if (!this.markedContentStack[i].visible) - return !1; - return !0; - } - }; - H = new WeakSet(), Qe = function() { - for (; this.stateStack.length || this.inSMaskMode; ) - this.restore(); - this.ctx.restore(), this.transparentCanvas && (this.ctx = this.compositeCtx, this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.drawImage(this.transparentCanvas, 0, 0), this.ctx.restore(), this.transparentCanvas = null); - }, gt = new WeakSet(), Ze = function() { - if (this.pageColors) { - const i = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background); - if (i !== "none") { - const n = this.ctx.filter; - this.ctx.filter = i, this.ctx.drawImage(this.ctx.canvas, 0, 0), this.ctx.filter = n; - } - } - }; - let at = xt; - d.CanvasGraphics = at; - for (const S in l.OPS) - at.prototype[S] !== void 0 && (at.prototype[l.OPS[S]] = at.prototype[S]); - }, - /* 12 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.TilingPattern = d.PathType = void 0, d.getShadingPattern = x; - var l = et(1), P = et(6); - const rt = { - FILL: "Fill", - STROKE: "Stroke", - SHADING: "Shading" - }; - d.PathType = rt; - function X(_, w) { - if (!w) - return; - const C = w[2] - w[0], y = w[3] - w[1], a = new Path2D(); - a.rect(w[0], w[1], C, y), _.clip(a); - } - class pt { - constructor() { - this.constructor === pt && (0, l.unreachable)("Cannot initialize BaseShadingPattern."); - } - getPattern() { - (0, l.unreachable)("Abstract method `getPattern` called."); - } - } - class B extends pt { - constructor(w) { - super(), this._type = w[1], this._bbox = w[2], this._colorStops = w[3], this._p0 = w[4], this._p1 = w[5], this._r0 = w[6], this._r1 = w[7], this.matrix = null; - } - _createGradient(w) { - let C; - this._type === "axial" ? C = w.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]) : this._type === "radial" && (C = w.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1)); - for (const y of this._colorStops) - C.addColorStop(y[0], y[1]); - return C; - } - getPattern(w, C, y, a) { - let c; - if (a === rt.STROKE || a === rt.FILL) { - const k = C.current.getClippedPathBoundingBox(a, (0, P.getCurrentTransform)(w)) || [0, 0, 0, 0], p = Math.ceil(k[2] - k[0]) || 1, r = Math.ceil(k[3] - k[1]) || 1, T = C.cachedCanvases.getCanvas("pattern", p, r, !0), m = T.context; - m.clearRect(0, 0, m.canvas.width, m.canvas.height), m.beginPath(), m.rect(0, 0, m.canvas.width, m.canvas.height), m.translate(-k[0], -k[1]), y = l.Util.transform(y, [1, 0, 0, 1, k[0], k[1]]), m.transform(...C.baseTransform), this.matrix && m.transform(...this.matrix), X(m, this._bbox), m.fillStyle = this._createGradient(m), m.fill(), c = w.createPattern(T.canvas, "no-repeat"); - const U = new DOMMatrix(y); - c.setTransform(U); - } else - X(w, this._bbox), c = this._createGradient(w); - return c; - } - } - function F(_, w, C, y, a, c, k, p) { - const r = w.coords, T = w.colors, m = _.data, U = _.width * 4; - let z; - r[C + 1] > r[y + 1] && (z = C, C = y, y = z, z = c, c = k, k = z), r[y + 1] > r[a + 1] && (z = y, y = a, a = z, z = k, k = p, p = z), r[C + 1] > r[y + 1] && (z = C, C = y, y = z, z = c, c = k, k = z); - const E = (r[C] + w.offsetX) * w.scaleX, V = (r[C + 1] + w.offsetY) * w.scaleY, st = (r[y] + w.offsetX) * w.scaleX, at = (r[y + 1] + w.offsetY) * w.scaleY, H = (r[a] + w.offsetX) * w.scaleX, lt = (r[a + 1] + w.offsetY) * w.scaleY; - if (V >= lt) - return; - const gt = T[c], wt = T[c + 1], xt = T[c + 2], S = T[k], i = T[k + 1], n = T[k + 2], s = T[p], o = T[p + 1], h = T[p + 2], b = Math.round(V), M = Math.round(lt); - let N, tt, Q, nt, ct, yt, ut, Ft; - for (let Bt = b; Bt <= M; Bt++) { - if (Bt < at) { - const J = Bt < V ? 0 : (V - Bt) / (V - at); - N = E - (E - st) * J, tt = gt - (gt - S) * J, Q = wt - (wt - i) * J, nt = xt - (xt - n) * J; - } else { - let J; - Bt > lt ? J = 1 : at === lt ? J = 0 : J = (at - Bt) / (at - lt), N = st - (st - H) * J, tt = S - (S - s) * J, Q = i - (i - o) * J, nt = n - (n - h) * J; - } - let St; - Bt < V ? St = 0 : Bt > lt ? St = 1 : St = (V - Bt) / (V - lt), ct = E - (E - H) * St, yt = gt - (gt - s) * St, ut = wt - (wt - o) * St, Ft = xt - (xt - h) * St; - const Dt = Math.round(Math.min(N, ct)), ft = Math.round(Math.max(N, ct)); - let K = U * Bt + Dt * 4; - for (let J = Dt; J <= ft; J++) - St = (N - J) / (N - ct), St < 0 ? St = 0 : St > 1 && (St = 1), m[K++] = tt - (tt - yt) * St | 0, m[K++] = Q - (Q - ut) * St | 0, m[K++] = nt - (nt - Ft) * St | 0, m[K++] = 255; - } - } - function g(_, w, C) { - const y = w.coords, a = w.colors; - let c, k; - switch (w.type) { - case "lattice": - const p = w.verticesPerRow, r = Math.floor(y.length / p) - 1, T = p - 1; - for (c = 0; c < r; c++) { - let m = c * p; - for (let U = 0; U < T; U++, m++) - F(_, C, y[m], y[m + 1], y[m + p], a[m], a[m + 1], a[m + p]), F(_, C, y[m + p + 1], y[m + 1], y[m + p], a[m + p + 1], a[m + 1], a[m + p]); - } - break; - case "triangles": - for (c = 0, k = y.length; c < k; c += 3) - F(_, C, y[c], y[c + 1], y[c + 2], a[c], a[c + 1], a[c + 2]); - break; - default: - throw new Error("illegal figure"); - } - } - class O extends pt { - constructor(w) { - super(), this._coords = w[2], this._colors = w[3], this._figures = w[4], this._bounds = w[5], this._bbox = w[7], this._background = w[8], this.matrix = null; - } - _createMeshCanvas(w, C, y) { - const p = Math.floor(this._bounds[0]), r = Math.floor(this._bounds[1]), T = Math.ceil(this._bounds[2]) - p, m = Math.ceil(this._bounds[3]) - r, U = Math.min(Math.ceil(Math.abs(T * w[0] * 1.1)), 3e3), z = Math.min(Math.ceil(Math.abs(m * w[1] * 1.1)), 3e3), E = T / U, V = m / z, st = { - coords: this._coords, - colors: this._colors, - offsetX: -p, - offsetY: -r, - scaleX: 1 / E, - scaleY: 1 / V - }, at = U + 2 * 2, H = z + 2 * 2, lt = y.getCanvas("mesh", at, H, !1), gt = lt.context, wt = gt.createImageData(U, z); - if (C) { - const S = wt.data; - for (let i = 0, n = S.length; i < n; i += 4) - S[i] = C[0], S[i + 1] = C[1], S[i + 2] = C[2], S[i + 3] = 255; - } - for (const S of this._figures) - g(wt, S, st); - return gt.putImageData(wt, 2, 2), { - canvas: lt.canvas, - offsetX: p - 2 * E, - offsetY: r - 2 * V, - scaleX: E, - scaleY: V - }; - } - getPattern(w, C, y, a) { - X(w, this._bbox); - let c; - if (a === rt.SHADING) - c = l.Util.singularValueDecompose2dScale((0, P.getCurrentTransform)(w)); - else if (c = l.Util.singularValueDecompose2dScale(C.baseTransform), this.matrix) { - const p = l.Util.singularValueDecompose2dScale(this.matrix); - c = [c[0] * p[0], c[1] * p[1]]; - } - const k = this._createMeshCanvas(c, a === rt.SHADING ? null : this._background, C.cachedCanvases); - return a !== rt.SHADING && (w.setTransform(...C.baseTransform), this.matrix && w.transform(...this.matrix)), w.translate(k.offsetX, k.offsetY), w.scale(k.scaleX, k.scaleY), w.createPattern(k.canvas, "no-repeat"); - } - } - class I extends pt { - getPattern() { - return "hotpink"; - } - } - function x(_) { - switch (_[0]) { - case "RadialAxial": - return new B(_); - case "Mesh": - return new O(_); - case "Dummy": - return new I(); - } - throw new Error(`Unknown IR type: ${_[0]}`); - } - const v = { - COLORED: 1, - UNCOLORED: 2 - }, u = class u { - constructor(w, C, y, a, c) { - this.operatorList = w[2], this.matrix = w[3] || [1, 0, 0, 1, 0, 0], this.bbox = w[4], this.xstep = w[5], this.ystep = w[6], this.paintType = w[7], this.tilingType = w[8], this.color = C, this.ctx = y, this.canvasGraphicsFactory = a, this.baseTransform = c; - } - createPatternCanvas(w) { - const C = this.operatorList, y = this.bbox, a = this.xstep, c = this.ystep, k = this.paintType, p = this.tilingType, r = this.color, T = this.canvasGraphicsFactory; - (0, l.info)("TilingType: " + p); - const m = y[0], U = y[1], z = y[2], E = y[3], V = l.Util.singularValueDecompose2dScale(this.matrix), st = l.Util.singularValueDecompose2dScale(this.baseTransform), at = [V[0] * st[0], V[1] * st[1]], H = this.getSizeAndScale(a, this.ctx.canvas.width, at[0]), lt = this.getSizeAndScale(c, this.ctx.canvas.height, at[1]), gt = w.cachedCanvases.getCanvas("pattern", H.size, lt.size, !0), wt = gt.context, xt = T.createCanvasGraphics(wt); - xt.groupLevel = w.groupLevel, this.setFillAndStrokeStyleToContext(xt, k, r); - let S = m, i = U, n = z, s = E; - return m < 0 && (S = 0, n += Math.abs(m)), U < 0 && (i = 0, s += Math.abs(U)), wt.translate(-(H.scale * S), -(lt.scale * i)), xt.transform(H.scale, 0, 0, lt.scale, 0, 0), wt.save(), this.clipBbox(xt, S, i, n, s), xt.baseTransform = (0, P.getCurrentTransform)(xt.ctx), xt.executeOperatorList(C), xt.endDrawing(), { - canvas: gt.canvas, - scaleX: H.scale, - scaleY: lt.scale, - offsetX: S, - offsetY: i - }; - } - getSizeAndScale(w, C, y) { - w = Math.abs(w); - const a = Math.max(u.MAX_PATTERN_SIZE, C); - let c = Math.ceil(w * y); - return c >= a ? c = a : y = c / w, { - scale: y, - size: c - }; - } - clipBbox(w, C, y, a, c) { - const k = a - C, p = c - y; - w.ctx.rect(C, y, k, p), w.current.updateRectMinMax((0, P.getCurrentTransform)(w.ctx), [C, y, a, c]), w.clip(), w.endPath(); - } - setFillAndStrokeStyleToContext(w, C, y) { - const a = w.ctx, c = w.current; - switch (C) { - case v.COLORED: - const k = this.ctx; - a.fillStyle = k.fillStyle, a.strokeStyle = k.strokeStyle, c.fillColor = k.fillStyle, c.strokeColor = k.strokeStyle; - break; - case v.UNCOLORED: - const p = l.Util.makeHexColor(y[0], y[1], y[2]); - a.fillStyle = p, a.strokeStyle = p, c.fillColor = p, c.strokeColor = p; - break; - default: - throw new l.FormatError(`Unsupported paint type: ${C}`); - } - } - getPattern(w, C, y, a) { - let c = y; - a !== rt.SHADING && (c = l.Util.transform(c, C.baseTransform), this.matrix && (c = l.Util.transform(c, this.matrix))); - const k = this.createPatternCanvas(C); - let p = new DOMMatrix(c); - p = p.translate(k.offsetX, k.offsetY), p = p.scale(1 / k.scaleX, 1 / k.scaleY); - const r = w.createPattern(k.canvas, "repeat"); - return r.setTransform(p), r; - } - }; - ee(u, "MAX_PATTERN_SIZE", 3e3); - let A = u; - d.TilingPattern = A; - }, - /* 13 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.convertBlackAndWhiteToRGBA = rt, d.convertToRGBA = P, d.grayToRGBA = pt; - var l = et(1); - function P(B) { - switch (B.kind) { - case l.ImageKind.GRAYSCALE_1BPP: - return rt(B); - case l.ImageKind.RGB_24BPP: - return X(B); - } - return null; - } - function rt({ - src: B, - srcPos: F = 0, - dest: g, - width: O, - height: I, - nonBlackColor: x = 4294967295, - inverseDecode: v = !1 - }) { - const A = l.FeatureTest.isLittleEndian ? 4278190080 : 255, [u, _] = v ? [x, A] : [A, x], w = O >> 3, C = O & 7, y = B.length; - g = new Uint32Array(g.buffer); - let a = 0; - for (let c = 0; c < I; c++) { - for (const p = F + w; F < p; F++) { - const r = F < y ? B[F] : 255; - g[a++] = r & 128 ? _ : u, g[a++] = r & 64 ? _ : u, g[a++] = r & 32 ? _ : u, g[a++] = r & 16 ? _ : u, g[a++] = r & 8 ? _ : u, g[a++] = r & 4 ? _ : u, g[a++] = r & 2 ? _ : u, g[a++] = r & 1 ? _ : u; - } - if (C === 0) - continue; - const k = F < y ? B[F++] : 255; - for (let p = 0; p < C; p++) - g[a++] = k & 1 << 7 - p ? _ : u; - } - return { - srcPos: F, - destPos: a - }; - } - function X({ - src: B, - srcPos: F = 0, - dest: g, - destPos: O = 0, - width: I, - height: x - }) { - let v = 0; - const A = B.length >> 2, u = new Uint32Array(B.buffer, F, A); - if (l.FeatureTest.isLittleEndian) { - for (; v < A - 2; v += 3, O += 4) { - const _ = u[v], w = u[v + 1], C = u[v + 2]; - g[O] = _ | 4278190080, g[O + 1] = _ >>> 24 | w << 8 | 4278190080, g[O + 2] = w >>> 16 | C << 16 | 4278190080, g[O + 3] = C >>> 8 | 4278190080; - } - for (let _ = v * 4, w = B.length; _ < w; _ += 3) - g[O++] = B[_] | B[_ + 1] << 8 | B[_ + 2] << 16 | 4278190080; - } else { - for (; v < A - 2; v += 3, O += 4) { - const _ = u[v], w = u[v + 1], C = u[v + 2]; - g[O] = _ | 255, g[O + 1] = _ << 24 | w >>> 8 | 255, g[O + 2] = w << 16 | C >>> 16 | 255, g[O + 3] = C << 8 | 255; - } - for (let _ = v * 4, w = B.length; _ < w; _ += 3) - g[O++] = B[_] << 24 | B[_ + 1] << 16 | B[_ + 2] << 8 | 255; - } - return { - srcPos: F, - destPos: O - }; - } - function pt(B, F) { - if (l.FeatureTest.isLittleEndian) - for (let g = 0, O = B.length; g < O; g++) - F[g] = B[g] * 65793 | 4278190080; - else - for (let g = 0, O = B.length; g < O; g++) - F[g] = B[g] * 16843008 | 255; - } - }, - /* 14 */ - /***/ - (dt, d) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.GlobalWorkerOptions = void 0; - const et = /* @__PURE__ */ Object.create(null); - d.GlobalWorkerOptions = et, et.workerPort = null, et.workerSrc = ""; - }, - /* 15 */ - /***/ - (dt, d, et) => { - var B, xi, g, ki, I, xe; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.MessageHandler = void 0; - var l = et(1); - const P = { - UNKNOWN: 0, - DATA: 1, - ERROR: 2 - }, rt = { - UNKNOWN: 0, - CANCEL: 1, - CANCEL_COMPLETE: 2, - CLOSE: 3, - ENQUEUE: 4, - ERROR: 5, - PULL: 6, - PULL_COMPLETE: 7, - START_COMPLETE: 8 - }; - function X(v) { - switch (v instanceof Error || typeof v == "object" && v !== null || (0, l.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'), v.name) { - case "AbortException": - return new l.AbortException(v.message); - case "MissingPDFException": - return new l.MissingPDFException(v.message); - case "PasswordException": - return new l.PasswordException(v.message, v.code); - case "UnexpectedResponseException": - return new l.UnexpectedResponseException(v.message, v.status); - case "UnknownErrorException": - return new l.UnknownErrorException(v.message, v.details); - default: - return new l.UnknownErrorException(v.message, v.toString()); - } - } - class pt { - constructor(A, u, _) { - L(this, B); - L(this, g); - L(this, I); - this.sourceName = A, this.targetName = u, this.comObj = _, this.callbackId = 1, this.streamId = 1, this.streamSinks = /* @__PURE__ */ Object.create(null), this.streamControllers = /* @__PURE__ */ Object.create(null), this.callbackCapabilities = /* @__PURE__ */ Object.create(null), this.actionHandler = /* @__PURE__ */ Object.create(null), this._onComObjOnMessage = (w) => { - const C = w.data; - if (C.targetName !== this.sourceName) - return; - if (C.stream) { - W(this, g, ki).call(this, C); - return; - } - if (C.callback) { - const a = C.callbackId, c = this.callbackCapabilities[a]; - if (!c) - throw new Error(`Cannot resolve callback ${a}`); - if (delete this.callbackCapabilities[a], C.callback === P.DATA) - c.resolve(C.data); - else if (C.callback === P.ERROR) - c.reject(X(C.reason)); - else - throw new Error("Unexpected callback case"); - return; - } - const y = this.actionHandler[C.action]; - if (!y) - throw new Error(`Unknown action from worker: ${C.action}`); - if (C.callbackId) { - const a = this.sourceName, c = C.sourceName; - new Promise(function(k) { - k(y(C.data)); - }).then(function(k) { - _.postMessage({ - sourceName: a, - targetName: c, - callback: P.DATA, - callbackId: C.callbackId, - data: k - }); - }, function(k) { - _.postMessage({ - sourceName: a, - targetName: c, - callback: P.ERROR, - callbackId: C.callbackId, - reason: X(k) - }); - }); - return; - } - if (C.streamId) { - W(this, B, xi).call(this, C); - return; - } - y(C.data); - }, _.addEventListener("message", this._onComObjOnMessage); - } - on(A, u) { - const _ = this.actionHandler; - if (_[A]) - throw new Error(`There is already an actionName called "${A}"`); - _[A] = u; - } - send(A, u, _) { - this.comObj.postMessage({ - sourceName: this.sourceName, - targetName: this.targetName, - action: A, - data: u - }, _); - } - sendWithPromise(A, u, _) { - const w = this.callbackId++, C = new l.PromiseCapability(); - this.callbackCapabilities[w] = C; - try { - this.comObj.postMessage({ - sourceName: this.sourceName, - targetName: this.targetName, - action: A, - callbackId: w, - data: u - }, _); - } catch (y) { - C.reject(y); - } - return C.promise; - } - sendWithStream(A, u, _, w) { - const C = this.streamId++, y = this.sourceName, a = this.targetName, c = this.comObj; - return new ReadableStream({ - start: (k) => { - const p = new l.PromiseCapability(); - return this.streamControllers[C] = { - controller: k, - startCall: p, - pullCall: null, - cancelCall: null, - isClosed: !1 - }, c.postMessage({ - sourceName: y, - targetName: a, - action: A, - streamId: C, - data: u, - desiredSize: k.desiredSize - }, w), p.promise; - }, - pull: (k) => { - const p = new l.PromiseCapability(); - return this.streamControllers[C].pullCall = p, c.postMessage({ - sourceName: y, - targetName: a, - stream: rt.PULL, - streamId: C, - desiredSize: k.desiredSize - }), p.promise; - }, - cancel: (k) => { - (0, l.assert)(k instanceof Error, "cancel must have a valid reason"); - const p = new l.PromiseCapability(); - return this.streamControllers[C].cancelCall = p, this.streamControllers[C].isClosed = !0, c.postMessage({ - sourceName: y, - targetName: a, - stream: rt.CANCEL, - streamId: C, - reason: X(k) - }), p.promise; - } - }, _); - } - destroy() { - this.comObj.removeEventListener("message", this._onComObjOnMessage); - } - } - B = new WeakSet(), xi = function(A) { - const u = A.streamId, _ = this.sourceName, w = A.sourceName, C = this.comObj, y = this, a = this.actionHandler[A.action], c = { - enqueue(k, p = 1, r) { - if (this.isCancelled) - return; - const T = this.desiredSize; - this.desiredSize -= p, T > 0 && this.desiredSize <= 0 && (this.sinkCapability = new l.PromiseCapability(), this.ready = this.sinkCapability.promise), C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.ENQUEUE, - streamId: u, - chunk: k - }, r); - }, - close() { - this.isCancelled || (this.isCancelled = !0, C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.CLOSE, - streamId: u - }), delete y.streamSinks[u]); - }, - error(k) { - (0, l.assert)(k instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.ERROR, - streamId: u, - reason: X(k) - })); - }, - sinkCapability: new l.PromiseCapability(), - onPull: null, - onCancel: null, - isCancelled: !1, - desiredSize: A.desiredSize, - ready: null - }; - c.sinkCapability.resolve(), c.ready = c.sinkCapability.promise, this.streamSinks[u] = c, new Promise(function(k) { - k(a(A.data, c)); - }).then(function() { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.START_COMPLETE, - streamId: u, - success: !0 - }); - }, function(k) { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.START_COMPLETE, - streamId: u, - reason: X(k) - }); - }); - }, g = new WeakSet(), ki = function(A) { - const u = A.streamId, _ = this.sourceName, w = A.sourceName, C = this.comObj, y = this.streamControllers[u], a = this.streamSinks[u]; - switch (A.stream) { - case rt.START_COMPLETE: - A.success ? y.startCall.resolve() : y.startCall.reject(X(A.reason)); - break; - case rt.PULL_COMPLETE: - A.success ? y.pullCall.resolve() : y.pullCall.reject(X(A.reason)); - break; - case rt.PULL: - if (!a) { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.PULL_COMPLETE, - streamId: u, - success: !0 - }); - break; - } - a.desiredSize <= 0 && A.desiredSize > 0 && a.sinkCapability.resolve(), a.desiredSize = A.desiredSize, new Promise(function(c) { - var k; - c((k = a.onPull) == null ? void 0 : k.call(a)); - }).then(function() { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.PULL_COMPLETE, - streamId: u, - success: !0 - }); - }, function(c) { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.PULL_COMPLETE, - streamId: u, - reason: X(c) - }); - }); - break; - case rt.ENQUEUE: - if ((0, l.assert)(y, "enqueue should have stream controller"), y.isClosed) - break; - y.controller.enqueue(A.chunk); - break; - case rt.CLOSE: - if ((0, l.assert)(y, "close should have stream controller"), y.isClosed) - break; - y.isClosed = !0, y.controller.close(), W(this, I, xe).call(this, y, u); - break; - case rt.ERROR: - (0, l.assert)(y, "error should have stream controller"), y.controller.error(X(A.reason)), W(this, I, xe).call(this, y, u); - break; - case rt.CANCEL_COMPLETE: - A.success ? y.cancelCall.resolve() : y.cancelCall.reject(X(A.reason)), W(this, I, xe).call(this, y, u); - break; - case rt.CANCEL: - if (!a) - break; - new Promise(function(c) { - var k; - c((k = a.onCancel) == null ? void 0 : k.call(a, X(A.reason))); - }).then(function() { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.CANCEL_COMPLETE, - streamId: u, - success: !0 - }); - }, function(c) { - C.postMessage({ - sourceName: _, - targetName: w, - stream: rt.CANCEL_COMPLETE, - streamId: u, - reason: X(c) - }); - }), a.sinkCapability.reject(X(A.reason)), a.isCancelled = !0, delete this.streamSinks[u]; - break; - default: - throw new Error("Unexpected stream case"); - } - }, I = new WeakSet(), xe = async function(A, u) { - var _, w, C; - await Promise.allSettled([(_ = A.startCall) == null ? void 0 : _.promise, (w = A.pullCall) == null ? void 0 : w.promise, (C = A.cancelCall) == null ? void 0 : C.promise]), delete this.streamControllers[u]; - }, d.MessageHandler = pt; - }, - /* 16 */ - /***/ - (dt, d, et) => { - var rt, X; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.Metadata = void 0; - var l = et(1); - class P { - constructor({ - parsedData: B, - rawData: F - }) { - L(this, rt, void 0); - L(this, X, void 0); - Z(this, rt, B), Z(this, X, F); - } - getRaw() { - return t(this, X); - } - get(B) { - return t(this, rt).get(B) ?? null; - } - getAll() { - return (0, l.objectFromMap)(t(this, rt)); - } - has(B) { - return t(this, rt).has(B); - } - } - rt = new WeakMap(), X = new WeakMap(), d.Metadata = P; - }, - /* 17 */ - /***/ - (dt, d, et) => { - var B, F, g, O, I, x, ti; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.OptionalContentConfig = void 0; - var l = et(1), P = et(8); - const rt = Symbol("INTERNAL"); - class X { - constructor(u, _) { - L(this, B, !0); - this.name = u, this.intent = _; - } - get visible() { - return t(this, B); - } - _setVisible(u, _) { - u !== rt && (0, l.unreachable)("Internal method `_setVisible` called."), Z(this, B, _); - } - } - B = new WeakMap(); - class pt { - constructor(u) { - L(this, x); - L(this, F, null); - L(this, g, /* @__PURE__ */ new Map()); - L(this, O, null); - L(this, I, null); - if (this.name = null, this.creator = null, u !== null) { - this.name = u.name, this.creator = u.creator, Z(this, I, u.order); - for (const _ of u.groups) - t(this, g).set(_.id, new X(_.name, _.intent)); - if (u.baseState === "OFF") - for (const _ of t(this, g).values()) - _._setVisible(rt, !1); - for (const _ of u.on) - t(this, g).get(_)._setVisible(rt, !0); - for (const _ of u.off) - t(this, g).get(_)._setVisible(rt, !1); - Z(this, O, this.getHash()); - } - } - isVisible(u) { - if (t(this, g).size === 0) - return !0; - if (!u) - return (0, l.warn)("Optional content group not defined."), !0; - if (u.type === "OCG") - return t(this, g).has(u.id) ? t(this, g).get(u.id).visible : ((0, l.warn)(`Optional content group not found: ${u.id}`), !0); - if (u.type === "OCMD") { - if (u.expression) - return W(this, x, ti).call(this, u.expression); - if (!u.policy || u.policy === "AnyOn") { - for (const _ of u.ids) { - if (!t(this, g).has(_)) - return (0, l.warn)(`Optional content group not found: ${_}`), !0; - if (t(this, g).get(_).visible) - return !0; - } - return !1; - } else if (u.policy === "AllOn") { - for (const _ of u.ids) { - if (!t(this, g).has(_)) - return (0, l.warn)(`Optional content group not found: ${_}`), !0; - if (!t(this, g).get(_).visible) - return !1; - } - return !0; - } else if (u.policy === "AnyOff") { - for (const _ of u.ids) { - if (!t(this, g).has(_)) - return (0, l.warn)(`Optional content group not found: ${_}`), !0; - if (!t(this, g).get(_).visible) - return !0; - } - return !1; - } else if (u.policy === "AllOff") { - for (const _ of u.ids) { - if (!t(this, g).has(_)) - return (0, l.warn)(`Optional content group not found: ${_}`), !0; - if (t(this, g).get(_).visible) - return !1; - } - return !0; - } - return (0, l.warn)(`Unknown optional content policy ${u.policy}.`), !0; - } - return (0, l.warn)(`Unknown group type ${u.type}.`), !0; - } - setVisibility(u, _ = !0) { - if (!t(this, g).has(u)) { - (0, l.warn)(`Optional content group not found: ${u}`); - return; - } - t(this, g).get(u)._setVisible(rt, !!_), Z(this, F, null); - } - get hasInitialVisibility() { - return t(this, O) === null || this.getHash() === t(this, O); - } - getOrder() { - return t(this, g).size ? t(this, I) ? t(this, I).slice() : [...t(this, g).keys()] : null; - } - getGroups() { - return t(this, g).size > 0 ? (0, l.objectFromMap)(t(this, g)) : null; - } - getGroup(u) { - return t(this, g).get(u) || null; - } - getHash() { - if (t(this, F) !== null) - return t(this, F); - const u = new P.MurmurHash3_64(); - for (const [_, w] of t(this, g)) - u.update(`${_}:${w.visible}`); - return Z(this, F, u.hexdigest()); - } - } - F = new WeakMap(), g = new WeakMap(), O = new WeakMap(), I = new WeakMap(), x = new WeakSet(), ti = function(u) { - const _ = u.length; - if (_ < 2) - return !0; - const w = u[0]; - for (let C = 1; C < _; C++) { - const y = u[C]; - let a; - if (Array.isArray(y)) - a = W(this, x, ti).call(this, y); - else if (t(this, g).has(y)) - a = t(this, g).get(y).visible; - else - return (0, l.warn)(`Optional content group not found: ${y}`), !0; - switch (w) { - case "And": - if (!a) - return !1; - break; - case "Or": - if (a) - return !0; - break; - case "Not": - return !a; - default: - return !0; - } - } - return w === "And"; - }, d.OptionalContentConfig = pt; - }, - /* 18 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.PDFDataTransportStream = void 0; - var l = et(1), P = et(6); - class rt { - constructor({ - length: F, - initialData: g, - progressiveDone: O = !1, - contentDispositionFilename: I = null, - disableRange: x = !1, - disableStream: v = !1 - }, A) { - if ((0, l.assert)(A, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'), this._queuedChunks = [], this._progressiveDone = O, this._contentDispositionFilename = I, (g == null ? void 0 : g.length) > 0) { - const u = g instanceof Uint8Array && g.byteLength === g.buffer.byteLength ? g.buffer : new Uint8Array(g).buffer; - this._queuedChunks.push(u); - } - this._pdfDataRangeTransport = A, this._isStreamingSupported = !v, this._isRangeSupported = !x, this._contentLength = F, this._fullRequestReader = null, this._rangeReaders = [], this._pdfDataRangeTransport.addRangeListener((u, _) => { - this._onReceiveData({ - begin: u, - chunk: _ - }); - }), this._pdfDataRangeTransport.addProgressListener((u, _) => { - this._onProgress({ - loaded: u, - total: _ - }); - }), this._pdfDataRangeTransport.addProgressiveReadListener((u) => { - this._onReceiveData({ - chunk: u - }); - }), this._pdfDataRangeTransport.addProgressiveDoneListener(() => { - this._onProgressiveDone(); - }), this._pdfDataRangeTransport.transportReady(); - } - _onReceiveData({ - begin: F, - chunk: g - }) { - const O = g instanceof Uint8Array && g.byteLength === g.buffer.byteLength ? g.buffer : new Uint8Array(g).buffer; - if (F === void 0) - this._fullRequestReader ? this._fullRequestReader._enqueue(O) : this._queuedChunks.push(O); - else { - const I = this._rangeReaders.some(function(x) { - return x._begin !== F ? !1 : (x._enqueue(O), !0); - }); - (0, l.assert)(I, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."); - } - } - get _progressiveDataLength() { - var F; - return ((F = this._fullRequestReader) == null ? void 0 : F._loaded) ?? 0; - } - _onProgress(F) { - var g, O, I, x; - F.total === void 0 ? (O = (g = this._rangeReaders[0]) == null ? void 0 : g.onProgress) == null || O.call(g, { - loaded: F.loaded - }) : (x = (I = this._fullRequestReader) == null ? void 0 : I.onProgress) == null || x.call(I, { - loaded: F.loaded, - total: F.total - }); - } - _onProgressiveDone() { - var F; - (F = this._fullRequestReader) == null || F.progressiveDone(), this._progressiveDone = !0; - } - _removeRangeReader(F) { - const g = this._rangeReaders.indexOf(F); - g >= 0 && this._rangeReaders.splice(g, 1); - } - getFullReader() { - (0, l.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once."); - const F = this._queuedChunks; - return this._queuedChunks = null, new X(this, F, this._progressiveDone, this._contentDispositionFilename); - } - getRangeReader(F, g) { - if (g <= this._progressiveDataLength) - return null; - const O = new pt(this, F, g); - return this._pdfDataRangeTransport.requestDataRange(F, g), this._rangeReaders.push(O), O; - } - cancelAllRequests(F) { - var g; - (g = this._fullRequestReader) == null || g.cancel(F); - for (const O of this._rangeReaders.slice(0)) - O.cancel(F); - this._pdfDataRangeTransport.abort(); - } - } - d.PDFDataTransportStream = rt; - class X { - constructor(F, g, O = !1, I = null) { - this._stream = F, this._done = O || !1, this._filename = (0, P.isPdfFile)(I) ? I : null, this._queuedChunks = g || [], this._loaded = 0; - for (const x of this._queuedChunks) - this._loaded += x.byteLength; - this._requests = [], this._headersReady = Promise.resolve(), F._fullRequestReader = this, this.onProgress = null; - } - _enqueue(F) { - this._done || (this._requests.length > 0 ? this._requests.shift().resolve({ - value: F, - done: !1 - }) : this._queuedChunks.push(F), this._loaded += F.byteLength); - } - get headersReady() { - return this._headersReady; - } - get filename() { - return this._filename; - } - get isRangeSupported() { - return this._stream._isRangeSupported; - } - get isStreamingSupported() { - return this._stream._isStreamingSupported; - } - get contentLength() { - return this._stream._contentLength; - } - async read() { - if (this._queuedChunks.length > 0) - return { - value: this._queuedChunks.shift(), - done: !1 - }; - if (this._done) - return { - value: void 0, - done: !0 - }; - const F = new l.PromiseCapability(); - return this._requests.push(F), F.promise; - } - cancel(F) { - this._done = !0; - for (const g of this._requests) - g.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0; - } - progressiveDone() { - this._done || (this._done = !0); - } - } - class pt { - constructor(F, g, O) { - this._stream = F, this._begin = g, this._end = O, this._queuedChunk = null, this._requests = [], this._done = !1, this.onProgress = null; - } - _enqueue(F) { - if (!this._done) { - if (this._requests.length === 0) - this._queuedChunk = F; - else { - this._requests.shift().resolve({ - value: F, - done: !1 - }); - for (const O of this._requests) - O.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0; - } - this._done = !0, this._stream._removeRangeReader(this); - } - } - get isStreamingSupported() { - return !1; - } - async read() { - if (this._queuedChunk) { - const g = this._queuedChunk; - return this._queuedChunk = null, { - value: g, - done: !1 - }; - } - if (this._done) - return { - value: void 0, - done: !0 - }; - const F = new l.PromiseCapability(); - return this._requests.push(F), F.promise; - } - cancel(F) { - this._done = !0; - for (const g of this._requests) - g.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0, this._stream._removeRangeReader(this); - } - } - }, - /* 19 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.PDFFetchStream = void 0; - var l = et(1), P = et(20); - function rt(O, I, x) { - return { - method: "GET", - headers: O, - signal: x.signal, - mode: "cors", - credentials: I ? "include" : "same-origin", - redirect: "follow" - }; - } - function X(O) { - const I = new Headers(); - for (const x in O) { - const v = O[x]; - v !== void 0 && I.append(x, v); - } - return I; - } - function pt(O) { - return O instanceof Uint8Array ? O.buffer : O instanceof ArrayBuffer ? O : ((0, l.warn)(`getArrayBuffer - unexpected data format: ${O}`), new Uint8Array(O).buffer); - } - class B { - constructor(I) { - this.source = I, this.isHttp = /^https?:/i.test(I.url), this.httpHeaders = this.isHttp && I.httpHeaders || {}, this._fullRequestReader = null, this._rangeRequestReaders = []; - } - get _progressiveDataLength() { - var I; - return ((I = this._fullRequestReader) == null ? void 0 : I._loaded) ?? 0; - } - getFullReader() { - return (0, l.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new F(this), this._fullRequestReader; - } - getRangeReader(I, x) { - if (x <= this._progressiveDataLength) - return null; - const v = new g(this, I, x); - return this._rangeRequestReaders.push(v), v; - } - cancelAllRequests(I) { - var x; - (x = this._fullRequestReader) == null || x.cancel(I); - for (const v of this._rangeRequestReaders.slice(0)) - v.cancel(I); - } - } - d.PDFFetchStream = B; - class F { - constructor(I) { - this._stream = I, this._reader = null, this._loaded = 0, this._filename = null; - const x = I.source; - this._withCredentials = x.withCredentials || !1, this._contentLength = x.length, this._headersCapability = new l.PromiseCapability(), this._disableRange = x.disableRange || !1, this._rangeChunkSize = x.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._abortController = new AbortController(), this._isStreamingSupported = !x.disableStream, this._isRangeSupported = !x.disableRange, this._headers = X(this._stream.httpHeaders); - const v = x.url; - fetch(v, rt(this._headers, this._withCredentials, this._abortController)).then((A) => { - if (!(0, P.validateResponseStatus)(A.status)) - throw (0, P.createResponseStatusError)(A.status, v); - this._reader = A.body.getReader(), this._headersCapability.resolve(); - const u = (C) => A.headers.get(C), { - allowRangeRequests: _, - suggestedLength: w - } = (0, P.validateRangeRequestCapabilities)({ - getResponseHeader: u, - isHttp: this._stream.isHttp, - rangeChunkSize: this._rangeChunkSize, - disableRange: this._disableRange - }); - this._isRangeSupported = _, this._contentLength = w || this._contentLength, this._filename = (0, P.extractFilenameFromHeader)(u), !this._isStreamingSupported && this._isRangeSupported && this.cancel(new l.AbortException("Streaming is disabled.")); - }).catch(this._headersCapability.reject), this.onProgress = null; - } - get headersReady() { - return this._headersCapability.promise; - } - get filename() { - return this._filename; - } - get contentLength() { - return this._contentLength; - } - get isRangeSupported() { - return this._isRangeSupported; - } - get isStreamingSupported() { - return this._isStreamingSupported; - } - async read() { - var v; - await this._headersCapability.promise; - const { - value: I, - done: x - } = await this._reader.read(); - return x ? { - value: I, - done: x - } : (this._loaded += I.byteLength, (v = this.onProgress) == null || v.call(this, { - loaded: this._loaded, - total: this._contentLength - }), { - value: pt(I), - done: !1 - }); - } - cancel(I) { - var x; - (x = this._reader) == null || x.cancel(I), this._abortController.abort(); - } - } - class g { - constructor(I, x, v) { - this._stream = I, this._reader = null, this._loaded = 0; - const A = I.source; - this._withCredentials = A.withCredentials || !1, this._readCapability = new l.PromiseCapability(), this._isStreamingSupported = !A.disableStream, this._abortController = new AbortController(), this._headers = X(this._stream.httpHeaders), this._headers.append("Range", `bytes=${x}-${v - 1}`); - const u = A.url; - fetch(u, rt(this._headers, this._withCredentials, this._abortController)).then((_) => { - if (!(0, P.validateResponseStatus)(_.status)) - throw (0, P.createResponseStatusError)(_.status, u); - this._readCapability.resolve(), this._reader = _.body.getReader(); - }).catch(this._readCapability.reject), this.onProgress = null; - } - get isStreamingSupported() { - return this._isStreamingSupported; - } - async read() { - var v; - await this._readCapability.promise; - const { - value: I, - done: x - } = await this._reader.read(); - return x ? { - value: I, - done: x - } : (this._loaded += I.byteLength, (v = this.onProgress) == null || v.call(this, { - loaded: this._loaded - }), { - value: pt(I), - done: !1 - }); - } - cancel(I) { - var x; - (x = this._reader) == null || x.cancel(I), this._abortController.abort(); - } - } - }, - /* 20 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.createResponseStatusError = B, d.extractFilenameFromHeader = pt, d.validateRangeRequestCapabilities = X, d.validateResponseStatus = F; - var l = et(1), P = et(21), rt = et(6); - function X({ - getResponseHeader: g, - isHttp: O, - rangeChunkSize: I, - disableRange: x - }) { - const v = { - allowRangeRequests: !1, - suggestedLength: void 0 - }, A = parseInt(g("Content-Length"), 10); - return !Number.isInteger(A) || (v.suggestedLength = A, A <= 2 * I) || x || !O || g("Accept-Ranges") !== "bytes" || (g("Content-Encoding") || "identity") !== "identity" || (v.allowRangeRequests = !0), v; - } - function pt(g) { - const O = g("Content-Disposition"); - if (O) { - let I = (0, P.getFilenameFromContentDispositionHeader)(O); - if (I.includes("%")) - try { - I = decodeURIComponent(I); - } catch { - } - if ((0, rt.isPdfFile)(I)) - return I; - } - return null; - } - function B(g, O) { - return g === 404 || g === 0 && O.startsWith("file:") ? new l.MissingPDFException('Missing PDF "' + O + '".') : new l.UnexpectedResponseException(`Unexpected server response (${g}) while retrieving PDF "${O}".`, g); - } - function F(g) { - return g === 200 || g === 206; - } - }, - /* 21 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.getFilenameFromContentDispositionHeader = P; - var l = et(1); - function P(rt) { - let X = !0, pt = B("filename\\*", "i").exec(rt); - if (pt) { - pt = pt[1]; - let A = I(pt); - return A = unescape(A), A = x(A), A = v(A), g(A); - } - if (pt = O(rt), pt) { - const A = v(pt); - return g(A); - } - if (pt = B("filename", "i").exec(rt), pt) { - pt = pt[1]; - let A = I(pt); - return A = v(A), g(A); - } - function B(A, u) { - return new RegExp("(?:^|;)\\s*" + A + '\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)', u); - } - function F(A, u) { - if (A) { - if (!/^[\x00-\xFF]+$/.test(u)) - return u; - try { - const _ = new TextDecoder(A, { - fatal: !0 - }), w = (0, l.stringToBytes)(u); - u = _.decode(w), X = !1; - } catch { - } - } - return u; - } - function g(A) { - return X && /[\x80-\xff]/.test(A) && (A = F("utf-8", A), X && (A = F("iso-8859-1", A))), A; - } - function O(A) { - const u = []; - let _; - const w = B("filename\\*((?!0\\d)\\d+)(\\*?)", "ig"); - for (; (_ = w.exec(A)) !== null; ) { - let [, y, a, c] = _; - if (y = parseInt(y, 10), y in u) { - if (y === 0) - break; - continue; - } - u[y] = [a, c]; - } - const C = []; - for (let y = 0; y < u.length && y in u; ++y) { - let [a, c] = u[y]; - c = I(c), a && (c = unescape(c), y === 0 && (c = x(c))), C.push(c); - } - return C.join(""); - } - function I(A) { - if (A.startsWith('"')) { - const u = A.slice(1).split('\\"'); - for (let _ = 0; _ < u.length; ++_) { - const w = u[_].indexOf('"'); - w !== -1 && (u[_] = u[_].slice(0, w), u.length = _ + 1), u[_] = u[_].replaceAll(/\\(.)/g, "$1"); - } - A = u.join('"'); - } - return A; - } - function x(A) { - const u = A.indexOf("'"); - if (u === -1) - return A; - const _ = A.slice(0, u), C = A.slice(u + 1).replace(/^[^']*'/, ""); - return F(_, C); - } - function v(A) { - return !A.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(A) ? A : A.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function(u, _, w, C) { - if (w === "q" || w === "Q") - return C = C.replaceAll("_", " "), C = C.replaceAll(/=([0-9a-fA-F]{2})/g, function(y, a) { - return String.fromCharCode(parseInt(a, 16)); - }), F(_, C); - try { - C = atob(C); - } catch { - } - return F(_, C); - }); - } - return ""; - } - }, - /* 22 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.PDFNetworkStream = void 0; - var l = et(1), P = et(20); - const rt = 200, X = 206; - function pt(I) { - const x = I.response; - return typeof x != "string" ? x : (0, l.stringToBytes)(x).buffer; - } - class B { - constructor(x, v = {}) { - this.url = x, this.isHttp = /^https?:/i.test(x), this.httpHeaders = this.isHttp && v.httpHeaders || /* @__PURE__ */ Object.create(null), this.withCredentials = v.withCredentials || !1, this.currXhrId = 0, this.pendingRequests = /* @__PURE__ */ Object.create(null); - } - requestRange(x, v, A) { - const u = { - begin: x, - end: v - }; - for (const _ in A) - u[_] = A[_]; - return this.request(u); - } - requestFull(x) { - return this.request(x); - } - request(x) { - const v = new XMLHttpRequest(), A = this.currXhrId++, u = this.pendingRequests[A] = { - xhr: v - }; - v.open("GET", this.url), v.withCredentials = this.withCredentials; - for (const _ in this.httpHeaders) { - const w = this.httpHeaders[_]; - w !== void 0 && v.setRequestHeader(_, w); - } - return this.isHttp && "begin" in x && "end" in x ? (v.setRequestHeader("Range", `bytes=${x.begin}-${x.end - 1}`), u.expectedStatus = X) : u.expectedStatus = rt, v.responseType = "arraybuffer", x.onError && (v.onerror = function(_) { - x.onError(v.status); - }), v.onreadystatechange = this.onStateChange.bind(this, A), v.onprogress = this.onProgress.bind(this, A), u.onHeadersReceived = x.onHeadersReceived, u.onDone = x.onDone, u.onError = x.onError, u.onProgress = x.onProgress, v.send(null), A; - } - onProgress(x, v) { - var u; - const A = this.pendingRequests[x]; - A && ((u = A.onProgress) == null || u.call(A, v)); - } - onStateChange(x, v) { - var y, a, c; - const A = this.pendingRequests[x]; - if (!A) - return; - const u = A.xhr; - if (u.readyState >= 2 && A.onHeadersReceived && (A.onHeadersReceived(), delete A.onHeadersReceived), u.readyState !== 4 || !(x in this.pendingRequests)) - return; - if (delete this.pendingRequests[x], u.status === 0 && this.isHttp) { - (y = A.onError) == null || y.call(A, u.status); - return; - } - const _ = u.status || rt; - if (!(_ === rt && A.expectedStatus === X) && _ !== A.expectedStatus) { - (a = A.onError) == null || a.call(A, u.status); - return; - } - const C = pt(u); - if (_ === X) { - const k = u.getResponseHeader("Content-Range"), p = /bytes (\d+)-(\d+)\/(\d+)/.exec(k); - A.onDone({ - begin: parseInt(p[1], 10), - chunk: C - }); - } else - C ? A.onDone({ - begin: 0, - chunk: C - }) : (c = A.onError) == null || c.call(A, u.status); - } - getRequestXhr(x) { - return this.pendingRequests[x].xhr; - } - isPendingRequest(x) { - return x in this.pendingRequests; - } - abortRequest(x) { - const v = this.pendingRequests[x].xhr; - delete this.pendingRequests[x], v.abort(); - } - } - class F { - constructor(x) { - this._source = x, this._manager = new B(x.url, { - httpHeaders: x.httpHeaders, - withCredentials: x.withCredentials - }), this._rangeChunkSize = x.rangeChunkSize, this._fullRequestReader = null, this._rangeRequestReaders = []; - } - _onRangeRequestReaderClosed(x) { - const v = this._rangeRequestReaders.indexOf(x); - v >= 0 && this._rangeRequestReaders.splice(v, 1); - } - getFullReader() { - return (0, l.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new g(this._manager, this._source), this._fullRequestReader; - } - getRangeReader(x, v) { - const A = new O(this._manager, x, v); - return A.onClosed = this._onRangeRequestReaderClosed.bind(this), this._rangeRequestReaders.push(A), A; - } - cancelAllRequests(x) { - var v; - (v = this._fullRequestReader) == null || v.cancel(x); - for (const A of this._rangeRequestReaders.slice(0)) - A.cancel(x); - } - } - d.PDFNetworkStream = F; - class g { - constructor(x, v) { - this._manager = x; - const A = { - onHeadersReceived: this._onHeadersReceived.bind(this), - onDone: this._onDone.bind(this), - onError: this._onError.bind(this), - onProgress: this._onProgress.bind(this) - }; - this._url = v.url, this._fullRequestId = x.requestFull(A), this._headersReceivedCapability = new l.PromiseCapability(), this._disableRange = v.disableRange || !1, this._contentLength = v.length, this._rangeChunkSize = v.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._isStreamingSupported = !1, this._isRangeSupported = !1, this._cachedChunks = [], this._requests = [], this._done = !1, this._storedError = void 0, this._filename = null, this.onProgress = null; - } - _onHeadersReceived() { - const x = this._fullRequestId, v = this._manager.getRequestXhr(x), A = (w) => v.getResponseHeader(w), { - allowRangeRequests: u, - suggestedLength: _ - } = (0, P.validateRangeRequestCapabilities)({ - getResponseHeader: A, - isHttp: this._manager.isHttp, - rangeChunkSize: this._rangeChunkSize, - disableRange: this._disableRange - }); - u && (this._isRangeSupported = !0), this._contentLength = _ || this._contentLength, this._filename = (0, P.extractFilenameFromHeader)(A), this._isRangeSupported && this._manager.abortRequest(x), this._headersReceivedCapability.resolve(); - } - _onDone(x) { - if (x && (this._requests.length > 0 ? this._requests.shift().resolve({ - value: x.chunk, - done: !1 - }) : this._cachedChunks.push(x.chunk)), this._done = !0, !(this._cachedChunks.length > 0)) { - for (const v of this._requests) - v.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0; - } - } - _onError(x) { - this._storedError = (0, P.createResponseStatusError)(x, this._url), this._headersReceivedCapability.reject(this._storedError); - for (const v of this._requests) - v.reject(this._storedError); - this._requests.length = 0, this._cachedChunks.length = 0; - } - _onProgress(x) { - var v; - (v = this.onProgress) == null || v.call(this, { - loaded: x.loaded, - total: x.lengthComputable ? x.total : this._contentLength - }); - } - get filename() { - return this._filename; - } - get isRangeSupported() { - return this._isRangeSupported; - } - get isStreamingSupported() { - return this._isStreamingSupported; - } - get contentLength() { - return this._contentLength; - } - get headersReady() { - return this._headersReceivedCapability.promise; - } - async read() { - if (this._storedError) - throw this._storedError; - if (this._cachedChunks.length > 0) - return { - value: this._cachedChunks.shift(), - done: !1 - }; - if (this._done) - return { - value: void 0, - done: !0 - }; - const x = new l.PromiseCapability(); - return this._requests.push(x), x.promise; - } - cancel(x) { - this._done = !0, this._headersReceivedCapability.reject(x); - for (const v of this._requests) - v.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0, this._manager.isPendingRequest(this._fullRequestId) && this._manager.abortRequest(this._fullRequestId), this._fullRequestReader = null; - } - } - class O { - constructor(x, v, A) { - this._manager = x; - const u = { - onDone: this._onDone.bind(this), - onError: this._onError.bind(this), - onProgress: this._onProgress.bind(this) - }; - this._url = x.url, this._requestId = x.requestRange(v, A, u), this._requests = [], this._queuedChunk = null, this._done = !1, this._storedError = void 0, this.onProgress = null, this.onClosed = null; - } - _close() { - var x; - (x = this.onClosed) == null || x.call(this, this); - } - _onDone(x) { - const v = x.chunk; - this._requests.length > 0 ? this._requests.shift().resolve({ - value: v, - done: !1 - }) : this._queuedChunk = v, this._done = !0; - for (const A of this._requests) - A.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0, this._close(); - } - _onError(x) { - this._storedError = (0, P.createResponseStatusError)(x, this._url); - for (const v of this._requests) - v.reject(this._storedError); - this._requests.length = 0, this._queuedChunk = null; - } - _onProgress(x) { - var v; - this.isStreamingSupported || (v = this.onProgress) == null || v.call(this, { - loaded: x.loaded - }); - } - get isStreamingSupported() { - return !1; - } - async read() { - if (this._storedError) - throw this._storedError; - if (this._queuedChunk !== null) { - const v = this._queuedChunk; - return this._queuedChunk = null, { - value: v, - done: !1 - }; - } - if (this._done) - return { - value: void 0, - done: !0 - }; - const x = new l.PromiseCapability(); - return this._requests.push(x), x.promise; - } - cancel(x) { - this._done = !0; - for (const v of this._requests) - v.resolve({ - value: void 0, - done: !0 - }); - this._requests.length = 0, this._manager.isPendingRequest(this._requestId) && this._manager.abortRequest(this._requestId), this._close(); - } - } - }, - /* 23 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.PDFNodeStream = void 0; - var l = et(1), P = et(20); - const rt = /^file:\/\/\/[a-zA-Z]:\//; - function X(A) { - const u = require$$5, _ = u.parse(A); - return _.protocol === "file:" || _.host ? _ : /^[a-z]:[/\\]/i.test(A) ? u.parse(`file:///${A}`) : (_.host || (_.protocol = "file:"), _); - } - class pt { - constructor(u) { - this.source = u, this.url = X(u.url), this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:", this.isFsUrl = this.url.protocol === "file:", this.httpHeaders = this.isHttp && u.httpHeaders || {}, this._fullRequestReader = null, this._rangeRequestReaders = []; - } - get _progressiveDataLength() { - var u; - return ((u = this._fullRequestReader) == null ? void 0 : u._loaded) ?? 0; - } - getFullReader() { - return (0, l.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = this.isFsUrl ? new x(this) : new O(this), this._fullRequestReader; - } - getRangeReader(u, _) { - if (_ <= this._progressiveDataLength) - return null; - const w = this.isFsUrl ? new v(this, u, _) : new I(this, u, _); - return this._rangeRequestReaders.push(w), w; - } - cancelAllRequests(u) { - var _; - (_ = this._fullRequestReader) == null || _.cancel(u); - for (const w of this._rangeRequestReaders.slice(0)) - w.cancel(u); - } - } - d.PDFNodeStream = pt; - class B { - constructor(u) { - this._url = u.url, this._done = !1, this._storedError = null, this.onProgress = null; - const _ = u.source; - this._contentLength = _.length, this._loaded = 0, this._filename = null, this._disableRange = _.disableRange || !1, this._rangeChunkSize = _.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._isStreamingSupported = !_.disableStream, this._isRangeSupported = !_.disableRange, this._readableStream = null, this._readCapability = new l.PromiseCapability(), this._headersCapability = new l.PromiseCapability(); - } - get headersReady() { - return this._headersCapability.promise; - } - get filename() { - return this._filename; - } - get contentLength() { - return this._contentLength; - } - get isRangeSupported() { - return this._isRangeSupported; - } - get isStreamingSupported() { - return this._isStreamingSupported; - } - async read() { - var w; - if (await this._readCapability.promise, this._done) - return { - value: void 0, - done: !0 - }; - if (this._storedError) - throw this._storedError; - const u = this._readableStream.read(); - return u === null ? (this._readCapability = new l.PromiseCapability(), this.read()) : (this._loaded += u.length, (w = this.onProgress) == null || w.call(this, { - loaded: this._loaded, - total: this._contentLength - }), { - value: new Uint8Array(u).buffer, - done: !1 - }); - } - cancel(u) { - if (!this._readableStream) { - this._error(u); - return; - } - this._readableStream.destroy(u); - } - _error(u) { - this._storedError = u, this._readCapability.resolve(); - } - _setReadableStream(u) { - this._readableStream = u, u.on("readable", () => { - this._readCapability.resolve(); - }), u.on("end", () => { - u.destroy(), this._done = !0, this._readCapability.resolve(); - }), u.on("error", (_) => { - this._error(_); - }), !this._isStreamingSupported && this._isRangeSupported && this._error(new l.AbortException("streaming is disabled")), this._storedError && this._readableStream.destroy(this._storedError); - } - } - class F { - constructor(u) { - this._url = u.url, this._done = !1, this._storedError = null, this.onProgress = null, this._loaded = 0, this._readableStream = null, this._readCapability = new l.PromiseCapability(); - const _ = u.source; - this._isStreamingSupported = !_.disableStream; - } - get isStreamingSupported() { - return this._isStreamingSupported; - } - async read() { - var w; - if (await this._readCapability.promise, this._done) - return { - value: void 0, - done: !0 - }; - if (this._storedError) - throw this._storedError; - const u = this._readableStream.read(); - return u === null ? (this._readCapability = new l.PromiseCapability(), this.read()) : (this._loaded += u.length, (w = this.onProgress) == null || w.call(this, { - loaded: this._loaded - }), { - value: new Uint8Array(u).buffer, - done: !1 - }); - } - cancel(u) { - if (!this._readableStream) { - this._error(u); - return; - } - this._readableStream.destroy(u); - } - _error(u) { - this._storedError = u, this._readCapability.resolve(); - } - _setReadableStream(u) { - this._readableStream = u, u.on("readable", () => { - this._readCapability.resolve(); - }), u.on("end", () => { - u.destroy(), this._done = !0, this._readCapability.resolve(); - }), u.on("error", (_) => { - this._error(_); - }), this._storedError && this._readableStream.destroy(this._storedError); - } - } - function g(A, u) { - return { - protocol: A.protocol, - auth: A.auth, - host: A.hostname, - port: A.port, - path: A.path, - method: "GET", - headers: u - }; - } - class O extends B { - constructor(u) { - super(u); - const _ = (w) => { - if (w.statusCode === 404) { - const c = new l.MissingPDFException(`Missing PDF "${this._url}".`); - this._storedError = c, this._headersCapability.reject(c); - return; - } - this._headersCapability.resolve(), this._setReadableStream(w); - const C = (c) => this._readableStream.headers[c.toLowerCase()], { - allowRangeRequests: y, - suggestedLength: a - } = (0, P.validateRangeRequestCapabilities)({ - getResponseHeader: C, - isHttp: u.isHttp, - rangeChunkSize: this._rangeChunkSize, - disableRange: this._disableRange - }); - this._isRangeSupported = y, this._contentLength = a || this._contentLength, this._filename = (0, P.extractFilenameFromHeader)(C); - }; - if (this._request = null, this._url.protocol === "http:") { - const w = require$$5; - this._request = w.request(g(this._url, u.httpHeaders), _); - } else { - const w = require$$5; - this._request = w.request(g(this._url, u.httpHeaders), _); - } - this._request.on("error", (w) => { - this._storedError = w, this._headersCapability.reject(w); - }), this._request.end(); - } - } - class I extends F { - constructor(u, _, w) { - super(u), this._httpHeaders = {}; - for (const y in u.httpHeaders) { - const a = u.httpHeaders[y]; - a !== void 0 && (this._httpHeaders[y] = a); - } - this._httpHeaders.Range = `bytes=${_}-${w - 1}`; - const C = (y) => { - if (y.statusCode === 404) { - const a = new l.MissingPDFException(`Missing PDF "${this._url}".`); - this._storedError = a; - return; - } - this._setReadableStream(y); - }; - if (this._request = null, this._url.protocol === "http:") { - const y = require$$5; - this._request = y.request(g(this._url, this._httpHeaders), C); - } else { - const y = require$$5; - this._request = y.request(g(this._url, this._httpHeaders), C); - } - this._request.on("error", (y) => { - this._storedError = y; - }), this._request.end(); - } - } - class x extends B { - constructor(u) { - super(u); - let _ = decodeURIComponent(this._url.path); - rt.test(this._url.href) && (_ = _.replace(/^\//, "")); - const w = require$$5; - w.lstat(_, (C, y) => { - if (C) { - C.code === "ENOENT" && (C = new l.MissingPDFException(`Missing PDF "${_}".`)), this._storedError = C, this._headersCapability.reject(C); - return; - } - this._contentLength = y.size, this._setReadableStream(w.createReadStream(_)), this._headersCapability.resolve(); - }); - } - } - class v extends F { - constructor(u, _, w) { - super(u); - let C = decodeURIComponent(this._url.path); - rt.test(this._url.href) && (C = C.replace(/^\//, "")); - const y = require$$5; - this._setReadableStream(y.createReadStream(C, { - start: _, - end: w - 1 - })); - } - } - }, - /* 24 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.SVGGraphics = void 0; - var l = et(6), P = et(1); - const rt = { - fontStyle: "normal", - fontWeight: "normal", - fillColor: "#000000" - }, X = "http://www.w3.org/XML/1998/namespace", pt = "http://www.w3.org/1999/xlink", B = ["butt", "round", "square"], F = ["miter", "round", "bevel"], g = function(y, a = "", c = !1) { - if (URL.createObjectURL && typeof Blob < "u" && !c) - return URL.createObjectURL(new Blob([y], { - type: a - })); - const k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - let p = `data:${a};base64,`; - for (let r = 0, T = y.length; r < T; r += 3) { - const m = y[r] & 255, U = y[r + 1] & 255, z = y[r + 2] & 255, E = m >> 2, V = (m & 3) << 4 | U >> 4, st = r + 1 < T ? (U & 15) << 2 | z >> 6 : 64, at = r + 2 < T ? z & 63 : 64; - p += k[E] + k[V] + k[st] + k[at]; - } - return p; - }, O = function() { - const y = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]), a = 12, c = new Int32Array(256); - for (let z = 0; z < 256; z++) { - let E = z; - for (let V = 0; V < 8; V++) - E = E & 1 ? 3988292384 ^ E >> 1 & 2147483647 : E >> 1 & 2147483647; - c[z] = E; - } - function k(z, E, V) { - let st = -1; - for (let at = E; at < V; at++) { - const H = (st ^ z[at]) & 255, lt = c[H]; - st = st >>> 8 ^ lt; - } - return st ^ -1; - } - function p(z, E, V, st) { - let at = st; - const H = E.length; - V[at] = H >> 24 & 255, V[at + 1] = H >> 16 & 255, V[at + 2] = H >> 8 & 255, V[at + 3] = H & 255, at += 4, V[at] = z.charCodeAt(0) & 255, V[at + 1] = z.charCodeAt(1) & 255, V[at + 2] = z.charCodeAt(2) & 255, V[at + 3] = z.charCodeAt(3) & 255, at += 4, V.set(E, at), at += E.length; - const lt = k(V, st + 4, at); - V[at] = lt >> 24 & 255, V[at + 1] = lt >> 16 & 255, V[at + 2] = lt >> 8 & 255, V[at + 3] = lt & 255; - } - function r(z, E, V) { - let st = 1, at = 0; - for (let H = E; H < V; ++H) - st = (st + (z[H] & 255)) % 65521, at = (at + st) % 65521; - return at << 16 | st; - } - function T(z) { - if (!P.isNodeJS) - return m(z); - try { - const E = parseInt(process.versions.node) >= 8 ? z : Buffer.from(z), V = require$$5.deflateSync(E, { - level: 9 - }); - return V instanceof Uint8Array ? V : new Uint8Array(V); - } catch (E) { - (0, P.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + E); - } - return m(z); - } - function m(z) { - let E = z.length; - const V = 65535, st = Math.ceil(E / V), at = new Uint8Array(2 + E + st * 5 + 4); - let H = 0; - at[H++] = 120, at[H++] = 156; - let lt = 0; - for (; E > V; ) - at[H++] = 0, at[H++] = 255, at[H++] = 255, at[H++] = 0, at[H++] = 0, at.set(z.subarray(lt, lt + V), H), H += V, lt += V, E -= V; - at[H++] = 1, at[H++] = E & 255, at[H++] = E >> 8 & 255, at[H++] = ~E & 65535 & 255, at[H++] = (~E & 65535) >> 8 & 255, at.set(z.subarray(lt), H), H += z.length - lt; - const gt = r(z, 0, z.length); - return at[H++] = gt >> 24 & 255, at[H++] = gt >> 16 & 255, at[H++] = gt >> 8 & 255, at[H++] = gt & 255, at; - } - function U(z, E, V, st) { - const at = z.width, H = z.height; - let lt, gt, wt; - const xt = z.data; - switch (E) { - case P.ImageKind.GRAYSCALE_1BPP: - gt = 0, lt = 1, wt = at + 7 >> 3; - break; - case P.ImageKind.RGB_24BPP: - gt = 2, lt = 8, wt = at * 3; - break; - case P.ImageKind.RGBA_32BPP: - gt = 6, lt = 8, wt = at * 4; - break; - default: - throw new Error("invalid format"); - } - const S = new Uint8Array((1 + wt) * H); - let i = 0, n = 0; - for (let N = 0; N < H; ++N) - S[i++] = 0, S.set(xt.subarray(n, n + wt), i), n += wt, i += wt; - if (E === P.ImageKind.GRAYSCALE_1BPP && st) { - i = 0; - for (let N = 0; N < H; N++) { - i++; - for (let tt = 0; tt < wt; tt++) - S[i++] ^= 255; - } - } - const s = new Uint8Array([at >> 24 & 255, at >> 16 & 255, at >> 8 & 255, at & 255, H >> 24 & 255, H >> 16 & 255, H >> 8 & 255, H & 255, lt, gt, 0, 0, 0]), o = T(S), h = y.length + a * 3 + s.length + o.length, b = new Uint8Array(h); - let M = 0; - return b.set(y, M), M += y.length, p("IHDR", s, b, M), M += a + s.length, p("IDATA", o, b, M), M += a + o.length, p("IEND", new Uint8Array(0), b, M), g(b, "image/png", V); - } - return function(E, V, st) { - const at = E.kind === void 0 ? P.ImageKind.GRAYSCALE_1BPP : E.kind; - return U(E, at, V, st); - }; - }(); - class I { - constructor() { - this.fontSizeScale = 1, this.fontWeight = rt.fontWeight, this.fontSize = 0, this.textMatrix = P.IDENTITY_MATRIX, this.fontMatrix = P.FONT_IDENTITY_MATRIX, this.leading = 0, this.textRenderingMode = P.TextRenderingMode.FILL, this.textMatrixScale = 1, this.x = 0, this.y = 0, this.lineX = 0, this.lineY = 0, this.charSpacing = 0, this.wordSpacing = 0, this.textHScale = 1, this.textRise = 0, this.fillColor = rt.fillColor, this.strokeColor = "#000000", this.fillAlpha = 1, this.strokeAlpha = 1, this.lineWidth = 1, this.lineJoin = "", this.lineCap = "", this.miterLimit = 0, this.dashArray = [], this.dashPhase = 0, this.dependencies = [], this.activeClipUrl = null, this.clipGroup = null, this.maskId = ""; - } - clone() { - return Object.create(this); - } - setCurrentPoint(a, c) { - this.x = a, this.y = c; - } - } - function x(y) { - let a = []; - const c = []; - for (const k of y) { - if (k.fn === "save") { - a.push({ - fnId: 92, - fn: "group", - items: [] - }), c.push(a), a = a.at(-1).items; - continue; - } - k.fn === "restore" ? a = c.pop() : a.push(k); - } - return a; - } - function v(y) { - if (Number.isInteger(y)) - return y.toString(); - const a = y.toFixed(10); - let c = a.length - 1; - if (a[c] !== "0") - return a; - do - c--; - while (a[c] === "0"); - return a.substring(0, a[c] === "." ? c : c + 1); - } - function A(y) { - if (y[4] === 0 && y[5] === 0) { - if (y[1] === 0 && y[2] === 0) - return y[0] === 1 && y[3] === 1 ? "" : `scale(${v(y[0])} ${v(y[3])})`; - if (y[0] === y[3] && y[1] === -y[2]) { - const a = Math.acos(y[0]) * 180 / Math.PI; - return `rotate(${v(a)})`; - } - } else if (y[0] === 1 && y[1] === 0 && y[2] === 0 && y[3] === 1) - return `translate(${v(y[4])} ${v(y[5])})`; - return `matrix(${v(y[0])} ${v(y[1])} ${v(y[2])} ${v(y[3])} ${v(y[4])} ${v(y[5])})`; - } - let u = 0, _ = 0, w = 0; - class C { - constructor(a, c, k = !1) { - (0, l.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."), this.svgFactory = new l.DOMSVGFactory(), this.current = new I(), this.transformMatrix = P.IDENTITY_MATRIX, this.transformStack = [], this.extraStack = [], this.commonObjs = a, this.objs = c, this.pendingClip = null, this.pendingEOFill = !1, this.embedFonts = !1, this.embeddedFonts = /* @__PURE__ */ Object.create(null), this.cssStyle = null, this.forceDataSchema = !!k, this._operatorIdMapping = []; - for (const p in P.OPS) - this._operatorIdMapping[P.OPS[p]] = p; - } - getObject(a, c = null) { - return typeof a == "string" ? a.startsWith("g_") ? this.commonObjs.get(a) : this.objs.get(a) : c; - } - save() { - this.transformStack.push(this.transformMatrix); - const a = this.current; - this.extraStack.push(a), this.current = a.clone(); - } - restore() { - this.transformMatrix = this.transformStack.pop(), this.current = this.extraStack.pop(), this.pendingClip = null, this.tgrp = null; - } - group(a) { - this.save(), this.executeOpTree(a), this.restore(); - } - loadDependencies(a) { - const c = a.fnArray, k = a.argsArray; - for (let p = 0, r = c.length; p < r; p++) - if (c[p] === P.OPS.dependency) - for (const T of k[p]) { - const m = T.startsWith("g_") ? this.commonObjs : this.objs, U = new Promise((z) => { - m.get(T, z); - }); - this.current.dependencies.push(U); - } - return Promise.all(this.current.dependencies); - } - transform(a, c, k, p, r, T) { - const m = [a, c, k, p, r, T]; - this.transformMatrix = P.Util.transform(this.transformMatrix, m), this.tgrp = null; - } - getSVG(a, c) { - this.viewport = c; - const k = this._initialize(c); - return this.loadDependencies(a).then(() => (this.transformMatrix = P.IDENTITY_MATRIX, this.executeOpTree(this.convertOpList(a)), k)); - } - convertOpList(a) { - const c = this._operatorIdMapping, k = a.argsArray, p = a.fnArray, r = []; - for (let T = 0, m = p.length; T < m; T++) { - const U = p[T]; - r.push({ - fnId: U, - fn: c[U], - args: k[T] - }); - } - return x(r); - } - executeOpTree(a) { - for (const c of a) { - const k = c.fn, p = c.fnId, r = c.args; - switch (p | 0) { - case P.OPS.beginText: - this.beginText(); - break; - case P.OPS.dependency: - break; - case P.OPS.setLeading: - this.setLeading(r); - break; - case P.OPS.setLeadingMoveText: - this.setLeadingMoveText(r[0], r[1]); - break; - case P.OPS.setFont: - this.setFont(r); - break; - case P.OPS.showText: - this.showText(r[0]); - break; - case P.OPS.showSpacedText: - this.showText(r[0]); - break; - case P.OPS.endText: - this.endText(); - break; - case P.OPS.moveText: - this.moveText(r[0], r[1]); - break; - case P.OPS.setCharSpacing: - this.setCharSpacing(r[0]); - break; - case P.OPS.setWordSpacing: - this.setWordSpacing(r[0]); - break; - case P.OPS.setHScale: - this.setHScale(r[0]); - break; - case P.OPS.setTextMatrix: - this.setTextMatrix(r[0], r[1], r[2], r[3], r[4], r[5]); - break; - case P.OPS.setTextRise: - this.setTextRise(r[0]); - break; - case P.OPS.setTextRenderingMode: - this.setTextRenderingMode(r[0]); - break; - case P.OPS.setLineWidth: - this.setLineWidth(r[0]); - break; - case P.OPS.setLineJoin: - this.setLineJoin(r[0]); - break; - case P.OPS.setLineCap: - this.setLineCap(r[0]); - break; - case P.OPS.setMiterLimit: - this.setMiterLimit(r[0]); - break; - case P.OPS.setFillRGBColor: - this.setFillRGBColor(r[0], r[1], r[2]); - break; - case P.OPS.setStrokeRGBColor: - this.setStrokeRGBColor(r[0], r[1], r[2]); - break; - case P.OPS.setStrokeColorN: - this.setStrokeColorN(r); - break; - case P.OPS.setFillColorN: - this.setFillColorN(r); - break; - case P.OPS.shadingFill: - this.shadingFill(r[0]); - break; - case P.OPS.setDash: - this.setDash(r[0], r[1]); - break; - case P.OPS.setRenderingIntent: - this.setRenderingIntent(r[0]); - break; - case P.OPS.setFlatness: - this.setFlatness(r[0]); - break; - case P.OPS.setGState: - this.setGState(r[0]); - break; - case P.OPS.fill: - this.fill(); - break; - case P.OPS.eoFill: - this.eoFill(); - break; - case P.OPS.stroke: - this.stroke(); - break; - case P.OPS.fillStroke: - this.fillStroke(); - break; - case P.OPS.eoFillStroke: - this.eoFillStroke(); - break; - case P.OPS.clip: - this.clip("nonzero"); - break; - case P.OPS.eoClip: - this.clip("evenodd"); - break; - case P.OPS.paintSolidColorImageMask: - this.paintSolidColorImageMask(); - break; - case P.OPS.paintImageXObject: - this.paintImageXObject(r[0]); - break; - case P.OPS.paintInlineImageXObject: - this.paintInlineImageXObject(r[0]); - break; - case P.OPS.paintImageMaskXObject: - this.paintImageMaskXObject(r[0]); - break; - case P.OPS.paintFormXObjectBegin: - this.paintFormXObjectBegin(r[0], r[1]); - break; - case P.OPS.paintFormXObjectEnd: - this.paintFormXObjectEnd(); - break; - case P.OPS.closePath: - this.closePath(); - break; - case P.OPS.closeStroke: - this.closeStroke(); - break; - case P.OPS.closeFillStroke: - this.closeFillStroke(); - break; - case P.OPS.closeEOFillStroke: - this.closeEOFillStroke(); - break; - case P.OPS.nextLine: - this.nextLine(); - break; - case P.OPS.transform: - this.transform(r[0], r[1], r[2], r[3], r[4], r[5]); - break; - case P.OPS.constructPath: - this.constructPath(r[0], r[1]); - break; - case P.OPS.endPath: - this.endPath(); - break; - case 92: - this.group(c.items); - break; - default: - (0, P.warn)(`Unimplemented operator ${k}`); - break; - } - } - } - setWordSpacing(a) { - this.current.wordSpacing = a; - } - setCharSpacing(a) { - this.current.charSpacing = a; - } - nextLine() { - this.moveText(0, this.current.leading); - } - setTextMatrix(a, c, k, p, r, T) { - const m = this.current; - m.textMatrix = m.lineMatrix = [a, c, k, p, r, T], m.textMatrixScale = Math.hypot(a, c), m.x = m.lineX = 0, m.y = m.lineY = 0, m.xcoords = [], m.ycoords = [], m.tspan = this.svgFactory.createElement("svg:tspan"), m.tspan.setAttributeNS(null, "font-family", m.fontFamily), m.tspan.setAttributeNS(null, "font-size", `${v(m.fontSize)}px`), m.tspan.setAttributeNS(null, "y", v(-m.y)), m.txtElement = this.svgFactory.createElement("svg:text"), m.txtElement.append(m.tspan); - } - beginText() { - const a = this.current; - a.x = a.lineX = 0, a.y = a.lineY = 0, a.textMatrix = P.IDENTITY_MATRIX, a.lineMatrix = P.IDENTITY_MATRIX, a.textMatrixScale = 1, a.tspan = this.svgFactory.createElement("svg:tspan"), a.txtElement = this.svgFactory.createElement("svg:text"), a.txtgrp = this.svgFactory.createElement("svg:g"), a.xcoords = [], a.ycoords = []; - } - moveText(a, c) { - const k = this.current; - k.x = k.lineX += a, k.y = k.lineY += c, k.xcoords = [], k.ycoords = [], k.tspan = this.svgFactory.createElement("svg:tspan"), k.tspan.setAttributeNS(null, "font-family", k.fontFamily), k.tspan.setAttributeNS(null, "font-size", `${v(k.fontSize)}px`), k.tspan.setAttributeNS(null, "y", v(-k.y)); - } - showText(a) { - const c = this.current, k = c.font, p = c.fontSize; - if (p === 0) - return; - const r = c.fontSizeScale, T = c.charSpacing, m = c.wordSpacing, U = c.fontDirection, z = c.textHScale * U, E = k.vertical, V = E ? 1 : -1, st = k.defaultVMetrics, at = p * c.fontMatrix[0]; - let H = 0; - for (const wt of a) { - if (wt === null) { - H += U * m; - continue; - } else if (typeof wt == "number") { - H += V * wt * p / 1e3; - continue; - } - const xt = (wt.isSpace ? m : 0) + T, S = wt.fontChar; - let i, n, s = wt.width; - if (E) { - let h; - const b = wt.vmetric || st; - h = wt.vmetric ? b[1] : s * 0.5, h = -h * at; - const M = b[2] * at; - s = b ? -b[0] : s, i = h / r, n = (H + M) / r; - } else - i = H / r, n = 0; - (wt.isInFont || k.missingFile) && (c.xcoords.push(c.x + i), E && c.ycoords.push(-c.y + n), c.tspan.textContent += S); - const o = E ? s * at - xt * U : s * at + xt * U; - H += o; - } - c.tspan.setAttributeNS(null, "x", c.xcoords.map(v).join(" ")), E ? c.tspan.setAttributeNS(null, "y", c.ycoords.map(v).join(" ")) : c.tspan.setAttributeNS(null, "y", v(-c.y)), E ? c.y -= H : c.x += H * z, c.tspan.setAttributeNS(null, "font-family", c.fontFamily), c.tspan.setAttributeNS(null, "font-size", `${v(c.fontSize)}px`), c.fontStyle !== rt.fontStyle && c.tspan.setAttributeNS(null, "font-style", c.fontStyle), c.fontWeight !== rt.fontWeight && c.tspan.setAttributeNS(null, "font-weight", c.fontWeight); - const lt = c.textRenderingMode & P.TextRenderingMode.FILL_STROKE_MASK; - if (lt === P.TextRenderingMode.FILL || lt === P.TextRenderingMode.FILL_STROKE ? (c.fillColor !== rt.fillColor && c.tspan.setAttributeNS(null, "fill", c.fillColor), c.fillAlpha < 1 && c.tspan.setAttributeNS(null, "fill-opacity", c.fillAlpha)) : c.textRenderingMode === P.TextRenderingMode.ADD_TO_PATH ? c.tspan.setAttributeNS(null, "fill", "transparent") : c.tspan.setAttributeNS(null, "fill", "none"), lt === P.TextRenderingMode.STROKE || lt === P.TextRenderingMode.FILL_STROKE) { - const wt = 1 / (c.textMatrixScale || 1); - this._setStrokeAttributes(c.tspan, wt); - } - let gt = c.textMatrix; - c.textRise !== 0 && (gt = gt.slice(), gt[5] += c.textRise), c.txtElement.setAttributeNS(null, "transform", `${A(gt)} scale(${v(z)}, -1)`), c.txtElement.setAttributeNS(X, "xml:space", "preserve"), c.txtElement.append(c.tspan), c.txtgrp.append(c.txtElement), this._ensureTransformGroup().append(c.txtElement); - } - setLeadingMoveText(a, c) { - this.setLeading(-c), this.moveText(a, c); - } - addFontStyle(a) { - if (!a.data) - throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.'); - this.cssStyle || (this.cssStyle = this.svgFactory.createElement("svg:style"), this.cssStyle.setAttributeNS(null, "type", "text/css"), this.defs.append(this.cssStyle)); - const c = g(a.data, a.mimetype, this.forceDataSchema); - this.cssStyle.textContent += `@font-face { font-family: "${a.loadedName}"; src: url(${c}); } -`; - } - setFont(a) { - const c = this.current, k = this.commonObjs.get(a[0]); - let p = a[1]; - c.font = k, this.embedFonts && !k.missingFile && !this.embeddedFonts[k.loadedName] && (this.addFontStyle(k), this.embeddedFonts[k.loadedName] = k), c.fontMatrix = k.fontMatrix || P.FONT_IDENTITY_MATRIX; - let r = "normal"; - k.black ? r = "900" : k.bold && (r = "bold"); - const T = k.italic ? "italic" : "normal"; - p < 0 ? (p = -p, c.fontDirection = -1) : c.fontDirection = 1, c.fontSize = p, c.fontFamily = k.loadedName, c.fontWeight = r, c.fontStyle = T, c.tspan = this.svgFactory.createElement("svg:tspan"), c.tspan.setAttributeNS(null, "y", v(-c.y)), c.xcoords = [], c.ycoords = []; - } - endText() { - var c; - const a = this.current; - a.textRenderingMode & P.TextRenderingMode.ADD_TO_PATH_FLAG && ((c = a.txtElement) != null && c.hasChildNodes()) && (a.element = a.txtElement, this.clip("nonzero"), this.endPath()); - } - setLineWidth(a) { - a > 0 && (this.current.lineWidth = a); - } - setLineCap(a) { - this.current.lineCap = B[a]; - } - setLineJoin(a) { - this.current.lineJoin = F[a]; - } - setMiterLimit(a) { - this.current.miterLimit = a; - } - setStrokeAlpha(a) { - this.current.strokeAlpha = a; - } - setStrokeRGBColor(a, c, k) { - this.current.strokeColor = P.Util.makeHexColor(a, c, k); - } - setFillAlpha(a) { - this.current.fillAlpha = a; - } - setFillRGBColor(a, c, k) { - this.current.fillColor = P.Util.makeHexColor(a, c, k), this.current.tspan = this.svgFactory.createElement("svg:tspan"), this.current.xcoords = [], this.current.ycoords = []; - } - setStrokeColorN(a) { - this.current.strokeColor = this._makeColorN_Pattern(a); - } - setFillColorN(a) { - this.current.fillColor = this._makeColorN_Pattern(a); - } - shadingFill(a) { - const { - width: c, - height: k - } = this.viewport, p = P.Util.inverseTransform(this.transformMatrix), [r, T, m, U] = P.Util.getAxialAlignedBoundingBox([0, 0, c, k], p), z = this.svgFactory.createElement("svg:rect"); - z.setAttributeNS(null, "x", r), z.setAttributeNS(null, "y", T), z.setAttributeNS(null, "width", m - r), z.setAttributeNS(null, "height", U - T), z.setAttributeNS(null, "fill", this._makeShadingPattern(a)), this.current.fillAlpha < 1 && z.setAttributeNS(null, "fill-opacity", this.current.fillAlpha), this._ensureTransformGroup().append(z); - } - _makeColorN_Pattern(a) { - return a[0] === "TilingPattern" ? this._makeTilingPattern(a) : this._makeShadingPattern(a); - } - _makeTilingPattern(a) { - const c = a[1], k = a[2], p = a[3] || P.IDENTITY_MATRIX, [r, T, m, U] = a[4], z = a[5], E = a[6], V = a[7], st = `shading${w++}`, [at, H, lt, gt] = P.Util.normalizeRect([...P.Util.applyTransform([r, T], p), ...P.Util.applyTransform([m, U], p)]), [wt, xt] = P.Util.singularValueDecompose2dScale(p), S = z * wt, i = E * xt, n = this.svgFactory.createElement("svg:pattern"); - n.setAttributeNS(null, "id", st), n.setAttributeNS(null, "patternUnits", "userSpaceOnUse"), n.setAttributeNS(null, "width", S), n.setAttributeNS(null, "height", i), n.setAttributeNS(null, "x", `${at}`), n.setAttributeNS(null, "y", `${H}`); - const s = this.svg, o = this.transformMatrix, h = this.current.fillColor, b = this.current.strokeColor, M = this.svgFactory.create(lt - at, gt - H); - if (this.svg = M, this.transformMatrix = p, V === 2) { - const N = P.Util.makeHexColor(...c); - this.current.fillColor = N, this.current.strokeColor = N; - } - return this.executeOpTree(this.convertOpList(k)), this.svg = s, this.transformMatrix = o, this.current.fillColor = h, this.current.strokeColor = b, n.append(M.childNodes[0]), this.defs.append(n), `url(#${st})`; - } - _makeShadingPattern(a) { - switch (typeof a == "string" && (a = this.objs.get(a)), a[0]) { - case "RadialAxial": - const c = `shading${w++}`, k = a[3]; - let p; - switch (a[1]) { - case "axial": - const r = a[4], T = a[5]; - p = this.svgFactory.createElement("svg:linearGradient"), p.setAttributeNS(null, "id", c), p.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"), p.setAttributeNS(null, "x1", r[0]), p.setAttributeNS(null, "y1", r[1]), p.setAttributeNS(null, "x2", T[0]), p.setAttributeNS(null, "y2", T[1]); - break; - case "radial": - const m = a[4], U = a[5], z = a[6], E = a[7]; - p = this.svgFactory.createElement("svg:radialGradient"), p.setAttributeNS(null, "id", c), p.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"), p.setAttributeNS(null, "cx", U[0]), p.setAttributeNS(null, "cy", U[1]), p.setAttributeNS(null, "r", E), p.setAttributeNS(null, "fx", m[0]), p.setAttributeNS(null, "fy", m[1]), p.setAttributeNS(null, "fr", z); - break; - default: - throw new Error(`Unknown RadialAxial type: ${a[1]}`); - } - for (const r of k) { - const T = this.svgFactory.createElement("svg:stop"); - T.setAttributeNS(null, "offset", r[0]), T.setAttributeNS(null, "stop-color", r[1]), p.append(T); - } - return this.defs.append(p), `url(#${c})`; - case "Mesh": - return (0, P.warn)("Unimplemented pattern Mesh"), null; - case "Dummy": - return "hotpink"; - default: - throw new Error(`Unknown IR type: ${a[0]}`); - } - } - setDash(a, c) { - this.current.dashArray = a, this.current.dashPhase = c; - } - constructPath(a, c) { - const k = this.current; - let p = k.x, r = k.y, T = [], m = 0; - for (const U of a) - switch (U | 0) { - case P.OPS.rectangle: - p = c[m++], r = c[m++]; - const z = c[m++], E = c[m++], V = p + z, st = r + E; - T.push("M", v(p), v(r), "L", v(V), v(r), "L", v(V), v(st), "L", v(p), v(st), "Z"); - break; - case P.OPS.moveTo: - p = c[m++], r = c[m++], T.push("M", v(p), v(r)); - break; - case P.OPS.lineTo: - p = c[m++], r = c[m++], T.push("L", v(p), v(r)); - break; - case P.OPS.curveTo: - p = c[m + 4], r = c[m + 5], T.push("C", v(c[m]), v(c[m + 1]), v(c[m + 2]), v(c[m + 3]), v(p), v(r)), m += 6; - break; - case P.OPS.curveTo2: - T.push("C", v(p), v(r), v(c[m]), v(c[m + 1]), v(c[m + 2]), v(c[m + 3])), p = c[m + 2], r = c[m + 3], m += 4; - break; - case P.OPS.curveTo3: - p = c[m + 2], r = c[m + 3], T.push("C", v(c[m]), v(c[m + 1]), v(p), v(r), v(p), v(r)), m += 4; - break; - case P.OPS.closePath: - T.push("Z"); - break; - } - T = T.join(" "), k.path && a.length > 0 && a[0] !== P.OPS.rectangle && a[0] !== P.OPS.moveTo ? T = k.path.getAttributeNS(null, "d") + T : (k.path = this.svgFactory.createElement("svg:path"), this._ensureTransformGroup().append(k.path)), k.path.setAttributeNS(null, "d", T), k.path.setAttributeNS(null, "fill", "none"), k.element = k.path, k.setCurrentPoint(p, r); - } - endPath() { - const a = this.current; - if (a.path = null, !this.pendingClip) - return; - if (!a.element) { - this.pendingClip = null; - return; - } - const c = `clippath${u++}`, k = this.svgFactory.createElement("svg:clipPath"); - k.setAttributeNS(null, "id", c), k.setAttributeNS(null, "transform", A(this.transformMatrix)); - const p = a.element.cloneNode(!0); - if (this.pendingClip === "evenodd" ? p.setAttributeNS(null, "clip-rule", "evenodd") : p.setAttributeNS(null, "clip-rule", "nonzero"), this.pendingClip = null, k.append(p), this.defs.append(k), a.activeClipUrl) { - a.clipGroup = null; - for (const r of this.extraStack) - r.clipGroup = null; - k.setAttributeNS(null, "clip-path", a.activeClipUrl); - } - a.activeClipUrl = `url(#${c})`, this.tgrp = null; - } - clip(a) { - this.pendingClip = a; - } - closePath() { - const a = this.current; - if (a.path) { - const c = `${a.path.getAttributeNS(null, "d")}Z`; - a.path.setAttributeNS(null, "d", c); - } - } - setLeading(a) { - this.current.leading = -a; - } - setTextRise(a) { - this.current.textRise = a; - } - setTextRenderingMode(a) { - this.current.textRenderingMode = a; - } - setHScale(a) { - this.current.textHScale = a / 100; - } - setRenderingIntent(a) { - } - setFlatness(a) { - } - setGState(a) { - for (const [c, k] of a) - switch (c) { - case "LW": - this.setLineWidth(k); - break; - case "LC": - this.setLineCap(k); - break; - case "LJ": - this.setLineJoin(k); - break; - case "ML": - this.setMiterLimit(k); - break; - case "D": - this.setDash(k[0], k[1]); - break; - case "RI": - this.setRenderingIntent(k); - break; - case "FL": - this.setFlatness(k); - break; - case "Font": - this.setFont(k); - break; - case "CA": - this.setStrokeAlpha(k); - break; - case "ca": - this.setFillAlpha(k); - break; - default: - (0, P.warn)(`Unimplemented graphic state operator ${c}`); - break; - } - } - fill() { - const a = this.current; - a.element && (a.element.setAttributeNS(null, "fill", a.fillColor), a.element.setAttributeNS(null, "fill-opacity", a.fillAlpha), this.endPath()); - } - stroke() { - const a = this.current; - a.element && (this._setStrokeAttributes(a.element), a.element.setAttributeNS(null, "fill", "none"), this.endPath()); - } - _setStrokeAttributes(a, c = 1) { - const k = this.current; - let p = k.dashArray; - c !== 1 && p.length > 0 && (p = p.map(function(r) { - return c * r; - })), a.setAttributeNS(null, "stroke", k.strokeColor), a.setAttributeNS(null, "stroke-opacity", k.strokeAlpha), a.setAttributeNS(null, "stroke-miterlimit", v(k.miterLimit)), a.setAttributeNS(null, "stroke-linecap", k.lineCap), a.setAttributeNS(null, "stroke-linejoin", k.lineJoin), a.setAttributeNS(null, "stroke-width", v(c * k.lineWidth) + "px"), a.setAttributeNS(null, "stroke-dasharray", p.map(v).join(" ")), a.setAttributeNS(null, "stroke-dashoffset", v(c * k.dashPhase) + "px"); - } - eoFill() { - var a; - (a = this.current.element) == null || a.setAttributeNS(null, "fill-rule", "evenodd"), this.fill(); - } - fillStroke() { - this.stroke(), this.fill(); - } - eoFillStroke() { - var a; - (a = this.current.element) == null || a.setAttributeNS(null, "fill-rule", "evenodd"), this.fillStroke(); - } - closeStroke() { - this.closePath(), this.stroke(); - } - closeFillStroke() { - this.closePath(), this.fillStroke(); - } - closeEOFillStroke() { - this.closePath(), this.eoFillStroke(); - } - paintSolidColorImageMask() { - const a = this.svgFactory.createElement("svg:rect"); - a.setAttributeNS(null, "x", "0"), a.setAttributeNS(null, "y", "0"), a.setAttributeNS(null, "width", "1px"), a.setAttributeNS(null, "height", "1px"), a.setAttributeNS(null, "fill", this.current.fillColor), this._ensureTransformGroup().append(a); - } - paintImageXObject(a) { - const c = this.getObject(a); - if (!c) { - (0, P.warn)(`Dependent image with object ID ${a} is not ready yet`); - return; - } - this.paintInlineImageXObject(c); - } - paintInlineImageXObject(a, c) { - const k = a.width, p = a.height, r = O(a, this.forceDataSchema, !!c), T = this.svgFactory.createElement("svg:rect"); - T.setAttributeNS(null, "x", "0"), T.setAttributeNS(null, "y", "0"), T.setAttributeNS(null, "width", v(k)), T.setAttributeNS(null, "height", v(p)), this.current.element = T, this.clip("nonzero"); - const m = this.svgFactory.createElement("svg:image"); - m.setAttributeNS(pt, "xlink:href", r), m.setAttributeNS(null, "x", "0"), m.setAttributeNS(null, "y", v(-p)), m.setAttributeNS(null, "width", v(k) + "px"), m.setAttributeNS(null, "height", v(p) + "px"), m.setAttributeNS(null, "transform", `scale(${v(1 / k)} ${v(-1 / p)})`), c ? c.append(m) : this._ensureTransformGroup().append(m); - } - paintImageMaskXObject(a) { - const c = this.getObject(a.data, a); - if (c.bitmap) { - (0, P.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled."); - return; - } - const k = this.current, p = c.width, r = c.height, T = k.fillColor; - k.maskId = `mask${_++}`; - const m = this.svgFactory.createElement("svg:mask"); - m.setAttributeNS(null, "id", k.maskId); - const U = this.svgFactory.createElement("svg:rect"); - U.setAttributeNS(null, "x", "0"), U.setAttributeNS(null, "y", "0"), U.setAttributeNS(null, "width", v(p)), U.setAttributeNS(null, "height", v(r)), U.setAttributeNS(null, "fill", T), U.setAttributeNS(null, "mask", `url(#${k.maskId})`), this.defs.append(m), this._ensureTransformGroup().append(U), this.paintInlineImageXObject(c, m); - } - paintFormXObjectBegin(a, c) { - if (Array.isArray(a) && a.length === 6 && this.transform(a[0], a[1], a[2], a[3], a[4], a[5]), c) { - const k = c[2] - c[0], p = c[3] - c[1], r = this.svgFactory.createElement("svg:rect"); - r.setAttributeNS(null, "x", c[0]), r.setAttributeNS(null, "y", c[1]), r.setAttributeNS(null, "width", v(k)), r.setAttributeNS(null, "height", v(p)), this.current.element = r, this.clip("nonzero"), this.endPath(); - } - } - paintFormXObjectEnd() { - } - _initialize(a) { - const c = this.svgFactory.create(a.width, a.height), k = this.svgFactory.createElement("svg:defs"); - c.append(k), this.defs = k; - const p = this.svgFactory.createElement("svg:g"); - return p.setAttributeNS(null, "transform", A(a.transform)), c.append(p), this.svg = p, c; - } - _ensureClipGroup() { - if (!this.current.clipGroup) { - const a = this.svgFactory.createElement("svg:g"); - a.setAttributeNS(null, "clip-path", this.current.activeClipUrl), this.svg.append(a), this.current.clipGroup = a; - } - return this.current.clipGroup; - } - _ensureTransformGroup() { - return this.tgrp || (this.tgrp = this.svgFactory.createElement("svg:g"), this.tgrp.setAttributeNS(null, "transform", A(this.transformMatrix)), this.current.activeClipUrl ? this._ensureClipGroup().append(this.tgrp) : this.svg.append(this.tgrp)), this.tgrp; - } - } - d.SVGGraphics = C; - }, - /* 25 */ - /***/ - (dt, d) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.XfaText = void 0; - class et { - static textContent(P) { - const rt = [], X = { - items: rt, - styles: /* @__PURE__ */ Object.create(null) - }; - function pt(B) { - var O; - if (!B) - return; - let F = null; - const g = B.name; - if (g === "#text") - F = B.value; - else if (et.shouldBuildText(g)) - (O = B == null ? void 0 : B.attributes) != null && O.textContent ? F = B.attributes.textContent : B.value && (F = B.value); - else - return; - if (F !== null && rt.push({ - str: F - }), !!B.children) - for (const I of B.children) - pt(I); - } - return pt(P), X; - } - static shouldBuildText(P) { - return !(P === "textarea" || P === "input" || P === "option" || P === "select"); - } - } - d.XfaText = et; - }, - /* 26 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.TextLayerRenderTask = void 0, d.renderTextLayer = A, d.updateTextLayer = u; - var l = et(1), P = et(6); - const rt = 1e5, X = 30, pt = 0.8, B = /* @__PURE__ */ new Map(); - function F(_, w) { - let C; - if (w && l.FeatureTest.isOffscreenCanvasSupported) - C = new OffscreenCanvas(_, _).getContext("2d", { - alpha: !1 - }); - else { - const y = document.createElement("canvas"); - y.width = y.height = _, C = y.getContext("2d", { - alpha: !1 - }); - } - return C; - } - function g(_, w) { - const C = B.get(_); - if (C) - return C; - const y = F(X, w); - y.font = `${X}px ${_}`; - const a = y.measureText(""); - let c = a.fontBoundingBoxAscent, k = Math.abs(a.fontBoundingBoxDescent); - if (c) { - const r = c / (c + k); - return B.set(_, r), y.canvas.width = y.canvas.height = 0, r; - } - y.strokeStyle = "red", y.clearRect(0, 0, X, X), y.strokeText("g", 0, 0); - let p = y.getImageData(0, 0, X, X).data; - k = 0; - for (let r = p.length - 1 - 3; r >= 0; r -= 4) - if (p[r] > 0) { - k = Math.ceil(r / 4 / X); - break; - } - y.clearRect(0, 0, X, X), y.strokeText("A", 0, X), p = y.getImageData(0, 0, X, X).data, c = 0; - for (let r = 0, T = p.length; r < T; r += 4) - if (p[r] > 0) { - c = X - Math.floor(r / 4 / X); - break; - } - if (y.canvas.width = y.canvas.height = 0, c) { - const r = c / (c + k); - return B.set(_, r), r; - } - return B.set(_, pt), pt; - } - function O(_, w, C) { - const y = document.createElement("span"), a = { - angle: 0, - canvasWidth: 0, - hasText: w.str !== "", - hasEOL: w.hasEOL, - fontSize: 0 - }; - _._textDivs.push(y); - const c = l.Util.transform(_._transform, w.transform); - let k = Math.atan2(c[1], c[0]); - const p = C[w.fontName]; - p.vertical && (k += Math.PI / 2); - const r = Math.hypot(c[2], c[3]), T = r * g(p.fontFamily, _._isOffscreenCanvasSupported); - let m, U; - k === 0 ? (m = c[4], U = c[5] - T) : (m = c[4] + T * Math.sin(k), U = c[5] - T * Math.cos(k)); - const z = "calc(var(--scale-factor)*", E = y.style; - _._container === _._rootContainer ? (E.left = `${(100 * m / _._pageWidth).toFixed(2)}%`, E.top = `${(100 * U / _._pageHeight).toFixed(2)}%`) : (E.left = `${z}${m.toFixed(2)}px)`, E.top = `${z}${U.toFixed(2)}px)`), E.fontSize = `${z}${r.toFixed(2)}px)`, E.fontFamily = p.fontFamily, a.fontSize = r, y.setAttribute("role", "presentation"), y.textContent = w.str, y.dir = w.dir, _._fontInspectorEnabled && (y.dataset.fontName = w.fontName), k !== 0 && (a.angle = k * (180 / Math.PI)); - let V = !1; - if (w.str.length > 1) - V = !0; - else if (w.str !== " " && w.transform[0] !== w.transform[3]) { - const st = Math.abs(w.transform[0]), at = Math.abs(w.transform[3]); - st !== at && Math.max(st, at) / Math.min(st, at) > 1.5 && (V = !0); - } - V && (a.canvasWidth = p.vertical ? w.height : w.width), _._textDivProperties.set(y, a), _._isReadableStream && _._layoutText(y); - } - function I(_) { - const { - div: w, - scale: C, - properties: y, - ctx: a, - prevFontSize: c, - prevFontFamily: k - } = _, { - style: p - } = w; - let r = ""; - if (y.canvasWidth !== 0 && y.hasText) { - const { - fontFamily: T - } = p, { - canvasWidth: m, - fontSize: U - } = y; - (c !== U || k !== T) && (a.font = `${U * C}px ${T}`, _.prevFontSize = U, _.prevFontFamily = T); - const { - width: z - } = a.measureText(w.textContent); - z > 0 && (r = `scaleX(${m * C / z})`); - } - y.angle !== 0 && (r = `rotate(${y.angle}deg) ${r}`), r.length > 0 && (p.transform = r); - } - function x(_) { - if (_._canceled) - return; - const w = _._textDivs, C = _._capability; - if (w.length > rt) { - C.resolve(); - return; - } - if (!_._isReadableStream) - for (const a of w) - _._layoutText(a); - C.resolve(); - } - class v { - constructor({ - textContentSource: w, - container: C, - viewport: y, - textDivs: a, - textDivProperties: c, - textContentItemsStr: k, - isOffscreenCanvasSupported: p - }) { - var z; - this._textContentSource = w, this._isReadableStream = w instanceof ReadableStream, this._container = this._rootContainer = C, this._textDivs = a || [], this._textContentItemsStr = k || [], this._isOffscreenCanvasSupported = p, this._fontInspectorEnabled = !!((z = globalThis.FontInspector) != null && z.enabled), this._reader = null, this._textDivProperties = c || /* @__PURE__ */ new WeakMap(), this._canceled = !1, this._capability = new l.PromiseCapability(), this._layoutTextParams = { - prevFontSize: null, - prevFontFamily: null, - div: null, - scale: y.scale * (globalThis.devicePixelRatio || 1), - properties: null, - ctx: F(0, p) - }; - const { - pageWidth: r, - pageHeight: T, - pageX: m, - pageY: U - } = y.rawDims; - this._transform = [1, 0, 0, -1, -m, U + T], this._pageWidth = r, this._pageHeight = T, (0, P.setLayerDimensions)(C, y), this._capability.promise.finally(() => { - this._layoutTextParams = null; - }).catch(() => { - }); - } - get promise() { - return this._capability.promise; - } - cancel() { - this._canceled = !0, this._reader && (this._reader.cancel(new l.AbortException("TextLayer task cancelled.")).catch(() => { - }), this._reader = null), this._capability.reject(new l.AbortException("TextLayer task cancelled.")); - } - _processItems(w, C) { - for (const y of w) { - if (y.str === void 0) { - if (y.type === "beginMarkedContentProps" || y.type === "beginMarkedContent") { - const a = this._container; - this._container = document.createElement("span"), this._container.classList.add("markedContent"), y.id !== null && this._container.setAttribute("id", `${y.id}`), a.append(this._container); - } else - y.type === "endMarkedContent" && (this._container = this._container.parentNode); - continue; - } - this._textContentItemsStr.push(y.str), O(this, y, C); - } - } - _layoutText(w) { - const C = this._layoutTextParams.properties = this._textDivProperties.get(w); - if (this._layoutTextParams.div = w, I(this._layoutTextParams), C.hasText && this._container.append(w), C.hasEOL) { - const y = document.createElement("br"); - y.setAttribute("role", "presentation"), this._container.append(y); - } - } - _render() { - const w = new l.PromiseCapability(); - let C = /* @__PURE__ */ Object.create(null); - if (this._isReadableStream) { - const y = () => { - this._reader.read().then(({ - value: a, - done: c - }) => { - if (c) { - w.resolve(); - return; - } - Object.assign(C, a.styles), this._processItems(a.items, C), y(); - }, w.reject); - }; - this._reader = this._textContentSource.getReader(), y(); - } else if (this._textContentSource) { - const { - items: y, - styles: a - } = this._textContentSource; - this._processItems(y, a), w.resolve(); - } else - throw new Error('No "textContentSource" parameter specified.'); - w.promise.then(() => { - C = null, x(this); - }, this._capability.reject); - } - } - d.TextLayerRenderTask = v; - function A(_) { - !_.textContentSource && (_.textContent || _.textContentStream) && ((0, P.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."), _.textContentSource = _.textContent || _.textContentStream); - const { - container: w, - viewport: C - } = _, y = getComputedStyle(w), a = y.getPropertyValue("visibility"), c = parseFloat(y.getPropertyValue("--scale-factor")); - a === "visible" && (!c || Math.abs(c - C.scale) > 1e-5) && console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM."); - const k = new v(_); - return k._render(), k; - } - function u({ - container: _, - viewport: w, - textDivs: C, - textDivProperties: y, - isOffscreenCanvasSupported: a, - mustRotate: c = !0, - mustRescale: k = !0 - }) { - if (c && (0, P.setLayerDimensions)(_, { - rotation: w.rotation - }), k) { - const p = F(0, a), T = { - prevFontSize: null, - prevFontFamily: null, - div: null, - scale: w.scale * (globalThis.devicePixelRatio || 1), - properties: null, - ctx: p - }; - for (const m of C) - T.properties = y.get(m), T.div = m, I(T); - } - } - }, - /* 27 */ - /***/ - (dt, d, et) => { - var g, O, I, x, v, A, u, _, w, C, y, ei, c, ke, p, ii, T, si; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.AnnotationEditorLayer = void 0; - var l = et(1), P = et(4), rt = et(28), X = et(33), pt = et(6), B = et(34); - const U = class U { - constructor({ - uiManager: E, - pageIndex: V, - div: st, - accessibilityManager: at, - annotationLayer: H, - viewport: lt, - l10n: gt - }) { - L(this, y); - L(this, c); - L(this, p); - L(this, T); - L(this, g, void 0); - L(this, O, !1); - L(this, I, null); - L(this, x, this.pointerup.bind(this)); - L(this, v, this.pointerdown.bind(this)); - L(this, A, /* @__PURE__ */ new Map()); - L(this, u, !1); - L(this, _, !1); - L(this, w, !1); - L(this, C, void 0); - const wt = [rt.FreeTextEditor, X.InkEditor, B.StampEditor]; - if (!U._initialized) { - U._initialized = !0; - for (const xt of wt) - xt.initialize(gt); - } - E.registerEditorTypes(wt), Z(this, C, E), this.pageIndex = V, this.div = st, Z(this, g, at), Z(this, I, H), this.viewport = lt, t(this, C).addLayer(this); - } - get isEmpty() { - return t(this, A).size === 0; - } - updateToolbar(E) { - t(this, C).updateToolbar(E); - } - updateMode(E = t(this, C).getMode()) { - W(this, T, si).call(this), E === l.AnnotationEditorType.INK ? (this.addInkEditorIfNeeded(!1), this.disableClick()) : this.enableClick(), E !== l.AnnotationEditorType.NONE && (this.div.classList.toggle("freeTextEditing", E === l.AnnotationEditorType.FREETEXT), this.div.classList.toggle("inkEditing", E === l.AnnotationEditorType.INK), this.div.classList.toggle("stampEditing", E === l.AnnotationEditorType.STAMP), this.div.hidden = !1); - } - addInkEditorIfNeeded(E) { - if (!E && t(this, C).getMode() !== l.AnnotationEditorType.INK) - return; - if (!E) { - for (const st of t(this, A).values()) - if (st.isEmpty()) { - st.setInBackground(); - return; - } - } - W(this, c, ke).call(this, { - offsetX: 0, - offsetY: 0 - }, !1).setInBackground(); - } - setEditingState(E) { - t(this, C).setEditingState(E); - } - addCommands(E) { - t(this, C).addCommands(E); - } - enable() { - this.div.style.pointerEvents = "auto"; - const E = /* @__PURE__ */ new Set(); - for (const st of t(this, A).values()) - st.enableEditing(), st.annotationElementId && E.add(st.annotationElementId); - if (!t(this, I)) - return; - const V = t(this, I).getEditableAnnotations(); - for (const st of V) { - if (st.hide(), t(this, C).isDeletedAnnotationElement(st.data.id) || E.has(st.data.id)) - continue; - const at = this.deserialize(st); - at && (this.addOrRebuild(at), at.enableEditing()); - } - } - disable() { - var V; - Z(this, w, !0), this.div.style.pointerEvents = "none"; - const E = /* @__PURE__ */ new Set(); - for (const st of t(this, A).values()) { - if (st.disableEditing(), !st.annotationElementId || st.serialize() !== null) { - E.add(st.annotationElementId); - continue; - } - (V = this.getEditableAnnotation(st.annotationElementId)) == null || V.show(), st.remove(); - } - if (t(this, I)) { - const st = t(this, I).getEditableAnnotations(); - for (const at of st) { - const { - id: H - } = at.data; - E.has(H) || t(this, C).isDeletedAnnotationElement(H) || at.show(); - } - } - W(this, T, si).call(this), this.isEmpty && (this.div.hidden = !0), Z(this, w, !1); - } - getEditableAnnotation(E) { - var V; - return ((V = t(this, I)) == null ? void 0 : V.getEditableAnnotation(E)) || null; - } - setActiveEditor(E) { - t(this, C).getActive() !== E && t(this, C).setActiveEditor(E); - } - enableClick() { - this.div.addEventListener("pointerdown", t(this, v)), this.div.addEventListener("pointerup", t(this, x)); - } - disableClick() { - this.div.removeEventListener("pointerdown", t(this, v)), this.div.removeEventListener("pointerup", t(this, x)); - } - attach(E) { - t(this, A).set(E.id, E); - const { - annotationElementId: V - } = E; - V && t(this, C).isDeletedAnnotationElement(V) && t(this, C).removeDeletedAnnotationElement(E); - } - detach(E) { - var V; - t(this, A).delete(E.id), (V = t(this, g)) == null || V.removePointerInTextLayer(E.contentDiv), !t(this, w) && E.annotationElementId && t(this, C).addDeletedAnnotationElement(E); - } - remove(E) { - this.detach(E), t(this, C).removeEditor(E), E.div.contains(document.activeElement) && setTimeout(() => { - t(this, C).focusMainContainer(); - }, 0), E.div.remove(), E.isAttachedToDOM = !1, t(this, _) || this.addInkEditorIfNeeded(!1); - } - changeParent(E) { - var V; - E.parent !== this && (E.annotationElementId && (t(this, C).addDeletedAnnotationElement(E.annotationElementId), P.AnnotationEditor.deleteAnnotationElement(E), E.annotationElementId = null), this.attach(E), (V = E.parent) == null || V.detach(E), E.setParent(this), E.div && E.isAttachedToDOM && (E.div.remove(), this.div.append(E.div))); - } - add(E) { - if (this.changeParent(E), t(this, C).addEditor(E), this.attach(E), !E.isAttachedToDOM) { - const V = E.render(); - this.div.append(V), E.isAttachedToDOM = !0; - } - E.fixAndSetPosition(), E.onceAdded(), t(this, C).addToAnnotationStorage(E); - } - moveEditorInDOM(E) { - var st; - if (!E.isAttachedToDOM) - return; - const { - activeElement: V - } = document; - E.div.contains(V) && (E._focusEventsAllowed = !1, setTimeout(() => { - E.div.contains(document.activeElement) ? E._focusEventsAllowed = !0 : (E.div.addEventListener("focusin", () => { - E._focusEventsAllowed = !0; - }, { - once: !0 - }), V.focus()); - }, 0)), E._structTreeParentId = (st = t(this, g)) == null ? void 0 : st.moveElementInDOM(this.div, E.div, E.contentDiv, !0); - } - addOrRebuild(E) { - E.needsToBeRebuilt() ? E.rebuild() : this.add(E); - } - addUndoableEditor(E) { - const V = () => E._uiManager.rebuild(E), st = () => { - E.remove(); - }; - this.addCommands({ - cmd: V, - undo: st, - mustExec: !1 - }); - } - getNextId() { - return t(this, C).getId(); - } - pasteEditor(E, V) { - t(this, C).updateToolbar(E), t(this, C).updateMode(E); - const { - offsetX: st, - offsetY: at - } = W(this, p, ii).call(this), H = this.getNextId(), lt = W(this, y, ei).call(this, { - parent: this, - id: H, - x: st, - y: at, - uiManager: t(this, C), - isCentered: !0, - ...V - }); - lt && this.add(lt); - } - deserialize(E) { - switch (E.annotationType ?? E.annotationEditorType) { - case l.AnnotationEditorType.FREETEXT: - return rt.FreeTextEditor.deserialize(E, this, t(this, C)); - case l.AnnotationEditorType.INK: - return X.InkEditor.deserialize(E, this, t(this, C)); - case l.AnnotationEditorType.STAMP: - return B.StampEditor.deserialize(E, this, t(this, C)); - } - return null; - } - addNewEditor() { - W(this, c, ke).call(this, W(this, p, ii).call(this), !0); - } - setSelected(E) { - t(this, C).setSelected(E); - } - toggleSelected(E) { - t(this, C).toggleSelected(E); - } - isSelected(E) { - return t(this, C).isSelected(E); - } - unselect(E) { - t(this, C).unselect(E); - } - pointerup(E) { - const { - isMac: V - } = l.FeatureTest.platform; - if (!(E.button !== 0 || E.ctrlKey && V) && E.target === this.div && t(this, u)) { - if (Z(this, u, !1), !t(this, O)) { - Z(this, O, !0); - return; - } - if (t(this, C).getMode() === l.AnnotationEditorType.STAMP) { - t(this, C).unselectAll(); - return; - } - W(this, c, ke).call(this, E, !1); - } - } - pointerdown(E) { - if (t(this, u)) { - Z(this, u, !1); - return; - } - const { - isMac: V - } = l.FeatureTest.platform; - if (E.button !== 0 || E.ctrlKey && V || E.target !== this.div) - return; - Z(this, u, !0); - const st = t(this, C).getActive(); - Z(this, O, !st || st.isEmpty()); - } - findNewParent(E, V, st) { - const at = t(this, C).findParent(V, st); - return at === null || at === this ? !1 : (at.changeParent(E), !0); - } - destroy() { - var E, V; - ((E = t(this, C).getActive()) == null ? void 0 : E.parent) === this && (t(this, C).commitOrRemove(), t(this, C).setActiveEditor(null)); - for (const st of t(this, A).values()) - (V = t(this, g)) == null || V.removePointerInTextLayer(st.contentDiv), st.setParent(null), st.isAttachedToDOM = !1, st.div.remove(); - this.div = null, t(this, A).clear(), t(this, C).removeLayer(this); - } - render({ - viewport: E - }) { - this.viewport = E, (0, pt.setLayerDimensions)(this.div, E); - for (const V of t(this, C).getEditors(this.pageIndex)) - this.add(V); - this.updateMode(); - } - update({ - viewport: E - }) { - t(this, C).commitOrRemove(), this.viewport = E, (0, pt.setLayerDimensions)(this.div, { - rotation: E.rotation - }), this.updateMode(); - } - get pageDimensions() { - const { - pageWidth: E, - pageHeight: V - } = this.viewport.rawDims; - return [E, V]; - } - }; - g = new WeakMap(), O = new WeakMap(), I = new WeakMap(), x = new WeakMap(), v = new WeakMap(), A = new WeakMap(), u = new WeakMap(), _ = new WeakMap(), w = new WeakMap(), C = new WeakMap(), y = new WeakSet(), ei = function(E) { - switch (t(this, C).getMode()) { - case l.AnnotationEditorType.FREETEXT: - return new rt.FreeTextEditor(E); - case l.AnnotationEditorType.INK: - return new X.InkEditor(E); - case l.AnnotationEditorType.STAMP: - return new B.StampEditor(E); - } - return null; - }, c = new WeakSet(), ke = function(E, V) { - const st = this.getNextId(), at = W(this, y, ei).call(this, { - parent: this, - id: st, - x: E.offsetX, - y: E.offsetY, - uiManager: t(this, C), - isCentered: V - }); - return at && this.add(at), at; - }, p = new WeakSet(), ii = function() { - const { - x: E, - y: V, - width: st, - height: at - } = this.div.getBoundingClientRect(), H = Math.max(0, E), lt = Math.max(0, V), gt = Math.min(window.innerWidth, E + st), wt = Math.min(window.innerHeight, V + at), xt = (H + gt) / 2 - E, S = (lt + wt) / 2 - V, [i, n] = this.viewport.rotation % 180 === 0 ? [xt, S] : [S, xt]; - return { - offsetX: i, - offsetY: n - }; - }, T = new WeakSet(), si = function() { - Z(this, _, !0); - for (const E of t(this, A).values()) - E.isEmpty() && E.remove(); - Z(this, _, !1); - }, ee(U, "_initialized", !1); - let F = U; - d.AnnotationEditorLayer = F; - }, - /* 28 */ - /***/ - (dt, d, et) => { - var B, F, g, O, I, x, v, A, u, _, Fi, C, Mi, a, Ri, k, ye, r, ni, m, Di, z, ri; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.FreeTextEditor = void 0; - var l = et(1), P = et(5), rt = et(4), X = et(29); - const V = class V extends rt.AnnotationEditor { - constructor(H) { - super({ - ...H, - name: "freeTextEditor" - }); - L(this, _); - L(this, C); - L(this, a); - L(this, k); - L(this, r); - L(this, m); - L(this, z); - L(this, B, this.editorDivBlur.bind(this)); - L(this, F, this.editorDivFocus.bind(this)); - L(this, g, this.editorDivInput.bind(this)); - L(this, O, this.editorDivKeydown.bind(this)); - L(this, I, void 0); - L(this, x, ""); - L(this, v, `${this.id}-editor`); - L(this, A, void 0); - L(this, u, null); - Z(this, I, H.color || V._defaultColor || rt.AnnotationEditor._defaultLineColor), Z(this, A, H.fontSize || V._defaultFontSize); - } - static get _keyboardManager() { - const H = V.prototype, lt = (xt) => xt.isEmpty(), gt = P.AnnotationEditorUIManager.TRANSLATE_SMALL, wt = P.AnnotationEditorUIManager.TRANSLATE_BIG; - return (0, l.shadow)(this, "_keyboardManager", new P.KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], H.commitOrRemove, { - bubbles: !0 - }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], H.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], H._translateEmpty, { - args: [-gt, 0], - checker: lt - }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], H._translateEmpty, { - args: [-wt, 0], - checker: lt - }], [["ArrowRight", "mac+ArrowRight"], H._translateEmpty, { - args: [gt, 0], - checker: lt - }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], H._translateEmpty, { - args: [wt, 0], - checker: lt - }], [["ArrowUp", "mac+ArrowUp"], H._translateEmpty, { - args: [0, -gt], - checker: lt - }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], H._translateEmpty, { - args: [0, -wt], - checker: lt - }], [["ArrowDown", "mac+ArrowDown"], H._translateEmpty, { - args: [0, gt], - checker: lt - }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], H._translateEmpty, { - args: [0, wt], - checker: lt - }]])); - } - static initialize(H) { - rt.AnnotationEditor.initialize(H, { - strings: ["free_text2_default_content", "editor_free_text2_aria_label"] - }); - const lt = getComputedStyle(document.documentElement); - this._internalPadding = parseFloat(lt.getPropertyValue("--freetext-padding")); - } - static updateDefaultParams(H, lt) { - switch (H) { - case l.AnnotationEditorParamsType.FREETEXT_SIZE: - V._defaultFontSize = lt; - break; - case l.AnnotationEditorParamsType.FREETEXT_COLOR: - V._defaultColor = lt; - break; - } - } - updateParams(H, lt) { - switch (H) { - case l.AnnotationEditorParamsType.FREETEXT_SIZE: - W(this, _, Fi).call(this, lt); - break; - case l.AnnotationEditorParamsType.FREETEXT_COLOR: - W(this, C, Mi).call(this, lt); - break; - } - } - static get defaultPropertiesToUpdate() { - return [[l.AnnotationEditorParamsType.FREETEXT_SIZE, V._defaultFontSize], [l.AnnotationEditorParamsType.FREETEXT_COLOR, V._defaultColor || rt.AnnotationEditor._defaultLineColor]]; - } - get propertiesToUpdate() { - return [[l.AnnotationEditorParamsType.FREETEXT_SIZE, t(this, A)], [l.AnnotationEditorParamsType.FREETEXT_COLOR, t(this, I)]]; - } - _translateEmpty(H, lt) { - this._uiManager.translateSelectedEditors(H, lt, !0); - } - getInitialTranslation() { - const H = this.parentScale; - return [-V._internalPadding * H, -(V._internalPadding + t(this, A)) * H]; - } - rebuild() { - this.parent && (super.rebuild(), this.div !== null && (this.isAttachedToDOM || this.parent.add(this))); - } - enableEditMode() { - this.isInEditMode() || (this.parent.setEditingState(!1), this.parent.updateToolbar(l.AnnotationEditorType.FREETEXT), super.enableEditMode(), this.overlayDiv.classList.remove("enabled"), this.editorDiv.contentEditable = !0, this._isDraggable = !1, this.div.removeAttribute("aria-activedescendant"), this.editorDiv.addEventListener("keydown", t(this, O)), this.editorDiv.addEventListener("focus", t(this, F)), this.editorDiv.addEventListener("blur", t(this, B)), this.editorDiv.addEventListener("input", t(this, g))); - } - disableEditMode() { - this.isInEditMode() && (this.parent.setEditingState(!0), super.disableEditMode(), this.overlayDiv.classList.add("enabled"), this.editorDiv.contentEditable = !1, this.div.setAttribute("aria-activedescendant", t(this, v)), this._isDraggable = !0, this.editorDiv.removeEventListener("keydown", t(this, O)), this.editorDiv.removeEventListener("focus", t(this, F)), this.editorDiv.removeEventListener("blur", t(this, B)), this.editorDiv.removeEventListener("input", t(this, g)), this.div.focus({ - preventScroll: !0 - }), this.isEditing = !1, this.parent.div.classList.add("freeTextEditing")); - } - focusin(H) { - this._focusEventsAllowed && (super.focusin(H), H.target !== this.editorDiv && this.editorDiv.focus()); - } - onceAdded() { - var H; - if (this.width) { - W(this, z, ri).call(this); - return; - } - this.enableEditMode(), this.editorDiv.focus(), (H = this._initialOptions) != null && H.isCentered && this.center(), this._initialOptions = null; - } - isEmpty() { - return !this.editorDiv || this.editorDiv.innerText.trim() === ""; - } - remove() { - this.isEditing = !1, this.parent && (this.parent.setEditingState(!0), this.parent.div.classList.add("freeTextEditing")), super.remove(); - } - commit() { - if (!this.isInEditMode()) - return; - super.commit(), this.disableEditMode(); - const H = t(this, x), lt = Z(this, x, W(this, a, Ri).call(this).trimEnd()); - if (H === lt) - return; - const gt = (wt) => { - if (Z(this, x, wt), !wt) { - this.remove(); - return; - } - W(this, r, ni).call(this), this._uiManager.rebuild(this), W(this, k, ye).call(this); - }; - this.addCommands({ - cmd: () => { - gt(lt); - }, - undo: () => { - gt(H); - }, - mustExec: !1 - }), W(this, k, ye).call(this); - } - shouldGetKeyboardEvents() { - return this.isInEditMode(); - } - enterInEditMode() { - this.enableEditMode(), this.editorDiv.focus(); - } - dblclick(H) { - this.enterInEditMode(); - } - keydown(H) { - H.target === this.div && H.key === "Enter" && (this.enterInEditMode(), H.preventDefault()); - } - editorDivKeydown(H) { - V._keyboardManager.exec(this, H); - } - editorDivFocus(H) { - this.isEditing = !0; - } - editorDivBlur(H) { - this.isEditing = !1; - } - editorDivInput(H) { - this.parent.div.classList.toggle("freeTextEditing", this.isEmpty()); - } - disableEditing() { - this.editorDiv.setAttribute("role", "comment"), this.editorDiv.removeAttribute("aria-multiline"); - } - enableEditing() { - this.editorDiv.setAttribute("role", "textbox"), this.editorDiv.setAttribute("aria-multiline", !0); - } - render() { - if (this.div) - return this.div; - let H, lt; - this.width && (H = this.x, lt = this.y), super.render(), this.editorDiv = document.createElement("div"), this.editorDiv.className = "internal", this.editorDiv.setAttribute("id", t(this, v)), this.enableEditing(), rt.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then((wt) => { - var xt; - return (xt = this.editorDiv) == null ? void 0 : xt.setAttribute("aria-label", wt); - }), rt.AnnotationEditor._l10nPromise.get("free_text2_default_content").then((wt) => { - var xt; - return (xt = this.editorDiv) == null ? void 0 : xt.setAttribute("default-content", wt); - }), this.editorDiv.contentEditable = !0; - const { - style: gt - } = this.editorDiv; - if (gt.fontSize = `calc(${t(this, A)}px * var(--scale-factor))`, gt.color = t(this, I), this.div.append(this.editorDiv), this.overlayDiv = document.createElement("div"), this.overlayDiv.classList.add("overlay", "enabled"), this.div.append(this.overlayDiv), (0, P.bindEvents)(this, this.div, ["dblclick", "keydown"]), this.width) { - const [wt, xt] = this.parentDimensions; - if (this.annotationElementId) { - const { - position: S - } = t(this, u); - let [i, n] = this.getInitialTranslation(); - [i, n] = this.pageTranslationToScreen(i, n); - const [s, o] = this.pageDimensions, [h, b] = this.pageTranslation; - let M, N; - switch (this.rotation) { - case 0: - M = H + (S[0] - h) / s, N = lt + this.height - (S[1] - b) / o; - break; - case 90: - M = H + (S[0] - h) / s, N = lt - (S[1] - b) / o, [i, n] = [n, -i]; - break; - case 180: - M = H - this.width + (S[0] - h) / s, N = lt - (S[1] - b) / o, [i, n] = [-i, -n]; - break; - case 270: - M = H + (S[0] - h - this.height * o) / s, N = lt + (S[1] - b - this.width * s) / o, [i, n] = [-n, i]; - break; - } - this.setAt(M * wt, N * xt, i, n); - } else - this.setAt(H * wt, lt * xt, this.width * wt, this.height * xt); - W(this, r, ni).call(this), this._isDraggable = !0, this.editorDiv.contentEditable = !1; - } else - this._isDraggable = !1, this.editorDiv.contentEditable = !0; - return this.div; - } - get contentDiv() { - return this.editorDiv; - } - static deserialize(H, lt, gt) { - let wt = null; - if (H instanceof X.FreeTextAnnotationElement) { - const { - data: { - defaultAppearanceData: { - fontSize: S, - fontColor: i - }, - rect: n, - rotation: s, - id: o - }, - textContent: h, - textPosition: b, - parent: { - page: { - pageNumber: M - } - } - } = H; - if (!h || h.length === 0) - return null; - wt = H = { - annotationType: l.AnnotationEditorType.FREETEXT, - color: Array.from(i), - fontSize: S, - value: h.join(` -`), - position: b, - pageIndex: M - 1, - rect: n, - rotation: s, - id: o, - deleted: !1 - }; - } - const xt = super.deserialize(H, lt, gt); - return Z(xt, A, H.fontSize), Z(xt, I, l.Util.makeHexColor(...H.color)), Z(xt, x, H.value), xt.annotationElementId = H.id || null, Z(xt, u, wt), xt; - } - serialize(H = !1) { - if (this.isEmpty()) - return null; - if (this.deleted) - return { - pageIndex: this.pageIndex, - id: this.annotationElementId, - deleted: !0 - }; - const lt = V._internalPadding * this.parentScale, gt = this.getRect(lt, lt), wt = rt.AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : t(this, I)), xt = { - annotationType: l.AnnotationEditorType.FREETEXT, - color: wt, - fontSize: t(this, A), - value: t(this, x), - pageIndex: this.pageIndex, - rect: gt, - rotation: this.rotation, - structTreeParentId: this._structTreeParentId - }; - return H ? xt : this.annotationElementId && !W(this, m, Di).call(this, xt) ? null : (xt.id = this.annotationElementId, xt); - } - }; - B = new WeakMap(), F = new WeakMap(), g = new WeakMap(), O = new WeakMap(), I = new WeakMap(), x = new WeakMap(), v = new WeakMap(), A = new WeakMap(), u = new WeakMap(), _ = new WeakSet(), Fi = function(H) { - const lt = (wt) => { - this.editorDiv.style.fontSize = `calc(${wt}px * var(--scale-factor))`, this.translate(0, -(wt - t(this, A)) * this.parentScale), Z(this, A, wt), W(this, k, ye).call(this); - }, gt = t(this, A); - this.addCommands({ - cmd: () => { - lt(H); - }, - undo: () => { - lt(gt); - }, - mustExec: !0, - type: l.AnnotationEditorParamsType.FREETEXT_SIZE, - overwriteIfSameType: !0, - keepUndo: !0 - }); - }, C = new WeakSet(), Mi = function(H) { - const lt = t(this, I); - this.addCommands({ - cmd: () => { - Z(this, I, this.editorDiv.style.color = H); - }, - undo: () => { - Z(this, I, this.editorDiv.style.color = lt); - }, - mustExec: !0, - type: l.AnnotationEditorParamsType.FREETEXT_COLOR, - overwriteIfSameType: !0, - keepUndo: !0 - }); - }, a = new WeakSet(), Ri = function() { - const H = this.editorDiv.getElementsByTagName("div"); - if (H.length === 0) - return this.editorDiv.innerText; - const lt = []; - for (const gt of H) - lt.push(gt.innerText.replace(/\r\n?|\n/, "")); - return lt.join(` -`); - }, k = new WeakSet(), ye = function() { - const [H, lt] = this.parentDimensions; - let gt; - if (this.isAttachedToDOM) - gt = this.div.getBoundingClientRect(); - else { - const { - currentLayer: wt, - div: xt - } = this, S = xt.style.display; - xt.style.display = "hidden", wt.div.append(this.div), gt = xt.getBoundingClientRect(), xt.remove(), xt.style.display = S; - } - this.rotation % 180 === this.parentRotation % 180 ? (this.width = gt.width / H, this.height = gt.height / lt) : (this.width = gt.height / H, this.height = gt.width / lt), this.fixAndSetPosition(); - }, r = new WeakSet(), ni = function() { - if (this.editorDiv.replaceChildren(), !!t(this, x)) - for (const H of t(this, x).split(` -`)) { - const lt = document.createElement("div"); - lt.append(H ? document.createTextNode(H) : document.createElement("br")), this.editorDiv.append(lt); - } - }, m = new WeakSet(), Di = function(H) { - const { - value: lt, - fontSize: gt, - color: wt, - rect: xt, - pageIndex: S - } = t(this, u); - return H.value !== lt || H.fontSize !== gt || H.rect.some((i, n) => Math.abs(i - xt[n]) >= 1) || H.color.some((i, n) => i !== wt[n]) || H.pageIndex !== S; - }, z = new WeakSet(), ri = function(H = !1) { - if (!this.annotationElementId) - return; - if (W(this, k, ye).call(this), !H && (this.width === 0 || this.height === 0)) { - setTimeout(() => W(this, z, ri).call(this, !0), 0); - return; - } - const lt = V._internalPadding * this.parentScale; - t(this, u).rect = this.getRect(lt, lt); - }, ee(V, "_freeTextDefaultContent", ""), ee(V, "_internalPadding", 0), ee(V, "_defaultColor", null), ee(V, "_defaultFontSize", 10), ee(V, "_type", "freetext"); - let pt = V; - d.FreeTextEditor = pt; - }, - /* 29 */ - /***/ - (dt, d, et) => { - var n, o, ce, b, Ii, N, tt, Q, nt, ct, yt, ut, Ft, Bt, St, Dt, ft, K, J, ht, Et, Ct, jt, Li, Ht, Fe, Vt, ai, $t, oi, Y, G, bt, At, te, Zt, $, li, Lt, Tt, Ot, Nt, Oi, _t, ci; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.StampAnnotationElement = d.InkAnnotationElement = d.FreeTextAnnotationElement = d.AnnotationLayer = void 0; - var l = et(1), P = et(6), rt = et(3), X = et(30), pt = et(31), B = et(32); - const F = 1e3, g = 9, O = /* @__PURE__ */ new WeakSet(); - function I(It) { - return { - width: It[2] - It[0], - height: It[3] - It[1] - }; - } - class x { - static create(R) { - switch (R.data.annotationType) { - case l.AnnotationType.LINK: - return new A(R); - case l.AnnotationType.TEXT: - return new u(R); - case l.AnnotationType.WIDGET: - switch (R.data.fieldType) { - case "Tx": - return new w(R); - case "Btn": - return R.data.radioButton ? new a(R) : R.data.checkBox ? new y(R) : new c(R); - case "Ch": - return new k(R); - case "Sig": - return new C(R); - } - return new _(R); - case l.AnnotationType.POPUP: - return new p(R); - case l.AnnotationType.FREETEXT: - return new T(R); - case l.AnnotationType.LINE: - return new m(R); - case l.AnnotationType.SQUARE: - return new U(R); - case l.AnnotationType.CIRCLE: - return new z(R); - case l.AnnotationType.POLYLINE: - return new E(R); - case l.AnnotationType.CARET: - return new st(R); - case l.AnnotationType.INK: - return new at(R); - case l.AnnotationType.POLYGON: - return new V(R); - case l.AnnotationType.HIGHLIGHT: - return new H(R); - case l.AnnotationType.UNDERLINE: - return new lt(R); - case l.AnnotationType.SQUIGGLY: - return new gt(R); - case l.AnnotationType.STRIKEOUT: - return new wt(R); - case l.AnnotationType.STAMP: - return new xt(R); - case l.AnnotationType.FILEATTACHMENT: - return new S(R); - default: - return new v(R); - } - } - } - const s = class s { - constructor(R, { - isRenderable: e = !1, - ignoreBorder: f = !1, - createQuadrilaterals: D = !1 - } = {}) { - L(this, n, !1); - this.isRenderable = e, this.data = R.data, this.layer = R.layer, this.linkService = R.linkService, this.downloadManager = R.downloadManager, this.imageResourcesPath = R.imageResourcesPath, this.renderForms = R.renderForms, this.svgFactory = R.svgFactory, this.annotationStorage = R.annotationStorage, this.enableScripting = R.enableScripting, this.hasJSActions = R.hasJSActions, this._fieldObjects = R.fieldObjects, this.parent = R.parent, e && (this.container = this._createContainer(f)), D && this._createQuadrilaterals(); - } - static _hasPopupData({ - titleObj: R, - contentsObj: e, - richText: f - }) { - return !!(R != null && R.str || e != null && e.str || f != null && f.str); - } - get hasPopupData() { - return s._hasPopupData(this.data); - } - _createContainer(R) { - const { - data: e, - parent: { - page: f, - viewport: D - } - } = this, j = document.createElement("section"); - j.setAttribute("data-annotation-id", e.id), this instanceof _ || (j.tabIndex = F), j.style.zIndex = this.parent.zIndex++, this.data.popupRef && j.setAttribute("aria-haspopup", "dialog"), e.noRotate && j.classList.add("norotate"); - const { - pageWidth: q, - pageHeight: it, - pageX: mt, - pageY: kt - } = D.rawDims; - if (!e.rect || this instanceof p) { - const { - rotation: Ut - } = e; - return !e.hasOwnCanvas && Ut !== 0 && this.setRotation(Ut, j), j; - } - const { - width: Pt, - height: zt - } = I(e.rect), Mt = l.Util.normalizeRect([e.rect[0], f.view[3] - e.rect[1] + f.view[1], e.rect[2], f.view[3] - e.rect[3] + f.view[1]]); - if (!R && e.borderStyle.width > 0) { - j.style.borderWidth = `${e.borderStyle.width}px`; - const Ut = e.borderStyle.horizontalCornerRadius, qt = e.borderStyle.verticalCornerRadius; - if (Ut > 0 || qt > 0) { - const Qt = `calc(${Ut}px * var(--scale-factor)) / calc(${qt}px * var(--scale-factor))`; - j.style.borderRadius = Qt; - } else if (this instanceof a) { - const Qt = `calc(${Pt}px * var(--scale-factor)) / calc(${zt}px * var(--scale-factor))`; - j.style.borderRadius = Qt; - } - switch (e.borderStyle.style) { - case l.AnnotationBorderStyleType.SOLID: - j.style.borderStyle = "solid"; - break; - case l.AnnotationBorderStyleType.DASHED: - j.style.borderStyle = "dashed"; - break; - case l.AnnotationBorderStyleType.BEVELED: - (0, l.warn)("Unimplemented border style: beveled"); - break; - case l.AnnotationBorderStyleType.INSET: - (0, l.warn)("Unimplemented border style: inset"); - break; - case l.AnnotationBorderStyleType.UNDERLINE: - j.style.borderBottomStyle = "solid"; - break; - } - const Kt = e.borderColor || null; - Kt ? (Z(this, n, !0), j.style.borderColor = l.Util.makeHexColor(Kt[0] | 0, Kt[1] | 0, Kt[2] | 0)) : j.style.borderWidth = 0; - } - j.style.left = `${100 * (Mt[0] - mt) / q}%`, j.style.top = `${100 * (Mt[1] - kt) / it}%`; - const { - rotation: Rt - } = e; - return e.hasOwnCanvas || Rt === 0 ? (j.style.width = `${100 * Pt / q}%`, j.style.height = `${100 * zt / it}%`) : this.setRotation(Rt, j), j; - } - setRotation(R, e = this.container) { - if (!this.data.rect) - return; - const { - pageWidth: f, - pageHeight: D - } = this.parent.viewport.rawDims, { - width: j, - height: q - } = I(this.data.rect); - let it, mt; - R % 180 === 0 ? (it = 100 * j / f, mt = 100 * q / D) : (it = 100 * q / f, mt = 100 * j / D), e.style.width = `${it}%`, e.style.height = `${mt}%`, e.setAttribute("data-main-rotation", (360 - R) % 360); - } - get _commonActions() { - const R = (e, f, D) => { - const j = D.detail[e], q = j[0], it = j.slice(1); - D.target.style[f] = X.ColorConverters[`${q}_HTML`](it), this.annotationStorage.setValue(this.data.id, { - [f]: X.ColorConverters[`${q}_rgb`](it) - }); - }; - return (0, l.shadow)(this, "_commonActions", { - display: (e) => { - const { - display: f - } = e.detail, D = f % 2 === 1; - this.container.style.visibility = D ? "hidden" : "visible", this.annotationStorage.setValue(this.data.id, { - noView: D, - noPrint: f === 1 || f === 2 - }); - }, - print: (e) => { - this.annotationStorage.setValue(this.data.id, { - noPrint: !e.detail.print - }); - }, - hidden: (e) => { - const { - hidden: f - } = e.detail; - this.container.style.visibility = f ? "hidden" : "visible", this.annotationStorage.setValue(this.data.id, { - noPrint: f, - noView: f - }); - }, - focus: (e) => { - setTimeout(() => e.target.focus({ - preventScroll: !1 - }), 0); - }, - userName: (e) => { - e.target.title = e.detail.userName; - }, - readonly: (e) => { - e.target.disabled = e.detail.readonly; - }, - required: (e) => { - this._setRequired(e.target, e.detail.required); - }, - bgColor: (e) => { - R("bgColor", "backgroundColor", e); - }, - fillColor: (e) => { - R("fillColor", "backgroundColor", e); - }, - fgColor: (e) => { - R("fgColor", "color", e); - }, - textColor: (e) => { - R("textColor", "color", e); - }, - borderColor: (e) => { - R("borderColor", "borderColor", e); - }, - strokeColor: (e) => { - R("strokeColor", "borderColor", e); - }, - rotation: (e) => { - const f = e.detail.rotation; - this.setRotation(f), this.annotationStorage.setValue(this.data.id, { - rotation: f - }); - } - }); - } - _dispatchEventFromSandbox(R, e) { - const f = this._commonActions; - for (const D of Object.keys(e.detail)) { - const j = R[D] || f[D]; - j == null || j(e); - } - } - _setDefaultPropertiesFromJS(R) { - if (!this.enableScripting) - return; - const e = this.annotationStorage.getRawValue(this.data.id); - if (!e) - return; - const f = this._commonActions; - for (const [D, j] of Object.entries(e)) { - const q = f[D]; - if (q) { - const it = { - detail: { - [D]: j - }, - target: R - }; - q(it), delete e[D]; - } - } - } - _createQuadrilaterals() { - if (!this.container) - return; - const { - quadPoints: R - } = this.data; - if (!R) - return; - const [e, f, D, j] = this.data.rect; - if (R.length === 1) { - const [, { - x: qt, - y: Kt - }, { - x: Qt, - y: se - }] = R[0]; - if (D === qt && j === Kt && e === Qt && f === se) - return; - } - const { - style: q - } = this.container; - let it; - if (t(this, n)) { - const { - borderColor: qt, - borderWidth: Kt - } = q; - q.borderWidth = 0, it = ["url('data:image/svg+xml;utf8,", '', ``], this.container.classList.add("hasBorder"); - } - const mt = D - e, kt = j - f, { - svgFactory: Pt - } = this, zt = Pt.createElement("svg"); - zt.classList.add("quadrilateralsContainer"), zt.setAttribute("width", 0), zt.setAttribute("height", 0); - const Mt = Pt.createElement("defs"); - zt.append(Mt); - const Rt = Pt.createElement("clipPath"), Ut = `clippath_${this.data.id}`; - Rt.setAttribute("id", Ut), Rt.setAttribute("clipPathUnits", "objectBoundingBox"), Mt.append(Rt); - for (const [, { - x: qt, - y: Kt - }, { - x: Qt, - y: se - }] of R) { - const ie = Pt.createElement("rect"), ne = (Qt - e) / mt, oe = (j - Kt) / kt, le = (qt - Qt) / mt, _i = (Kt - se) / kt; - ie.setAttribute("x", ne), ie.setAttribute("y", oe), ie.setAttribute("width", le), ie.setAttribute("height", _i), Rt.append(ie), it == null || it.push(``); - } - t(this, n) && (it.push("')"), q.backgroundImage = it.join("")), this.container.append(zt), this.container.style.clipPath = `url(#${Ut})`; - } - _createPopup() { - const { - container: R, - data: e - } = this; - R.setAttribute("aria-haspopup", "dialog"); - const f = new p({ - data: { - color: e.color, - titleObj: e.titleObj, - modificationDate: e.modificationDate, - contentsObj: e.contentsObj, - richText: e.richText, - parentRect: e.rect, - borderStyle: 0, - id: `popup_${e.id}`, - rotation: e.rotation - }, - parent: this.parent, - elements: [this] - }); - this.parent.div.append(f.render()); - } - render() { - (0, l.unreachable)("Abstract method `AnnotationElement.render` called"); - } - _getElementsByName(R, e = null) { - const f = []; - if (this._fieldObjects) { - const D = this._fieldObjects[R]; - if (D) - for (const { - page: j, - id: q, - exportValues: it - } of D) { - if (j === -1 || q === e) - continue; - const mt = typeof it == "string" ? it : null, kt = document.querySelector(`[data-element-id="${q}"]`); - if (kt && !O.has(kt)) { - (0, l.warn)(`_getElementsByName - element not allowed: ${q}`); - continue; - } - f.push({ - id: q, - exportValue: mt, - domElement: kt - }); - } - return f; - } - for (const D of document.getElementsByName(R)) { - const { - exportValue: j - } = D, q = D.getAttribute("data-element-id"); - q !== e && O.has(D) && f.push({ - id: q, - exportValue: j, - domElement: D - }); - } - return f; - } - show() { - var R; - this.container && (this.container.hidden = !1), (R = this.popup) == null || R.maybeShow(); - } - hide() { - var R; - this.container && (this.container.hidden = !0), (R = this.popup) == null || R.forceHide(); - } - getElementsToTriggerPopup() { - return this.container; - } - addHighlightArea() { - const R = this.getElementsToTriggerPopup(); - if (Array.isArray(R)) - for (const e of R) - e.classList.add("highlightArea"); - else - R.classList.add("highlightArea"); - } - _editOnDoubleClick() { - const { - annotationEditorType: R, - data: { - id: e - } - } = this; - this.container.addEventListener("dblclick", () => { - var f; - (f = this.linkService.eventBus) == null || f.dispatch("switchannotationeditormode", { - source: this, - mode: R, - editId: e - }); - }); - } - }; - n = new WeakMap(); - let v = s; - class A extends v { - constructor(e, f = null) { - super(e, { - isRenderable: !0, - ignoreBorder: !!(f != null && f.ignoreBorder), - createQuadrilaterals: !0 - }); - L(this, o); - L(this, b); - this.isTooltipOnly = e.data.isTooltipOnly; - } - render() { - const { - data: e, - linkService: f - } = this, D = document.createElement("a"); - D.setAttribute("data-element-id", e.id); - let j = !1; - return e.url ? (f.addLinkAttributes(D, e.url, e.newWindow), j = !0) : e.action ? (this._bindNamedAction(D, e.action), j = !0) : e.attachment ? (this._bindAttachment(D, e.attachment), j = !0) : e.setOCGState ? (W(this, b, Ii).call(this, D, e.setOCGState), j = !0) : e.dest ? (this._bindLink(D, e.dest), j = !0) : (e.actions && (e.actions.Action || e.actions["Mouse Up"] || e.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions && (this._bindJSAction(D, e), j = !0), e.resetForm ? (this._bindResetFormAction(D, e.resetForm), j = !0) : this.isTooltipOnly && !j && (this._bindLink(D, ""), j = !0)), this.container.classList.add("linkAnnotation"), j && this.container.append(D), this.container; - } - _bindLink(e, f) { - e.href = this.linkService.getDestinationHash(f), e.onclick = () => (f && this.linkService.goToDestination(f), !1), (f || f === "") && W(this, o, ce).call(this); - } - _bindNamedAction(e, f) { - e.href = this.linkService.getAnchorUrl(""), e.onclick = () => (this.linkService.executeNamedAction(f), !1), W(this, o, ce).call(this); - } - _bindAttachment(e, f) { - e.href = this.linkService.getAnchorUrl(""), e.onclick = () => { - var D; - return (D = this.downloadManager) == null || D.openOrDownloadData(this.container, f.content, f.filename), !1; - }, W(this, o, ce).call(this); - } - _bindJSAction(e, f) { - e.href = this.linkService.getAnchorUrl(""); - const D = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]); - for (const j of Object.keys(f.actions)) { - const q = D.get(j); - q && (e[q] = () => { - var it; - return (it = this.linkService.eventBus) == null || it.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: f.id, - name: j - } - }), !1; - }); - } - e.onclick || (e.onclick = () => !1), W(this, o, ce).call(this); - } - _bindResetFormAction(e, f) { - const D = e.onclick; - if (D || (e.href = this.linkService.getAnchorUrl("")), W(this, o, ce).call(this), !this._fieldObjects) { - (0, l.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), D || (e.onclick = () => !1); - return; - } - e.onclick = () => { - var zt; - D == null || D(); - const { - fields: j, - refs: q, - include: it - } = f, mt = []; - if (j.length !== 0 || q.length !== 0) { - const Mt = new Set(q); - for (const Rt of j) { - const Ut = this._fieldObjects[Rt] || []; - for (const { - id: qt - } of Ut) - Mt.add(qt); - } - for (const Rt of Object.values(this._fieldObjects)) - for (const Ut of Rt) - Mt.has(Ut.id) === it && mt.push(Ut); - } else - for (const Mt of Object.values(this._fieldObjects)) - mt.push(...Mt); - const kt = this.annotationStorage, Pt = []; - for (const Mt of mt) { - const { - id: Rt - } = Mt; - switch (Pt.push(Rt), Mt.type) { - case "text": { - const qt = Mt.defaultValue || ""; - kt.setValue(Rt, { - value: qt - }); - break; - } - case "checkbox": - case "radiobutton": { - const qt = Mt.defaultValue === Mt.exportValues; - kt.setValue(Rt, { - value: qt - }); - break; - } - case "combobox": - case "listbox": { - const qt = Mt.defaultValue || ""; - kt.setValue(Rt, { - value: qt - }); - break; - } - default: - continue; - } - const Ut = document.querySelector(`[data-element-id="${Rt}"]`); - if (Ut) { - if (!O.has(Ut)) { - (0, l.warn)(`_bindResetFormAction - element not allowed: ${Rt}`); - continue; - } - } else - continue; - Ut.dispatchEvent(new Event("resetform")); - } - return this.enableScripting && ((zt = this.linkService.eventBus) == null || zt.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: "app", - ids: Pt, - name: "ResetForm" - } - })), !1; - }; - } - } - o = new WeakSet(), ce = function() { - this.container.setAttribute("data-internal-link", ""); - }, b = new WeakSet(), Ii = function(e, f) { - e.href = this.linkService.getAnchorUrl(""), e.onclick = () => (this.linkService.executeSetOCGState(f), !1), W(this, o, ce).call(this); - }; - class u extends v { - constructor(R) { - super(R, { - isRenderable: !0 - }); - } - render() { - this.container.classList.add("textAnnotation"); - const R = document.createElement("img"); - return R.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg", R.alt = "[{{type}} Annotation]", R.dataset.l10nId = "text_annotation_type", R.dataset.l10nArgs = JSON.stringify({ - type: this.data.name - }), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.append(R), this.container; - } - } - class _ extends v { - render() { - return this.data.alternativeText && (this.container.title = this.data.alternativeText), this.container; - } - showElementAndHideCanvas(R) { - var e; - this.data.hasOwnCanvas && (((e = R.previousSibling) == null ? void 0 : e.nodeName) === "CANVAS" && (R.previousSibling.hidden = !0), R.hidden = !1); - } - _getKeyModifier(R) { - const { - isWin: e, - isMac: f - } = l.FeatureTest.platform; - return e && R.ctrlKey || f && R.metaKey; - } - _setEventListener(R, e, f, D, j) { - f.includes("mouse") ? R.addEventListener(f, (q) => { - var it; - (it = this.linkService.eventBus) == null || it.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: this.data.id, - name: D, - value: j(q), - shift: q.shiftKey, - modifier: this._getKeyModifier(q) - } - }); - }) : R.addEventListener(f, (q) => { - var it; - if (f === "blur") { - if (!e.focused || !q.relatedTarget) - return; - e.focused = !1; - } else if (f === "focus") { - if (e.focused) - return; - e.focused = !0; - } - j && ((it = this.linkService.eventBus) == null || it.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: this.data.id, - name: D, - value: j(q) - } - })); - }); - } - _setEventListeners(R, e, f, D) { - var j, q, it; - for (const [mt, kt] of f) - (kt === "Action" || (j = this.data.actions) != null && j[kt]) && ((kt === "Focus" || kt === "Blur") && (e || (e = { - focused: !1 - })), this._setEventListener(R, e, mt, kt, D), kt === "Focus" && !((q = this.data.actions) != null && q.Blur) ? this._setEventListener(R, e, "blur", "Blur", null) : kt === "Blur" && !((it = this.data.actions) != null && it.Focus) && this._setEventListener(R, e, "focus", "Focus", null)); - } - _setBackgroundColor(R) { - const e = this.data.backgroundColor || null; - R.style.backgroundColor = e === null ? "transparent" : l.Util.makeHexColor(e[0], e[1], e[2]); - } - _setTextStyle(R) { - const e = ["left", "center", "right"], { - fontColor: f - } = this.data.defaultAppearanceData, D = this.data.defaultAppearanceData.fontSize || g, j = R.style; - let q; - const it = 2, mt = (kt) => Math.round(10 * kt) / 10; - if (this.data.multiLine) { - const kt = Math.abs(this.data.rect[3] - this.data.rect[1] - it), Pt = Math.round(kt / (l.LINE_FACTOR * D)) || 1, zt = kt / Pt; - q = Math.min(D, mt(zt / l.LINE_FACTOR)); - } else { - const kt = Math.abs(this.data.rect[3] - this.data.rect[1] - it); - q = Math.min(D, mt(kt / l.LINE_FACTOR)); - } - j.fontSize = `calc(${q}px * var(--scale-factor))`, j.color = l.Util.makeHexColor(f[0], f[1], f[2]), this.data.textAlignment !== null && (j.textAlign = e[this.data.textAlignment]); - } - _setRequired(R, e) { - e ? R.setAttribute("required", !0) : R.removeAttribute("required"), R.setAttribute("aria-required", e); - } - } - class w extends _ { - constructor(R) { - const e = R.renderForms || !R.data.hasAppearance && !!R.data.fieldValue; - super(R, { - isRenderable: e - }); - } - setPropertyOnSiblings(R, e, f, D) { - const j = this.annotationStorage; - for (const q of this._getElementsByName(R.name, R.id)) - q.domElement && (q.domElement[e] = f), j.setValue(q.id, { - [D]: f - }); - } - render() { - var D, j; - const R = this.annotationStorage, e = this.data.id; - this.container.classList.add("textWidgetAnnotation"); - let f = null; - if (this.renderForms) { - const q = R.getValue(e, { - value: this.data.fieldValue - }); - let it = q.value || ""; - const mt = R.getValue(e, { - charLimit: this.data.maxLen - }).charLimit; - mt && it.length > mt && (it = it.slice(0, mt)); - let kt = q.formattedValue || ((D = this.data.textContent) == null ? void 0 : D.join(` -`)) || null; - kt && this.data.comb && (kt = kt.replaceAll(/\s+/g, "")); - const Pt = { - userValue: it, - formattedValue: kt, - lastCommittedValue: null, - commitKey: 1, - focused: !1 - }; - this.data.multiLine ? (f = document.createElement("textarea"), f.textContent = kt ?? it, this.data.doNotScroll && (f.style.overflowY = "hidden")) : (f = document.createElement("input"), f.type = "text", f.setAttribute("value", kt ?? it), this.data.doNotScroll && (f.style.overflowX = "hidden")), this.data.hasOwnCanvas && (f.hidden = !0), O.add(f), f.setAttribute("data-element-id", e), f.disabled = this.data.readOnly, f.name = this.data.fieldName, f.tabIndex = F, this._setRequired(f, this.data.required), mt && (f.maxLength = mt), f.addEventListener("input", (Mt) => { - R.setValue(e, { - value: Mt.target.value - }), this.setPropertyOnSiblings(f, "value", Mt.target.value, "value"), Pt.formattedValue = null; - }), f.addEventListener("resetform", (Mt) => { - const Rt = this.data.defaultFieldValue ?? ""; - f.value = Pt.userValue = Rt, Pt.formattedValue = null; - }); - let zt = (Mt) => { - const { - formattedValue: Rt - } = Pt; - Rt != null && (Mt.target.value = Rt), Mt.target.scrollLeft = 0; - }; - if (this.enableScripting && this.hasJSActions) { - f.addEventListener("focus", (Rt) => { - if (Pt.focused) - return; - const { - target: Ut - } = Rt; - Pt.userValue && (Ut.value = Pt.userValue), Pt.lastCommittedValue = Ut.value, Pt.commitKey = 1, Pt.focused = !0; - }), f.addEventListener("updatefromsandbox", (Rt) => { - this.showElementAndHideCanvas(Rt.target); - const Ut = { - value(qt) { - Pt.userValue = qt.detail.value ?? "", R.setValue(e, { - value: Pt.userValue.toString() - }), qt.target.value = Pt.userValue; - }, - formattedValue(qt) { - const { - formattedValue: Kt - } = qt.detail; - Pt.formattedValue = Kt, Kt != null && qt.target !== document.activeElement && (qt.target.value = Kt), R.setValue(e, { - formattedValue: Kt - }); - }, - selRange(qt) { - qt.target.setSelectionRange(...qt.detail.selRange); - }, - charLimit: (qt) => { - var ie; - const { - charLimit: Kt - } = qt.detail, { - target: Qt - } = qt; - if (Kt === 0) { - Qt.removeAttribute("maxLength"); - return; - } - Qt.setAttribute("maxLength", Kt); - let se = Pt.userValue; - !se || se.length <= Kt || (se = se.slice(0, Kt), Qt.value = Pt.userValue = se, R.setValue(e, { - value: se - }), (ie = this.linkService.eventBus) == null || ie.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: e, - name: "Keystroke", - value: se, - willCommit: !0, - commitKey: 1, - selStart: Qt.selectionStart, - selEnd: Qt.selectionEnd - } - })); - } - }; - this._dispatchEventFromSandbox(Ut, Rt); - }), f.addEventListener("keydown", (Rt) => { - var Kt; - Pt.commitKey = 1; - let Ut = -1; - if (Rt.key === "Escape" ? Ut = 0 : Rt.key === "Enter" && !this.data.multiLine ? Ut = 2 : Rt.key === "Tab" && (Pt.commitKey = 3), Ut === -1) - return; - const { - value: qt - } = Rt.target; - Pt.lastCommittedValue !== qt && (Pt.lastCommittedValue = qt, Pt.userValue = qt, (Kt = this.linkService.eventBus) == null || Kt.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: e, - name: "Keystroke", - value: qt, - willCommit: !0, - commitKey: Ut, - selStart: Rt.target.selectionStart, - selEnd: Rt.target.selectionEnd - } - })); - }); - const Mt = zt; - zt = null, f.addEventListener("blur", (Rt) => { - var qt; - if (!Pt.focused || !Rt.relatedTarget) - return; - Pt.focused = !1; - const { - value: Ut - } = Rt.target; - Pt.userValue = Ut, Pt.lastCommittedValue !== Ut && ((qt = this.linkService.eventBus) == null || qt.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: e, - name: "Keystroke", - value: Ut, - willCommit: !0, - commitKey: Pt.commitKey, - selStart: Rt.target.selectionStart, - selEnd: Rt.target.selectionEnd - } - })), Mt(Rt); - }), (j = this.data.actions) != null && j.Keystroke && f.addEventListener("beforeinput", (Rt) => { - var oe; - Pt.lastCommittedValue = null; - const { - data: Ut, - target: qt - } = Rt, { - value: Kt, - selectionStart: Qt, - selectionEnd: se - } = qt; - let ie = Qt, ne = se; - switch (Rt.inputType) { - case "deleteWordBackward": { - const le = Kt.substring(0, Qt).match(/\w*[^\w]*$/); - le && (ie -= le[0].length); - break; - } - case "deleteWordForward": { - const le = Kt.substring(Qt).match(/^[^\w]*\w*/); - le && (ne += le[0].length); - break; - } - case "deleteContentBackward": - Qt === se && (ie -= 1); - break; - case "deleteContentForward": - Qt === se && (ne += 1); - break; - } - Rt.preventDefault(), (oe = this.linkService.eventBus) == null || oe.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: e, - name: "Keystroke", - value: Kt, - change: Ut || "", - willCommit: !1, - selStart: ie, - selEnd: ne - } - }); - }), this._setEventListeners(f, Pt, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (Rt) => Rt.target.value); - } - if (zt && f.addEventListener("blur", zt), this.data.comb) { - const Rt = (this.data.rect[2] - this.data.rect[0]) / mt; - f.classList.add("comb"), f.style.letterSpacing = `calc(${Rt}px * var(--scale-factor) - 1ch)`; - } - } else - f = document.createElement("div"), f.textContent = this.data.fieldValue, f.style.verticalAlign = "middle", f.style.display = "table-cell"; - return this._setTextStyle(f), this._setBackgroundColor(f), this._setDefaultPropertiesFromJS(f), this.container.append(f), this.container; - } - } - class C extends _ { - constructor(R) { - super(R, { - isRenderable: !!R.data.hasOwnCanvas - }); - } - } - class y extends _ { - constructor(R) { - super(R, { - isRenderable: R.renderForms - }); - } - render() { - const R = this.annotationStorage, e = this.data, f = e.id; - let D = R.getValue(f, { - value: e.exportValue === e.fieldValue - }).value; - typeof D == "string" && (D = D !== "Off", R.setValue(f, { - value: D - })), this.container.classList.add("buttonWidgetAnnotation", "checkBox"); - const j = document.createElement("input"); - return O.add(j), j.setAttribute("data-element-id", f), j.disabled = e.readOnly, this._setRequired(j, this.data.required), j.type = "checkbox", j.name = e.fieldName, D && j.setAttribute("checked", !0), j.setAttribute("exportValue", e.exportValue), j.tabIndex = F, j.addEventListener("change", (q) => { - const { - name: it, - checked: mt - } = q.target; - for (const kt of this._getElementsByName(it, f)) { - const Pt = mt && kt.exportValue === e.exportValue; - kt.domElement && (kt.domElement.checked = Pt), R.setValue(kt.id, { - value: Pt - }); - } - R.setValue(f, { - value: mt - }); - }), j.addEventListener("resetform", (q) => { - const it = e.defaultFieldValue || "Off"; - q.target.checked = it === e.exportValue; - }), this.enableScripting && this.hasJSActions && (j.addEventListener("updatefromsandbox", (q) => { - const it = { - value(mt) { - mt.target.checked = mt.detail.value !== "Off", R.setValue(f, { - value: mt.target.checked - }); - } - }; - this._dispatchEventFromSandbox(it, q); - }), this._setEventListeners(j, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (q) => q.target.checked)), this._setBackgroundColor(j), this._setDefaultPropertiesFromJS(j), this.container.append(j), this.container; - } - } - class a extends _ { - constructor(R) { - super(R, { - isRenderable: R.renderForms - }); - } - render() { - this.container.classList.add("buttonWidgetAnnotation", "radioButton"); - const R = this.annotationStorage, e = this.data, f = e.id; - let D = R.getValue(f, { - value: e.fieldValue === e.buttonValue - }).value; - typeof D == "string" && (D = D !== e.buttonValue, R.setValue(f, { - value: D - })); - const j = document.createElement("input"); - if (O.add(j), j.setAttribute("data-element-id", f), j.disabled = e.readOnly, this._setRequired(j, this.data.required), j.type = "radio", j.name = e.fieldName, D && j.setAttribute("checked", !0), j.tabIndex = F, j.addEventListener("change", (q) => { - const { - name: it, - checked: mt - } = q.target; - for (const kt of this._getElementsByName(it, f)) - R.setValue(kt.id, { - value: !1 - }); - R.setValue(f, { - value: mt - }); - }), j.addEventListener("resetform", (q) => { - const it = e.defaultFieldValue; - q.target.checked = it != null && it === e.buttonValue; - }), this.enableScripting && this.hasJSActions) { - const q = e.buttonValue; - j.addEventListener("updatefromsandbox", (it) => { - const mt = { - value: (kt) => { - const Pt = q === kt.detail.value; - for (const zt of this._getElementsByName(kt.target.name)) { - const Mt = Pt && zt.id === f; - zt.domElement && (zt.domElement.checked = Mt), R.setValue(zt.id, { - value: Mt - }); - } - } - }; - this._dispatchEventFromSandbox(mt, it); - }), this._setEventListeners(j, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (it) => it.target.checked); - } - return this._setBackgroundColor(j), this._setDefaultPropertiesFromJS(j), this.container.append(j), this.container; - } - } - class c extends A { - constructor(R) { - super(R, { - ignoreBorder: R.data.hasAppearance - }); - } - render() { - const R = super.render(); - R.classList.add("buttonWidgetAnnotation", "pushButton"), this.data.alternativeText && (R.title = this.data.alternativeText); - const e = R.lastChild; - return this.enableScripting && this.hasJSActions && e && (this._setDefaultPropertiesFromJS(e), e.addEventListener("updatefromsandbox", (f) => { - this._dispatchEventFromSandbox({}, f); - })), R; - } - } - class k extends _ { - constructor(R) { - super(R, { - isRenderable: R.renderForms - }); - } - render() { - this.container.classList.add("choiceWidgetAnnotation"); - const R = this.annotationStorage, e = this.data.id, f = R.getValue(e, { - value: this.data.fieldValue - }), D = document.createElement("select"); - O.add(D), D.setAttribute("data-element-id", e), D.disabled = this.data.readOnly, this._setRequired(D, this.data.required), D.name = this.data.fieldName, D.tabIndex = F; - let j = this.data.combo && this.data.options.length > 0; - this.data.combo || (D.size = this.data.options.length, this.data.multiSelect && (D.multiple = !0)), D.addEventListener("resetform", (Pt) => { - const zt = this.data.defaultFieldValue; - for (const Mt of D.options) - Mt.selected = Mt.value === zt; - }); - for (const Pt of this.data.options) { - const zt = document.createElement("option"); - zt.textContent = Pt.displayValue, zt.value = Pt.exportValue, f.value.includes(Pt.exportValue) && (zt.setAttribute("selected", !0), j = !1), D.append(zt); - } - let q = null; - if (j) { - const Pt = document.createElement("option"); - Pt.value = " ", Pt.setAttribute("hidden", !0), Pt.setAttribute("selected", !0), D.prepend(Pt), q = () => { - Pt.remove(), D.removeEventListener("input", q), q = null; - }, D.addEventListener("input", q); - } - const it = (Pt) => { - const zt = Pt ? "value" : "textContent", { - options: Mt, - multiple: Rt - } = D; - return Rt ? Array.prototype.filter.call(Mt, (Ut) => Ut.selected).map((Ut) => Ut[zt]) : Mt.selectedIndex === -1 ? null : Mt[Mt.selectedIndex][zt]; - }; - let mt = it(!1); - const kt = (Pt) => { - const zt = Pt.target.options; - return Array.prototype.map.call(zt, (Mt) => ({ - displayValue: Mt.textContent, - exportValue: Mt.value - })); - }; - return this.enableScripting && this.hasJSActions ? (D.addEventListener("updatefromsandbox", (Pt) => { - const zt = { - value(Mt) { - q == null || q(); - const Rt = Mt.detail.value, Ut = new Set(Array.isArray(Rt) ? Rt : [Rt]); - for (const qt of D.options) - qt.selected = Ut.has(qt.value); - R.setValue(e, { - value: it(!0) - }), mt = it(!1); - }, - multipleSelection(Mt) { - D.multiple = !0; - }, - remove(Mt) { - const Rt = D.options, Ut = Mt.detail.remove; - Rt[Ut].selected = !1, D.remove(Ut), Rt.length > 0 && Array.prototype.findIndex.call(Rt, (Kt) => Kt.selected) === -1 && (Rt[0].selected = !0), R.setValue(e, { - value: it(!0), - items: kt(Mt) - }), mt = it(!1); - }, - clear(Mt) { - for (; D.length !== 0; ) - D.remove(0); - R.setValue(e, { - value: null, - items: [] - }), mt = it(!1); - }, - insert(Mt) { - const { - index: Rt, - displayValue: Ut, - exportValue: qt - } = Mt.detail.insert, Kt = D.children[Rt], Qt = document.createElement("option"); - Qt.textContent = Ut, Qt.value = qt, Kt ? Kt.before(Qt) : D.append(Qt), R.setValue(e, { - value: it(!0), - items: kt(Mt) - }), mt = it(!1); - }, - items(Mt) { - const { - items: Rt - } = Mt.detail; - for (; D.length !== 0; ) - D.remove(0); - for (const Ut of Rt) { - const { - displayValue: qt, - exportValue: Kt - } = Ut, Qt = document.createElement("option"); - Qt.textContent = qt, Qt.value = Kt, D.append(Qt); - } - D.options.length > 0 && (D.options[0].selected = !0), R.setValue(e, { - value: it(!0), - items: kt(Mt) - }), mt = it(!1); - }, - indices(Mt) { - const Rt = new Set(Mt.detail.indices); - for (const Ut of Mt.target.options) - Ut.selected = Rt.has(Ut.index); - R.setValue(e, { - value: it(!0) - }), mt = it(!1); - }, - editable(Mt) { - Mt.target.disabled = !Mt.detail.editable; - } - }; - this._dispatchEventFromSandbox(zt, Pt); - }), D.addEventListener("input", (Pt) => { - var Mt; - const zt = it(!0); - R.setValue(e, { - value: zt - }), Pt.preventDefault(), (Mt = this.linkService.eventBus) == null || Mt.dispatch("dispatcheventinsandbox", { - source: this, - detail: { - id: e, - name: "Keystroke", - value: mt, - changeEx: zt, - willCommit: !1, - commitKey: 1, - keyDown: !1 - } - }); - }), this._setEventListeners(D, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], (Pt) => Pt.target.value)) : D.addEventListener("input", function(Pt) { - R.setValue(e, { - value: it(!0) - }); - }), this.data.combo && this._setTextStyle(D), this._setBackgroundColor(D), this._setDefaultPropertiesFromJS(D), this.container.append(D), this.container; - } - } - class p extends v { - constructor(R) { - const { - data: e, - elements: f - } = R; - super(R, { - isRenderable: v._hasPopupData(e) - }), this.elements = f; - } - render() { - this.container.classList.add("popupAnnotation"); - const R = new r({ - container: this.container, - color: this.data.color, - titleObj: this.data.titleObj, - modificationDate: this.data.modificationDate, - contentsObj: this.data.contentsObj, - richText: this.data.richText, - rect: this.data.rect, - parentRect: this.data.parentRect || null, - parent: this.parent, - elements: this.elements, - open: this.data.open - }), e = []; - for (const f of this.elements) - f.popup = R, e.push(f.data.id), f.addHighlightArea(); - return this.container.setAttribute("aria-controls", e.map((f) => `${l.AnnotationPrefix}${f}`).join(",")), this.container; - } - } - class r { - constructor({ - container: R, - color: e, - elements: f, - titleObj: D, - modificationDate: j, - contentsObj: q, - richText: it, - parent: mt, - rect: kt, - parentRect: Pt, - open: zt - }) { - L(this, jt); - L(this, Ht); - L(this, Vt); - L(this, $t); - L(this, N, null); - L(this, tt, W(this, jt, Li).bind(this)); - L(this, Q, W(this, $t, oi).bind(this)); - L(this, nt, W(this, Vt, ai).bind(this)); - L(this, ct, W(this, Ht, Fe).bind(this)); - L(this, yt, null); - L(this, ut, null); - L(this, Ft, null); - L(this, Bt, null); - L(this, St, null); - L(this, Dt, null); - L(this, ft, !1); - L(this, K, null); - L(this, J, null); - L(this, ht, null); - L(this, Et, null); - L(this, Ct, !1); - var Rt; - Z(this, ut, R), Z(this, Et, D), Z(this, Ft, q), Z(this, ht, it), Z(this, St, mt), Z(this, yt, e), Z(this, J, kt), Z(this, Dt, Pt), Z(this, Bt, f); - const Mt = P.PDFDateString.toDateObject(j); - Mt && Z(this, N, mt.l10n.get("annotation_date_string", { - date: Mt.toLocaleDateString(), - time: Mt.toLocaleTimeString() - })), this.trigger = f.flatMap((Ut) => Ut.getElementsToTriggerPopup()); - for (const Ut of this.trigger) - Ut.addEventListener("click", t(this, ct)), Ut.addEventListener("mouseenter", t(this, nt)), Ut.addEventListener("mouseleave", t(this, Q)), Ut.classList.add("popupTriggerArea"); - for (const Ut of f) - (Rt = Ut.container) == null || Rt.addEventListener("keydown", t(this, tt)); - t(this, ut).hidden = !0, zt && W(this, Ht, Fe).call(this); - } - render() { - if (t(this, K)) - return; - const { - page: { - view: R - }, - viewport: { - rawDims: { - pageWidth: e, - pageHeight: f, - pageX: D, - pageY: j - } - } - } = t(this, St), q = Z(this, K, document.createElement("div")); - if (q.className = "popup", t(this, yt)) { - const ie = q.style.outlineColor = l.Util.makeHexColor(...t(this, yt)); - CSS.supports("background-color", "color-mix(in srgb, red 30%, white)") ? q.style.backgroundColor = `color-mix(in srgb, ${ie} 30%, white)` : q.style.backgroundColor = l.Util.makeHexColor(...t(this, yt).map((oe) => Math.floor(0.7 * (255 - oe) + oe))); - } - const it = document.createElement("span"); - it.className = "header"; - const mt = document.createElement("h1"); - if (it.append(mt), { - dir: mt.dir, - str: mt.textContent - } = t(this, Et), q.append(it), t(this, N)) { - const ie = document.createElement("span"); - ie.classList.add("popupDate"), t(this, N).then((ne) => { - ie.textContent = ne; - }), it.append(ie); - } - const kt = t(this, Ft), Pt = t(this, ht); - if (Pt != null && Pt.str && (!(kt != null && kt.str) || kt.str === Pt.str)) - B.XfaLayer.render({ - xfaHtml: Pt.html, - intent: "richText", - div: q - }), q.lastChild.classList.add("richText", "popupContent"); - else { - const ie = this._formatContents(kt); - q.append(ie); - } - let zt = !!t(this, Dt), Mt = zt ? t(this, Dt) : t(this, J); - for (const ie of t(this, Bt)) - if (!Mt || l.Util.intersect(ie.data.rect, Mt) !== null) { - Mt = ie.data.rect, zt = !0; - break; - } - const Rt = l.Util.normalizeRect([Mt[0], R[3] - Mt[1] + R[1], Mt[2], R[3] - Mt[3] + R[1]]), Ut = 5, qt = zt ? Mt[2] - Mt[0] + Ut : 0, Kt = Rt[0] + qt, Qt = Rt[1], { - style: se - } = t(this, ut); - se.left = `${100 * (Kt - D) / e}%`, se.top = `${100 * (Qt - j) / f}%`, t(this, ut).append(q); - } - _formatContents({ - str: R, - dir: e - }) { - const f = document.createElement("p"); - f.classList.add("popupContent"), f.dir = e; - const D = R.split(/(?:\r\n?|\n)/); - for (let j = 0, q = D.length; j < q; ++j) { - const it = D[j]; - f.append(document.createTextNode(it)), j < q - 1 && f.append(document.createElement("br")); - } - return f; - } - forceHide() { - Z(this, Ct, this.isVisible), t(this, Ct) && (t(this, ut).hidden = !0); - } - maybeShow() { - t(this, Ct) && (Z(this, Ct, !1), t(this, ut).hidden = !1); - } - get isVisible() { - return t(this, ut).hidden === !1; - } - } - N = new WeakMap(), tt = new WeakMap(), Q = new WeakMap(), nt = new WeakMap(), ct = new WeakMap(), yt = new WeakMap(), ut = new WeakMap(), Ft = new WeakMap(), Bt = new WeakMap(), St = new WeakMap(), Dt = new WeakMap(), ft = new WeakMap(), K = new WeakMap(), J = new WeakMap(), ht = new WeakMap(), Et = new WeakMap(), Ct = new WeakMap(), jt = new WeakSet(), Li = function(R) { - R.altKey || R.shiftKey || R.ctrlKey || R.metaKey || (R.key === "Enter" || R.key === "Escape" && t(this, ft)) && W(this, Ht, Fe).call(this); - }, Ht = new WeakSet(), Fe = function() { - Z(this, ft, !t(this, ft)), t(this, ft) ? (W(this, Vt, ai).call(this), t(this, ut).addEventListener("click", t(this, ct)), t(this, ut).addEventListener("keydown", t(this, tt))) : (W(this, $t, oi).call(this), t(this, ut).removeEventListener("click", t(this, ct)), t(this, ut).removeEventListener("keydown", t(this, tt))); - }, Vt = new WeakSet(), ai = function() { - t(this, K) || this.render(), this.isVisible ? t(this, ft) && t(this, ut).classList.add("focused") : (t(this, ut).hidden = !1, t(this, ut).style.zIndex = parseInt(t(this, ut).style.zIndex) + 1e3); - }, $t = new WeakSet(), oi = function() { - t(this, ut).classList.remove("focused"), !(t(this, ft) || !this.isVisible) && (t(this, ut).hidden = !0, t(this, ut).style.zIndex = parseInt(t(this, ut).style.zIndex) - 1e3); - }; - class T extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0 - }), this.textContent = R.data.textContent, this.textPosition = R.data.textPosition, this.annotationEditorType = l.AnnotationEditorType.FREETEXT; - } - render() { - if (this.container.classList.add("freeTextAnnotation"), this.textContent) { - const R = document.createElement("div"); - R.classList.add("annotationTextContent"), R.setAttribute("role", "comment"); - for (const e of this.textContent) { - const f = document.createElement("span"); - f.textContent = e, R.append(f); - } - this.container.append(R); - } - return !this.data.popupRef && this.hasPopupData && this._createPopup(), this._editOnDoubleClick(), this.container; - } - } - d.FreeTextAnnotationElement = T; - class m extends v { - constructor(e) { - super(e, { - isRenderable: !0, - ignoreBorder: !0 - }); - L(this, Y, null); - } - render() { - this.container.classList.add("lineAnnotation"); - const e = this.data, { - width: f, - height: D - } = I(e.rect), j = this.svgFactory.create(f, D, !0), q = Z(this, Y, this.svgFactory.createElement("svg:line")); - return q.setAttribute("x1", e.rect[2] - e.lineCoordinates[0]), q.setAttribute("y1", e.rect[3] - e.lineCoordinates[1]), q.setAttribute("x2", e.rect[2] - e.lineCoordinates[2]), q.setAttribute("y2", e.rect[3] - e.lineCoordinates[3]), q.setAttribute("stroke-width", e.borderStyle.width || 1), q.setAttribute("stroke", "transparent"), q.setAttribute("fill", "transparent"), j.append(q), this.container.append(j), !e.popupRef && this.hasPopupData && this._createPopup(), this.container; - } - getElementsToTriggerPopup() { - return t(this, Y); - } - addHighlightArea() { - this.container.classList.add("highlightArea"); - } - } - Y = new WeakMap(); - class U extends v { - constructor(e) { - super(e, { - isRenderable: !0, - ignoreBorder: !0 - }); - L(this, G, null); - } - render() { - this.container.classList.add("squareAnnotation"); - const e = this.data, { - width: f, - height: D - } = I(e.rect), j = this.svgFactory.create(f, D, !0), q = e.borderStyle.width, it = Z(this, G, this.svgFactory.createElement("svg:rect")); - return it.setAttribute("x", q / 2), it.setAttribute("y", q / 2), it.setAttribute("width", f - q), it.setAttribute("height", D - q), it.setAttribute("stroke-width", q || 1), it.setAttribute("stroke", "transparent"), it.setAttribute("fill", "transparent"), j.append(it), this.container.append(j), !e.popupRef && this.hasPopupData && this._createPopup(), this.container; - } - getElementsToTriggerPopup() { - return t(this, G); - } - addHighlightArea() { - this.container.classList.add("highlightArea"); - } - } - G = new WeakMap(); - class z extends v { - constructor(e) { - super(e, { - isRenderable: !0, - ignoreBorder: !0 - }); - L(this, bt, null); - } - render() { - this.container.classList.add("circleAnnotation"); - const e = this.data, { - width: f, - height: D - } = I(e.rect), j = this.svgFactory.create(f, D, !0), q = e.borderStyle.width, it = Z(this, bt, this.svgFactory.createElement("svg:ellipse")); - return it.setAttribute("cx", f / 2), it.setAttribute("cy", D / 2), it.setAttribute("rx", f / 2 - q / 2), it.setAttribute("ry", D / 2 - q / 2), it.setAttribute("stroke-width", q || 1), it.setAttribute("stroke", "transparent"), it.setAttribute("fill", "transparent"), j.append(it), this.container.append(j), !e.popupRef && this.hasPopupData && this._createPopup(), this.container; - } - getElementsToTriggerPopup() { - return t(this, bt); - } - addHighlightArea() { - this.container.classList.add("highlightArea"); - } - } - bt = new WeakMap(); - class E extends v { - constructor(e) { - super(e, { - isRenderable: !0, - ignoreBorder: !0 - }); - L(this, At, null); - this.containerClassName = "polylineAnnotation", this.svgElementName = "svg:polyline"; - } - render() { - this.container.classList.add(this.containerClassName); - const e = this.data, { - width: f, - height: D - } = I(e.rect), j = this.svgFactory.create(f, D, !0); - let q = []; - for (const mt of e.vertices) { - const kt = mt.x - e.rect[0], Pt = e.rect[3] - mt.y; - q.push(kt + "," + Pt); - } - q = q.join(" "); - const it = Z(this, At, this.svgFactory.createElement(this.svgElementName)); - return it.setAttribute("points", q), it.setAttribute("stroke-width", e.borderStyle.width || 1), it.setAttribute("stroke", "transparent"), it.setAttribute("fill", "transparent"), j.append(it), this.container.append(j), !e.popupRef && this.hasPopupData && this._createPopup(), this.container; - } - getElementsToTriggerPopup() { - return t(this, At); - } - addHighlightArea() { - this.container.classList.add("highlightArea"); - } - } - At = new WeakMap(); - class V extends E { - constructor(R) { - super(R), this.containerClassName = "polygonAnnotation", this.svgElementName = "svg:polygon"; - } - } - class st extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0 - }); - } - render() { - return this.container.classList.add("caretAnnotation"), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container; - } - } - class at extends v { - constructor(e) { - super(e, { - isRenderable: !0, - ignoreBorder: !0 - }); - L(this, te, []); - this.containerClassName = "inkAnnotation", this.svgElementName = "svg:polyline", this.annotationEditorType = l.AnnotationEditorType.INK; - } - render() { - this.container.classList.add(this.containerClassName); - const e = this.data, { - width: f, - height: D - } = I(e.rect), j = this.svgFactory.create(f, D, !0); - for (const q of e.inkLists) { - let it = []; - for (const kt of q) { - const Pt = kt.x - e.rect[0], zt = e.rect[3] - kt.y; - it.push(`${Pt},${zt}`); - } - it = it.join(" "); - const mt = this.svgFactory.createElement(this.svgElementName); - t(this, te).push(mt), mt.setAttribute("points", it), mt.setAttribute("stroke-width", e.borderStyle.width || 1), mt.setAttribute("stroke", "transparent"), mt.setAttribute("fill", "transparent"), !e.popupRef && this.hasPopupData && this._createPopup(), j.append(mt); - } - return this.container.append(j), this.container; - } - getElementsToTriggerPopup() { - return t(this, te); - } - addHighlightArea() { - this.container.classList.add("highlightArea"); - } - } - te = new WeakMap(), d.InkAnnotationElement = at; - class H extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0, - createQuadrilaterals: !0 - }); - } - render() { - return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("highlightAnnotation"), this.container; - } - } - class lt extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0, - createQuadrilaterals: !0 - }); - } - render() { - return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("underlineAnnotation"), this.container; - } - } - class gt extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0, - createQuadrilaterals: !0 - }); - } - render() { - return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("squigglyAnnotation"), this.container; - } - } - class wt extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0, - createQuadrilaterals: !0 - }); - } - render() { - return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("strikeoutAnnotation"), this.container; - } - } - class xt extends v { - constructor(R) { - super(R, { - isRenderable: !0, - ignoreBorder: !0 - }); - } - render() { - return this.container.classList.add("stampAnnotation"), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container; - } - } - d.StampAnnotationElement = xt; - class S extends v { - constructor(e) { - var j; - super(e, { - isRenderable: !0 - }); - L(this, $); - L(this, Zt, null); - const { - filename: f, - content: D - } = this.data.file; - this.filename = (0, P.getFilenameFromUrl)(f, !0), this.content = D, (j = this.linkService.eventBus) == null || j.dispatch("fileattachmentannotation", { - source: this, - filename: f, - content: D - }); - } - render() { - this.container.classList.add("fileAttachmentAnnotation"); - const { - container: e, - data: f - } = this; - let D; - f.hasAppearance || f.fillAlpha === 0 ? D = document.createElement("div") : (D = document.createElement("img"), D.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(f.name) ? "paperclip" : "pushpin"}.svg`, f.fillAlpha && f.fillAlpha < 1 && (D.style = `filter: opacity(${Math.round(f.fillAlpha * 100)}%);`)), D.addEventListener("dblclick", W(this, $, li).bind(this)), Z(this, Zt, D); - const { - isMac: j - } = l.FeatureTest.platform; - return e.addEventListener("keydown", (q) => { - q.key === "Enter" && (j ? q.metaKey : q.ctrlKey) && W(this, $, li).call(this); - }), !f.popupRef && this.hasPopupData ? this._createPopup() : D.classList.add("popupTriggerArea"), e.append(D), e; - } - getElementsToTriggerPopup() { - return t(this, Zt); - } - addHighlightArea() { - this.container.classList.add("highlightArea"); - } - } - Zt = new WeakMap(), $ = new WeakSet(), li = function() { - var e; - (e = this.downloadManager) == null || e.openOrDownloadData(this.container, this.content, this.filename); - }; - class i { - constructor({ - div: R, - accessibilityManager: e, - annotationCanvasMap: f, - l10n: D, - page: j, - viewport: q - }) { - L(this, Nt); - L(this, _t); - L(this, Lt, null); - L(this, Tt, null); - L(this, Ot, /* @__PURE__ */ new Map()); - this.div = R, Z(this, Lt, e), Z(this, Tt, f), this.l10n = D, this.page = j, this.viewport = q, this.zIndex = 0, this.l10n || (this.l10n = pt.NullL10n); - } - async render(R) { - const { - annotations: e - } = R, f = this.div; - (0, P.setLayerDimensions)(f, this.viewport); - const D = /* @__PURE__ */ new Map(), j = { - data: null, - layer: f, - linkService: R.linkService, - downloadManager: R.downloadManager, - imageResourcesPath: R.imageResourcesPath || "", - renderForms: R.renderForms !== !1, - svgFactory: new P.DOMSVGFactory(), - annotationStorage: R.annotationStorage || new rt.AnnotationStorage(), - enableScripting: R.enableScripting === !0, - hasJSActions: R.hasJSActions, - fieldObjects: R.fieldObjects, - parent: this, - elements: null - }; - for (const q of e) { - if (q.noHTML) - continue; - const it = q.annotationType === l.AnnotationType.POPUP; - if (it) { - const Pt = D.get(q.id); - if (!Pt) - continue; - j.elements = Pt; - } else { - const { - width: Pt, - height: zt - } = I(q.rect); - if (Pt <= 0 || zt <= 0) - continue; - } - j.data = q; - const mt = x.create(j); - if (!mt.isRenderable) - continue; - if (!it && q.popupRef) { - const Pt = D.get(q.popupRef); - Pt ? Pt.push(mt) : D.set(q.popupRef, [mt]); - } - mt.annotationEditorType > 0 && t(this, Ot).set(mt.data.id, mt); - const kt = mt.render(); - q.hidden && (kt.style.visibility = "hidden"), W(this, Nt, Oi).call(this, kt, q.id); - } - W(this, _t, ci).call(this), await this.l10n.translate(f); - } - update({ - viewport: R - }) { - const e = this.div; - this.viewport = R, (0, P.setLayerDimensions)(e, { - rotation: R.rotation - }), W(this, _t, ci).call(this), e.hidden = !1; - } - getEditableAnnotations() { - return Array.from(t(this, Ot).values()); - } - getEditableAnnotation(R) { - return t(this, Ot).get(R); - } - } - Lt = new WeakMap(), Tt = new WeakMap(), Ot = new WeakMap(), Nt = new WeakSet(), Oi = function(R, e) { - var D; - const f = R.firstChild || R; - f.id = `${l.AnnotationPrefix}${e}`, this.div.append(R), (D = t(this, Lt)) == null || D.moveElementInDOM(this.div, R, f, !1); - }, _t = new WeakSet(), ci = function() { - if (!t(this, Tt)) - return; - const R = this.div; - for (const [e, f] of t(this, Tt)) { - const D = R.querySelector(`[data-annotation-id="${e}"]`); - if (!D) - continue; - const { - firstChild: j - } = D; - j ? j.nodeName === "CANVAS" ? j.replaceWith(f) : j.before(f) : D.append(f); - } - t(this, Tt).clear(); - }, d.AnnotationLayer = i; - }, - /* 30 */ - /***/ - (dt, d) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.ColorConverters = void 0; - function et(rt) { - return Math.floor(Math.max(0, Math.min(1, rt)) * 255).toString(16).padStart(2, "0"); - } - function l(rt) { - return Math.max(0, Math.min(255, 255 * rt)); - } - class P { - static CMYK_G([X, pt, B, F]) { - return ["G", 1 - Math.min(1, 0.3 * X + 0.59 * B + 0.11 * pt + F)]; - } - static G_CMYK([X]) { - return ["CMYK", 0, 0, 0, 1 - X]; - } - static G_RGB([X]) { - return ["RGB", X, X, X]; - } - static G_rgb([X]) { - return X = l(X), [X, X, X]; - } - static G_HTML([X]) { - const pt = et(X); - return `#${pt}${pt}${pt}`; - } - static RGB_G([X, pt, B]) { - return ["G", 0.3 * X + 0.59 * pt + 0.11 * B]; - } - static RGB_rgb(X) { - return X.map(l); - } - static RGB_HTML(X) { - return `#${X.map(et).join("")}`; - } - static T_HTML() { - return "#00000000"; - } - static T_rgb() { - return [null]; - } - static CMYK_RGB([X, pt, B, F]) { - return ["RGB", 1 - Math.min(1, X + F), 1 - Math.min(1, B + F), 1 - Math.min(1, pt + F)]; - } - static CMYK_rgb([X, pt, B, F]) { - return [l(1 - Math.min(1, X + F)), l(1 - Math.min(1, B + F)), l(1 - Math.min(1, pt + F))]; - } - static CMYK_HTML(X) { - const pt = this.CMYK_RGB(X).slice(1); - return this.RGB_HTML(pt); - } - static RGB_CMYK([X, pt, B]) { - const F = 1 - X, g = 1 - pt, O = 1 - B, I = Math.min(F, g, O); - return ["CMYK", F, g, O, I]; - } - } - d.ColorConverters = P; - }, - /* 31 */ - /***/ - (dt, d) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.NullL10n = void 0, d.getL10nFallback = l; - const et = { - of_pages: "of {{pagesCount}}", - page_of_pages: "({{pageNumber}} of {{pagesCount}})", - document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)", - document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)", - document_properties_date_string: "{{date}}, {{time}}", - document_properties_page_size_unit_inches: "in", - document_properties_page_size_unit_millimeters: "mm", - document_properties_page_size_orientation_portrait: "portrait", - document_properties_page_size_orientation_landscape: "landscape", - document_properties_page_size_name_a3: "A3", - document_properties_page_size_name_a4: "A4", - document_properties_page_size_name_letter: "Letter", - document_properties_page_size_name_legal: "Legal", - document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})", - document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})", - document_properties_linearized_yes: "Yes", - document_properties_linearized_no: "No", - additional_layers: "Additional Layers", - page_landmark: "Page {{page}}", - thumb_page_title: "Page {{page}}", - thumb_page_canvas: "Thumbnail of Page {{page}}", - find_reached_top: "Reached top of document, continued from bottom", - find_reached_bottom: "Reached end of document, continued from top", - "find_match_count[one]": "{{current}} of {{total}} match", - "find_match_count[other]": "{{current}} of {{total}} matches", - "find_match_count_limit[one]": "More than {{limit}} match", - "find_match_count_limit[other]": "More than {{limit}} matches", - find_not_found: "Phrase not found", - page_scale_width: "Page Width", - page_scale_fit: "Page Fit", - page_scale_auto: "Automatic Zoom", - page_scale_actual: "Actual Size", - page_scale_percent: "{{scale}}%", - loading_error: "An error occurred while loading the PDF.", - invalid_file_error: "Invalid or corrupted PDF file.", - missing_file_error: "Missing PDF file.", - unexpected_response_error: "Unexpected server response.", - rendering_error: "An error occurred while rendering the page.", - annotation_date_string: "{{date}}, {{time}}", - printing_not_supported: "Warning: Printing is not fully supported by this browser.", - printing_not_ready: "Warning: The PDF is not fully loaded for printing.", - web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts.", - free_text2_default_content: "Start typing…", - editor_free_text2_aria_label: "Text Editor", - editor_ink2_aria_label: "Draw Editor", - editor_ink_canvas_aria_label: "User-created image", - editor_alt_text_button_label: "Alt text", - editor_alt_text_edit_button_label: "Edit alt text", - editor_alt_text_decorative_tooltip: "Marked as decorative" - }; - et.print_progress_percent = "{{progress}}%"; - function l(X, pt) { - switch (X) { - case "find_match_count": - X = `find_match_count[${pt.total === 1 ? "one" : "other"}]`; - break; - case "find_match_count_limit": - X = `find_match_count_limit[${pt.limit === 1 ? "one" : "other"}]`; - break; - } - return et[X] || ""; - } - function P(X, pt) { - return pt ? X.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (B, F) => F in pt ? pt[F] : "{{" + F + "}}") : X; - } - const rt = { - async getLanguage() { - return "en-us"; - }, - async getDirection() { - return "ltr"; - }, - async get(X, pt = null, B = l(X, pt)) { - return P(B, pt); - }, - async translate(X) { - } - }; - d.NullL10n = rt; - }, - /* 32 */ - /***/ - (dt, d, et) => { - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.XfaLayer = void 0; - var l = et(25); - class P { - static setupStorage(X, pt, B, F, g) { - const O = F.getValue(pt, { - value: null - }); - switch (B.name) { - case "textarea": - if (O.value !== null && (X.textContent = O.value), g === "print") - break; - X.addEventListener("input", (I) => { - F.setValue(pt, { - value: I.target.value - }); - }); - break; - case "input": - if (B.attributes.type === "radio" || B.attributes.type === "checkbox") { - if (O.value === B.attributes.xfaOn ? X.setAttribute("checked", !0) : O.value === B.attributes.xfaOff && X.removeAttribute("checked"), g === "print") - break; - X.addEventListener("change", (I) => { - F.setValue(pt, { - value: I.target.checked ? I.target.getAttribute("xfaOn") : I.target.getAttribute("xfaOff") - }); - }); - } else { - if (O.value !== null && X.setAttribute("value", O.value), g === "print") - break; - X.addEventListener("input", (I) => { - F.setValue(pt, { - value: I.target.value - }); - }); - } - break; - case "select": - if (O.value !== null) { - X.setAttribute("value", O.value); - for (const I of B.children) - I.attributes.value === O.value ? I.attributes.selected = !0 : I.attributes.hasOwnProperty("selected") && delete I.attributes.selected; - } - X.addEventListener("input", (I) => { - const x = I.target.options, v = x.selectedIndex === -1 ? "" : x[x.selectedIndex].value; - F.setValue(pt, { - value: v - }); - }); - break; - } - } - static setAttributes({ - html: X, - element: pt, - storage: B = null, - intent: F, - linkService: g - }) { - const { - attributes: O - } = pt, I = X instanceof HTMLAnchorElement; - O.type === "radio" && (O.name = `${O.name}-${F}`); - for (const [x, v] of Object.entries(O)) - if (v != null) - switch (x) { - case "class": - v.length && X.setAttribute(x, v.join(" ")); - break; - case "dataId": - break; - case "id": - X.setAttribute("data-element-id", v); - break; - case "style": - Object.assign(X.style, v); - break; - case "textContent": - X.textContent = v; - break; - default: - (!I || x !== "href" && x !== "newWindow") && X.setAttribute(x, v); - } - I && g.addLinkAttributes(X, O.href, O.newWindow), B && O.dataId && this.setupStorage(X, O.dataId, pt, B); - } - static render(X) { - var A; - const pt = X.annotationStorage, B = X.linkService, F = X.xfaHtml, g = X.intent || "display", O = document.createElement(F.name); - F.attributes && this.setAttributes({ - html: O, - element: F, - intent: g, - linkService: B - }); - const I = [[F, -1, O]], x = X.div; - if (x.append(O), X.viewport) { - const u = `matrix(${X.viewport.transform.join(",")})`; - x.style.transform = u; - } - g !== "richText" && x.setAttribute("class", "xfaLayer xfaFont"); - const v = []; - for (; I.length > 0; ) { - const [u, _, w] = I.at(-1); - if (_ + 1 === u.children.length) { - I.pop(); - continue; - } - const C = u.children[++I.at(-1)[1]]; - if (C === null) - continue; - const { - name: y - } = C; - if (y === "#text") { - const c = document.createTextNode(C.value); - v.push(c), w.append(c); - continue; - } - const a = (A = C == null ? void 0 : C.attributes) != null && A.xmlns ? document.createElementNS(C.attributes.xmlns, y) : document.createElement(y); - if (w.append(a), C.attributes && this.setAttributes({ - html: a, - element: C, - storage: pt, - intent: g, - linkService: B - }), C.children && C.children.length > 0) - I.push([C, -1, a]); - else if (C.value) { - const c = document.createTextNode(C.value); - l.XfaText.shouldBuildText(y) && v.push(c), a.append(c); - } - } - for (const u of x.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) - u.setAttribute("readOnly", !0); - return { - textDivs: v - }; - } - static update(X) { - const pt = `matrix(${X.viewport.transform.join(",")})`; - X.div.style.transform = pt, X.div.hidden = !1; - } - } - d.XfaLayer = P; - }, - /* 33 */ - /***/ - (dt, d, et) => { - var F, g, O, I, x, v, A, u, _, w, C, y, a, c, k, Ni, r, Bi, m, Ui, z, ji, V, hi, at, Hi, lt, di, wt, Wi, S, Gi, n, zi, o, Xi, b, Vi, N, ae, Q, ui, ct, Me, ut, Re, Bt, fe, Dt, fi, K, De, ht, qi, Ct, pi, Gt, $i, Xt, Yi, Wt, gi, ot, Ie, G, pe; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.InkEditor = void 0; - var l = et(1), P = et(4), rt = et(29), X = et(6), pt = et(5); - const At = class At extends P.AnnotationEditor { - constructor($) { - super({ - ...$, - name: "inkEditor" - }); - L(this, k); - L(this, r); - L(this, m); - L(this, z); - L(this, V); - L(this, at); - L(this, lt); - L(this, wt); - L(this, S); - L(this, n); - L(this, o); - L(this, b); - L(this, N); - L(this, Q); - L(this, ct); - L(this, ut); - L(this, Bt); - L(this, Dt); - L(this, K); - L(this, Xt); - L(this, Wt); - L(this, ot); - L(this, G); - L(this, F, 0); - L(this, g, 0); - L(this, O, this.canvasPointermove.bind(this)); - L(this, I, this.canvasPointerleave.bind(this)); - L(this, x, this.canvasPointerup.bind(this)); - L(this, v, this.canvasPointerdown.bind(this)); - L(this, A, new Path2D()); - L(this, u, !1); - L(this, _, !1); - L(this, w, !1); - L(this, C, null); - L(this, y, 0); - L(this, a, 0); - L(this, c, null); - this.color = $.color || null, this.thickness = $.thickness || null, this.opacity = $.opacity || null, this.paths = [], this.bezierPath2D = [], this.allRawPaths = [], this.currentPath = [], this.scaleFactor = 1, this.translationX = this.translationY = 0, this.x = 0, this.y = 0, this._willKeepAspectRatio = !0; - } - static initialize($) { - P.AnnotationEditor.initialize($, { - strings: ["editor_ink_canvas_aria_label", "editor_ink2_aria_label"] - }); - } - static updateDefaultParams($, vt) { - switch ($) { - case l.AnnotationEditorParamsType.INK_THICKNESS: - At._defaultThickness = vt; - break; - case l.AnnotationEditorParamsType.INK_COLOR: - At._defaultColor = vt; - break; - case l.AnnotationEditorParamsType.INK_OPACITY: - At._defaultOpacity = vt / 100; - break; - } - } - updateParams($, vt) { - switch ($) { - case l.AnnotationEditorParamsType.INK_THICKNESS: - W(this, k, Ni).call(this, vt); - break; - case l.AnnotationEditorParamsType.INK_COLOR: - W(this, r, Bi).call(this, vt); - break; - case l.AnnotationEditorParamsType.INK_OPACITY: - W(this, m, Ui).call(this, vt); - break; - } - } - static get defaultPropertiesToUpdate() { - return [[l.AnnotationEditorParamsType.INK_THICKNESS, At._defaultThickness], [l.AnnotationEditorParamsType.INK_COLOR, At._defaultColor || P.AnnotationEditor._defaultLineColor], [l.AnnotationEditorParamsType.INK_OPACITY, Math.round(At._defaultOpacity * 100)]]; - } - get propertiesToUpdate() { - return [[l.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || At._defaultThickness], [l.AnnotationEditorParamsType.INK_COLOR, this.color || At._defaultColor || P.AnnotationEditor._defaultLineColor], [l.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? At._defaultOpacity))]]; - } - rebuild() { - this.parent && (super.rebuild(), this.div !== null && (this.canvas || (W(this, ct, Me).call(this), W(this, ut, Re).call(this)), this.isAttachedToDOM || (this.parent.add(this), W(this, Bt, fe).call(this)), W(this, G, pe).call(this))); - } - remove() { - this.canvas !== null && (this.isEmpty() || this.commit(), this.canvas.width = this.canvas.height = 0, this.canvas.remove(), this.canvas = null, t(this, C).disconnect(), Z(this, C, null), super.remove()); - } - setParent($) { - !this.parent && $ ? this._uiManager.removeShouldRescale(this) : this.parent && $ === null && this._uiManager.addShouldRescale(this), super.setParent($); - } - onScaleChanging() { - const [$, vt] = this.parentDimensions, Lt = this.width * $, Tt = this.height * vt; - this.setDimensions(Lt, Tt); - } - enableEditMode() { - t(this, u) || this.canvas === null || (super.enableEditMode(), this._isDraggable = !1, this.canvas.addEventListener("pointerdown", t(this, v))); - } - disableEditMode() { - !this.isInEditMode() || this.canvas === null || (super.disableEditMode(), this._isDraggable = !this.isEmpty(), this.div.classList.remove("editing"), this.canvas.removeEventListener("pointerdown", t(this, v))); - } - onceAdded() { - this._isDraggable = !this.isEmpty(); - } - isEmpty() { - return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0; - } - commit() { - t(this, u) || (super.commit(), this.isEditing = !1, this.disableEditMode(), this.setInForeground(), Z(this, u, !0), this.div.classList.add("disabled"), W(this, G, pe).call(this, !0), this.makeResizable(), this.parent.addInkEditorIfNeeded(!0), this.moveInDOM(), this.div.focus({ - preventScroll: !0 - })); - } - focusin($) { - this._focusEventsAllowed && (super.focusin($), this.enableEditMode()); - } - canvasPointerdown($) { - $.button !== 0 || !this.isInEditMode() || t(this, u) || (this.setInForeground(), $.preventDefault(), $.type !== "mouse" && this.div.focus(), W(this, at, Hi).call(this, $.offsetX, $.offsetY)); - } - canvasPointermove($) { - $.preventDefault(), W(this, lt, di).call(this, $.offsetX, $.offsetY); - } - canvasPointerup($) { - $.preventDefault(), W(this, Q, ui).call(this, $); - } - canvasPointerleave($) { - W(this, Q, ui).call(this, $); - } - get isResizable() { - return !this.isEmpty() && t(this, u); - } - render() { - if (this.div) - return this.div; - let $, vt; - this.width && ($ = this.x, vt = this.y), super.render(), P.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then((Jt) => { - var _t; - return (_t = this.div) == null ? void 0 : _t.setAttribute("aria-label", Jt); - }); - const [Lt, Tt, Ot, Nt] = W(this, z, ji).call(this); - if (this.setAt(Lt, Tt, 0, 0), this.setDims(Ot, Nt), W(this, ct, Me).call(this), this.width) { - const [Jt, _t] = this.parentDimensions; - this.setAspectRatio(this.width * Jt, this.height * _t), this.setAt($ * Jt, vt * _t, this.width * Jt, this.height * _t), Z(this, w, !0), W(this, Bt, fe).call(this), this.setDims(this.width * Jt, this.height * _t), W(this, N, ae).call(this), this.div.classList.add("disabled"); - } else - this.div.classList.add("editing"), this.enableEditMode(); - return W(this, ut, Re).call(this), this.div; - } - setDimensions($, vt) { - const Lt = Math.round($), Tt = Math.round(vt); - if (t(this, y) === Lt && t(this, a) === Tt) - return; - Z(this, y, Lt), Z(this, a, Tt), this.canvas.style.visibility = "hidden"; - const [Ot, Nt] = this.parentDimensions; - this.width = $ / Ot, this.height = vt / Nt, this.fixAndSetPosition(), t(this, u) && W(this, Dt, fi).call(this, $, vt), W(this, Bt, fe).call(this), W(this, N, ae).call(this), this.canvas.style.visibility = "visible", this.fixDims(); - } - static deserialize($, vt, Lt) { - var j, q, it; - if ($ instanceof rt.InkAnnotationElement) - return null; - const Tt = super.deserialize($, vt, Lt); - Tt.thickness = $.thickness, Tt.color = l.Util.makeHexColor(...$.color), Tt.opacity = $.opacity; - const [Ot, Nt] = Tt.pageDimensions, Jt = Tt.width * Ot, _t = Tt.height * Nt, Yt = Tt.parentScale, It = $.thickness / 2; - Z(Tt, u, !0), Z(Tt, y, Math.round(Jt)), Z(Tt, a, Math.round(_t)); - const { - paths: R, - rect: e, - rotation: f - } = $; - for (let { - bezier: mt - } of R) { - mt = W(j = At, Gt, $i).call(j, mt, e, f); - const kt = []; - Tt.paths.push(kt); - let Pt = Yt * (mt[0] - It), zt = Yt * (mt[1] - It); - for (let Rt = 2, Ut = mt.length; Rt < Ut; Rt += 6) { - const qt = Yt * (mt[Rt] - It), Kt = Yt * (mt[Rt + 1] - It), Qt = Yt * (mt[Rt + 2] - It), se = Yt * (mt[Rt + 3] - It), ie = Yt * (mt[Rt + 4] - It), ne = Yt * (mt[Rt + 5] - It); - kt.push([[Pt, zt], [qt, Kt], [Qt, se], [ie, ne]]), Pt = ie, zt = ne; - } - const Mt = W(this, ht, qi).call(this, kt); - Tt.bezierPath2D.push(Mt); - } - const D = W(q = Tt, Wt, gi).call(q); - return Z(Tt, g, Math.max(P.AnnotationEditor.MIN_SIZE, D[2] - D[0])), Z(Tt, F, Math.max(P.AnnotationEditor.MIN_SIZE, D[3] - D[1])), W(it = Tt, Dt, fi).call(it, Jt, _t), Tt; - } - serialize() { - if (this.isEmpty()) - return null; - const $ = this.getRect(0, 0), vt = P.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle); - return { - annotationType: l.AnnotationEditorType.INK, - color: vt, - thickness: this.thickness, - opacity: this.opacity, - paths: W(this, Xt, Yi).call(this, this.scaleFactor / this.parentScale, this.translationX, this.translationY, $), - pageIndex: this.pageIndex, - rect: $, - rotation: this.rotation, - structTreeParentId: this._structTreeParentId - }; - } - }; - F = new WeakMap(), g = new WeakMap(), O = new WeakMap(), I = new WeakMap(), x = new WeakMap(), v = new WeakMap(), A = new WeakMap(), u = new WeakMap(), _ = new WeakMap(), w = new WeakMap(), C = new WeakMap(), y = new WeakMap(), a = new WeakMap(), c = new WeakMap(), k = new WeakSet(), Ni = function($) { - const vt = this.thickness; - this.addCommands({ - cmd: () => { - this.thickness = $, W(this, G, pe).call(this); - }, - undo: () => { - this.thickness = vt, W(this, G, pe).call(this); - }, - mustExec: !0, - type: l.AnnotationEditorParamsType.INK_THICKNESS, - overwriteIfSameType: !0, - keepUndo: !0 - }); - }, r = new WeakSet(), Bi = function($) { - const vt = this.color; - this.addCommands({ - cmd: () => { - this.color = $, W(this, N, ae).call(this); - }, - undo: () => { - this.color = vt, W(this, N, ae).call(this); - }, - mustExec: !0, - type: l.AnnotationEditorParamsType.INK_COLOR, - overwriteIfSameType: !0, - keepUndo: !0 - }); - }, m = new WeakSet(), Ui = function($) { - $ /= 100; - const vt = this.opacity; - this.addCommands({ - cmd: () => { - this.opacity = $, W(this, N, ae).call(this); - }, - undo: () => { - this.opacity = vt, W(this, N, ae).call(this); - }, - mustExec: !0, - type: l.AnnotationEditorParamsType.INK_OPACITY, - overwriteIfSameType: !0, - keepUndo: !0 - }); - }, z = new WeakSet(), ji = function() { - const { - parentRotation: $, - parentDimensions: [vt, Lt] - } = this; - switch ($) { - case 90: - return [0, Lt, Lt, vt]; - case 180: - return [vt, Lt, vt, Lt]; - case 270: - return [vt, 0, Lt, vt]; - default: - return [0, 0, vt, Lt]; - } - }, V = new WeakSet(), hi = function() { - const { - ctx: $, - color: vt, - opacity: Lt, - thickness: Tt, - parentScale: Ot, - scaleFactor: Nt - } = this; - $.lineWidth = Tt * Ot / Nt, $.lineCap = "round", $.lineJoin = "round", $.miterLimit = 10, $.strokeStyle = `${vt}${(0, pt.opacityToHex)(Lt)}`; - }, at = new WeakSet(), Hi = function($, vt) { - this.canvas.addEventListener("contextmenu", X.noContextMenu), this.canvas.addEventListener("pointerleave", t(this, I)), this.canvas.addEventListener("pointermove", t(this, O)), this.canvas.addEventListener("pointerup", t(this, x)), this.canvas.removeEventListener("pointerdown", t(this, v)), this.isEditing = !0, t(this, w) || (Z(this, w, !0), W(this, Bt, fe).call(this), this.thickness || (this.thickness = At._defaultThickness), this.color || (this.color = At._defaultColor || P.AnnotationEditor._defaultLineColor), this.opacity ?? (this.opacity = At._defaultOpacity)), this.currentPath.push([$, vt]), Z(this, _, !1), W(this, V, hi).call(this), Z(this, c, () => { - W(this, n, zi).call(this), t(this, c) && window.requestAnimationFrame(t(this, c)); - }), window.requestAnimationFrame(t(this, c)); - }, lt = new WeakSet(), di = function($, vt) { - const [Lt, Tt] = this.currentPath.at(-1); - if (this.currentPath.length > 1 && $ === Lt && vt === Tt) - return; - const Ot = this.currentPath; - let Nt = t(this, A); - if (Ot.push([$, vt]), Z(this, _, !0), Ot.length <= 2) { - Nt.moveTo(...Ot[0]), Nt.lineTo($, vt); - return; - } - Ot.length === 3 && (Z(this, A, Nt = new Path2D()), Nt.moveTo(...Ot[0])), W(this, o, Xi).call(this, Nt, ...Ot.at(-3), ...Ot.at(-2), $, vt); - }, wt = new WeakSet(), Wi = function() { - if (this.currentPath.length === 0) - return; - const $ = this.currentPath.at(-1); - t(this, A).lineTo(...$); - }, S = new WeakSet(), Gi = function($, vt) { - Z(this, c, null), $ = Math.min(Math.max($, 0), this.canvas.width), vt = Math.min(Math.max(vt, 0), this.canvas.height), W(this, lt, di).call(this, $, vt), W(this, wt, Wi).call(this); - let Lt; - if (this.currentPath.length !== 1) - Lt = W(this, b, Vi).call(this); - else { - const _t = [$, vt]; - Lt = [[_t, _t.slice(), _t.slice(), _t]]; - } - const Tt = t(this, A), Ot = this.currentPath; - this.currentPath = [], Z(this, A, new Path2D()); - const Nt = () => { - this.allRawPaths.push(Ot), this.paths.push(Lt), this.bezierPath2D.push(Tt), this.rebuild(); - }, Jt = () => { - this.allRawPaths.pop(), this.paths.pop(), this.bezierPath2D.pop(), this.paths.length === 0 ? this.remove() : (this.canvas || (W(this, ct, Me).call(this), W(this, ut, Re).call(this)), W(this, G, pe).call(this)); - }; - this.addCommands({ - cmd: Nt, - undo: Jt, - mustExec: !0 - }); - }, n = new WeakSet(), zi = function() { - if (!t(this, _)) - return; - Z(this, _, !1); - const $ = Math.ceil(this.thickness * this.parentScale), vt = this.currentPath.slice(-3), Lt = vt.map((Nt) => Nt[0]), Tt = vt.map((Nt) => Nt[1]); - Math.min(...Lt) - $, Math.max(...Lt) + $, Math.min(...Tt) - $, Math.max(...Tt) + $; - const { - ctx: Ot - } = this; - Ot.save(), Ot.clearRect(0, 0, this.canvas.width, this.canvas.height); - for (const Nt of this.bezierPath2D) - Ot.stroke(Nt); - Ot.stroke(t(this, A)), Ot.restore(); - }, o = new WeakSet(), Xi = function($, vt, Lt, Tt, Ot, Nt, Jt) { - const _t = (vt + Tt) / 2, Yt = (Lt + Ot) / 2, It = (Tt + Nt) / 2, R = (Ot + Jt) / 2; - $.bezierCurveTo(_t + 2 * (Tt - _t) / 3, Yt + 2 * (Ot - Yt) / 3, It + 2 * (Tt - It) / 3, R + 2 * (Ot - R) / 3, It, R); - }, b = new WeakSet(), Vi = function() { - const $ = this.currentPath; - if ($.length <= 2) - return [[$[0], $[0], $.at(-1), $.at(-1)]]; - const vt = []; - let Lt, [Tt, Ot] = $[0]; - for (Lt = 1; Lt < $.length - 2; Lt++) { - const [e, f] = $[Lt], [D, j] = $[Lt + 1], q = (e + D) / 2, it = (f + j) / 2, mt = [Tt + 2 * (e - Tt) / 3, Ot + 2 * (f - Ot) / 3], kt = [q + 2 * (e - q) / 3, it + 2 * (f - it) / 3]; - vt.push([[Tt, Ot], mt, kt, [q, it]]), [Tt, Ot] = [q, it]; - } - const [Nt, Jt] = $[Lt], [_t, Yt] = $[Lt + 1], It = [Tt + 2 * (Nt - Tt) / 3, Ot + 2 * (Jt - Ot) / 3], R = [_t + 2 * (Nt - _t) / 3, Yt + 2 * (Jt - Yt) / 3]; - return vt.push([[Tt, Ot], It, R, [_t, Yt]]), vt; - }, N = new WeakSet(), ae = function() { - if (this.isEmpty()) { - W(this, K, De).call(this); - return; - } - W(this, V, hi).call(this); - const { - canvas: $, - ctx: vt - } = this; - vt.setTransform(1, 0, 0, 1, 0, 0), vt.clearRect(0, 0, $.width, $.height), W(this, K, De).call(this); - for (const Lt of this.bezierPath2D) - vt.stroke(Lt); - }, Q = new WeakSet(), ui = function($) { - this.canvas.removeEventListener("pointerleave", t(this, I)), this.canvas.removeEventListener("pointermove", t(this, O)), this.canvas.removeEventListener("pointerup", t(this, x)), this.canvas.addEventListener("pointerdown", t(this, v)), setTimeout(() => { - this.canvas.removeEventListener("contextmenu", X.noContextMenu); - }, 10), W(this, S, Gi).call(this, $.offsetX, $.offsetY), this.addToAnnotationStorage(), this.setInBackground(); - }, ct = new WeakSet(), Me = function() { - this.canvas = document.createElement("canvas"), this.canvas.width = this.canvas.height = 0, this.canvas.className = "inkEditorCanvas", P.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then(($) => { - var vt; - return (vt = this.canvas) == null ? void 0 : vt.setAttribute("aria-label", $); - }), this.div.append(this.canvas), this.ctx = this.canvas.getContext("2d"); - }, ut = new WeakSet(), Re = function() { - Z(this, C, new ResizeObserver(($) => { - const vt = $[0].contentRect; - vt.width && vt.height && this.setDimensions(vt.width, vt.height); - })), t(this, C).observe(this.div); - }, Bt = new WeakSet(), fe = function() { - if (!t(this, w)) - return; - const [$, vt] = this.parentDimensions; - this.canvas.width = Math.ceil(this.width * $), this.canvas.height = Math.ceil(this.height * vt), W(this, K, De).call(this); - }, Dt = new WeakSet(), fi = function($, vt) { - const Lt = W(this, ot, Ie).call(this), Tt = ($ - Lt) / t(this, g), Ot = (vt - Lt) / t(this, F); - this.scaleFactor = Math.min(Tt, Ot); - }, K = new WeakSet(), De = function() { - const $ = W(this, ot, Ie).call(this) / 2; - this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + $, this.translationY * this.scaleFactor + $); - }, ht = new WeakSet(), qi = function($) { - const vt = new Path2D(); - for (let Lt = 0, Tt = $.length; Lt < Tt; Lt++) { - const [Ot, Nt, Jt, _t] = $[Lt]; - Lt === 0 && vt.moveTo(...Ot), vt.bezierCurveTo(Nt[0], Nt[1], Jt[0], Jt[1], _t[0], _t[1]); - } - return vt; - }, Ct = new WeakSet(), pi = function($, vt, Lt) { - const [Tt, Ot, Nt, Jt] = vt; - switch (Lt) { - case 0: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) - $[_t] += Tt, $[_t + 1] = Jt - $[_t + 1]; - break; - case 90: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) { - const It = $[_t]; - $[_t] = $[_t + 1] + Tt, $[_t + 1] = It + Ot; - } - break; - case 180: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) - $[_t] = Nt - $[_t], $[_t + 1] += Ot; - break; - case 270: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) { - const It = $[_t]; - $[_t] = Nt - $[_t + 1], $[_t + 1] = Jt - It; - } - break; - default: - throw new Error("Invalid rotation"); - } - return $; - }, Gt = new WeakSet(), $i = function($, vt, Lt) { - const [Tt, Ot, Nt, Jt] = vt; - switch (Lt) { - case 0: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) - $[_t] -= Tt, $[_t + 1] = Jt - $[_t + 1]; - break; - case 90: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) { - const It = $[_t]; - $[_t] = $[_t + 1] - Ot, $[_t + 1] = It - Tt; - } - break; - case 180: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) - $[_t] = Nt - $[_t], $[_t + 1] -= Ot; - break; - case 270: - for (let _t = 0, Yt = $.length; _t < Yt; _t += 2) { - const It = $[_t]; - $[_t] = Jt - $[_t + 1], $[_t + 1] = Nt - It; - } - break; - default: - throw new Error("Invalid rotation"); - } - return $; - }, Xt = new WeakSet(), Yi = function($, vt, Lt, Tt) { - var Yt, It; - const Ot = [], Nt = this.thickness / 2, Jt = $ * vt + Nt, _t = $ * Lt + Nt; - for (const R of this.paths) { - const e = [], f = []; - for (let D = 0, j = R.length; D < j; D++) { - const [q, it, mt, kt] = R[D], Pt = $ * q[0] + Jt, zt = $ * q[1] + _t, Mt = $ * it[0] + Jt, Rt = $ * it[1] + _t, Ut = $ * mt[0] + Jt, qt = $ * mt[1] + _t, Kt = $ * kt[0] + Jt, Qt = $ * kt[1] + _t; - D === 0 && (e.push(Pt, zt), f.push(Pt, zt)), e.push(Mt, Rt, Ut, qt, Kt, Qt), f.push(Mt, Rt), D === j - 1 && f.push(Kt, Qt); - } - Ot.push({ - bezier: W(Yt = At, Ct, pi).call(Yt, e, Tt, this.rotation), - points: W(It = At, Ct, pi).call(It, f, Tt, this.rotation) - }); - } - return Ot; - }, Wt = new WeakSet(), gi = function() { - let $ = 1 / 0, vt = -1 / 0, Lt = 1 / 0, Tt = -1 / 0; - for (const Ot of this.paths) - for (const [Nt, Jt, _t, Yt] of Ot) { - const It = l.Util.bezierBoundingBox(...Nt, ...Jt, ..._t, ...Yt); - $ = Math.min($, It[0]), Lt = Math.min(Lt, It[1]), vt = Math.max(vt, It[2]), Tt = Math.max(Tt, It[3]); - } - return [$, Lt, vt, Tt]; - }, ot = new WeakSet(), Ie = function() { - return t(this, u) ? Math.ceil(this.thickness * this.parentScale) : 0; - }, G = new WeakSet(), pe = function($ = !1) { - if (this.isEmpty()) - return; - if (!t(this, u)) { - W(this, N, ae).call(this); - return; - } - const vt = W(this, Wt, gi).call(this), Lt = W(this, ot, Ie).call(this); - Z(this, g, Math.max(P.AnnotationEditor.MIN_SIZE, vt[2] - vt[0])), Z(this, F, Math.max(P.AnnotationEditor.MIN_SIZE, vt[3] - vt[1])); - const Tt = Math.ceil(Lt + t(this, g) * this.scaleFactor), Ot = Math.ceil(Lt + t(this, F) * this.scaleFactor), [Nt, Jt] = this.parentDimensions; - this.width = Tt / Nt, this.height = Ot / Jt, this.setAspectRatio(Tt, Ot); - const _t = this.translationX, Yt = this.translationY; - this.translationX = -vt[0], this.translationY = -vt[1], W(this, Bt, fe).call(this), W(this, N, ae).call(this), Z(this, y, Tt), Z(this, a, Ot), this.setDims(Tt, Ot); - const It = $ ? Lt / this.scaleFactor / 2 : 0; - this.translate(_t - this.translationX - It, Yt - this.translationY - It); - }, L(At, ht), L(At, Ct), L(At, Gt), ee(At, "_defaultColor", null), ee(At, "_defaultOpacity", 1), ee(At, "_defaultThickness", 1), ee(At, "_type", "ink"); - let B = At; - d.InkEditor = B; - }, - /* 34 */ - /***/ - (dt, d, et) => { - var B, F, g, O, I, x, v, A, u, _, w, ve, y, Se, c, Le, p, mi, T, Ki, U, Ji, E, bi, st, Oe, H, Qi; - Object.defineProperty(d, "__esModule", { - value: !0 - }), d.StampEditor = void 0; - var l = et(1), P = et(4), rt = et(6), X = et(29); - const gt = class gt extends P.AnnotationEditor { - constructor(S) { - super({ - ...S, - name: "stampEditor" - }); - L(this, w); - L(this, y); - L(this, c); - L(this, p); - L(this, T); - L(this, U); - L(this, E); - L(this, st); - L(this, H); - L(this, B, null); - L(this, F, null); - L(this, g, null); - L(this, O, null); - L(this, I, null); - L(this, x, null); - L(this, v, null); - L(this, A, null); - L(this, u, !1); - L(this, _, !1); - Z(this, O, S.bitmapUrl), Z(this, I, S.bitmapFile); - } - static initialize(S) { - P.AnnotationEditor.initialize(S); - } - static get supportedTypes() { - const S = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"]; - return (0, l.shadow)(this, "supportedTypes", S.map((i) => `image/${i}`)); - } - static get supportedTypesStr() { - return (0, l.shadow)(this, "supportedTypesStr", this.supportedTypes.join(",")); - } - static isHandlingMimeForPasting(S) { - return this.supportedTypes.includes(S); - } - static paste(S, i) { - i.pasteEditor(l.AnnotationEditorType.STAMP, { - bitmapFile: S.getAsFile() - }); - } - remove() { - var S, i; - t(this, F) && (Z(this, B, null), this._uiManager.imageManager.deleteId(t(this, F)), (S = t(this, x)) == null || S.remove(), Z(this, x, null), (i = t(this, v)) == null || i.disconnect(), Z(this, v, null)), super.remove(); - } - rebuild() { - if (!this.parent) { - t(this, F) && W(this, c, Le).call(this); - return; - } - super.rebuild(), this.div !== null && (t(this, F) && W(this, c, Le).call(this), this.isAttachedToDOM || this.parent.add(this)); - } - onceAdded() { - this._isDraggable = !0, this.div.focus(); - } - isEmpty() { - return !(t(this, g) || t(this, B) || t(this, O) || t(this, I)); - } - get isResizable() { - return !0; - } - render() { - if (this.div) - return this.div; - let S, i; - if (this.width && (S = this.x, i = this.y), super.render(), this.div.hidden = !0, t(this, B) ? W(this, p, mi).call(this) : W(this, c, Le).call(this), this.width) { - const [n, s] = this.parentDimensions; - this.setAt(S * n, i * s, this.width * n, this.height * s); - } - return this.div; - } - static deserialize(S, i, n) { - if (S instanceof X.StampAnnotationElement) - return null; - const s = super.deserialize(S, i, n), { - rect: o, - bitmapUrl: h, - bitmapId: b, - isSvg: M, - accessibilityData: N - } = S; - b && n.imageManager.isValidId(b) ? Z(s, F, b) : Z(s, O, h), Z(s, u, M); - const [tt, Q] = s.pageDimensions; - return s.width = (o[2] - o[0]) / tt, s.height = (o[3] - o[1]) / Q, N && (s.altTextData = N), s; - } - serialize(S = !1, i = null) { - if (this.isEmpty()) - return null; - const n = { - annotationType: l.AnnotationEditorType.STAMP, - bitmapId: t(this, F), - pageIndex: this.pageIndex, - rect: this.getRect(0, 0), - rotation: this.rotation, - isSvg: t(this, u), - structTreeParentId: this._structTreeParentId - }; - if (S) - return n.bitmapUrl = W(this, st, Oe).call(this, !0), n.accessibilityData = this.altTextData, n; - const { - decorative: s, - altText: o - } = this.altTextData; - if (!s && o && (n.accessibilityData = { - type: "Figure", - alt: o - }), i === null) - return n; - i.stamps || (i.stamps = /* @__PURE__ */ new Map()); - const h = t(this, u) ? (n.rect[2] - n.rect[0]) * (n.rect[3] - n.rect[1]) : null; - if (!i.stamps.has(t(this, F))) - i.stamps.set(t(this, F), { - area: h, - serialized: n - }), n.bitmap = W(this, st, Oe).call(this, !1); - else if (t(this, u)) { - const b = i.stamps.get(t(this, F)); - h > b.area && (b.area = h, b.serialized.bitmap.close(), b.serialized.bitmap = W(this, st, Oe).call(this, !1)); - } - return n; - } - }; - B = new WeakMap(), F = new WeakMap(), g = new WeakMap(), O = new WeakMap(), I = new WeakMap(), x = new WeakMap(), v = new WeakMap(), A = new WeakMap(), u = new WeakMap(), _ = new WeakMap(), w = new WeakSet(), ve = function(S, i = !1) { - if (!S) { - this.remove(); - return; - } - Z(this, B, S.bitmap), i || (Z(this, F, S.id), Z(this, u, S.isSvg)), W(this, p, mi).call(this); - }, y = new WeakSet(), Se = function() { - Z(this, g, null), this._uiManager.enableWaiting(!1), t(this, x) && this.div.focus(); - }, c = new WeakSet(), Le = function() { - if (t(this, F)) { - this._uiManager.enableWaiting(!0), this._uiManager.imageManager.getFromId(t(this, F)).then((i) => W(this, w, ve).call(this, i, !0)).finally(() => W(this, y, Se).call(this)); - return; - } - if (t(this, O)) { - const i = t(this, O); - Z(this, O, null), this._uiManager.enableWaiting(!0), Z(this, g, this._uiManager.imageManager.getFromUrl(i).then((n) => W(this, w, ve).call(this, n)).finally(() => W(this, y, Se).call(this))); - return; - } - if (t(this, I)) { - const i = t(this, I); - Z(this, I, null), this._uiManager.enableWaiting(!0), Z(this, g, this._uiManager.imageManager.getFromFile(i).then((n) => W(this, w, ve).call(this, n)).finally(() => W(this, y, Se).call(this))); - return; - } - const S = document.createElement("input"); - S.type = "file", S.accept = gt.supportedTypesStr, Z(this, g, new Promise((i) => { - S.addEventListener("change", async () => { - if (!S.files || S.files.length === 0) - this.remove(); - else { - this._uiManager.enableWaiting(!0); - const n = await this._uiManager.imageManager.getFromFile(S.files[0]); - W(this, w, ve).call(this, n); - } - i(); - }), S.addEventListener("cancel", () => { - this.remove(), i(); - }); - }).finally(() => W(this, y, Se).call(this))), S.click(); - }, p = new WeakSet(), mi = function() { - const { - div: S - } = this; - let { - width: i, - height: n - } = t(this, B); - const [s, o] = this.pageDimensions, h = 0.75; - if (this.width) - i = this.width * s, n = this.height * o; - else if (i > h * s || n > h * o) { - const tt = Math.min(h * s / i, h * o / n); - i *= tt, n *= tt; - } - const [b, M] = this.parentDimensions; - this.setDims(i * b / s, n * M / o), this._uiManager.enableWaiting(!1); - const N = Z(this, x, document.createElement("canvas")); - S.append(N), S.hidden = !1, W(this, E, bi).call(this, i, n), W(this, H, Qi).call(this), t(this, _) || (this.parent.addUndoableEditor(this), Z(this, _, !0)), this._uiManager._eventBus.dispatch("reporttelemetry", { - source: this, - details: { - type: "editing", - subtype: this.editorType, - data: { - action: "inserted_image" - } - } - }), this.addAltTextButton(); - }, T = new WeakSet(), Ki = function(S, i) { - var h; - const [n, s] = this.parentDimensions; - this.width = S / n, this.height = i / s, this.setDims(S, i), (h = this._initialOptions) != null && h.isCentered ? this.center() : this.fixAndSetPosition(), this._initialOptions = null, t(this, A) !== null && clearTimeout(t(this, A)), Z(this, A, setTimeout(() => { - Z(this, A, null), W(this, E, bi).call(this, S, i); - }, 200)); - }, U = new WeakSet(), Ji = function(S, i) { - const { - width: n, - height: s - } = t(this, B); - let o = n, h = s, b = t(this, B); - for (; o > 2 * S || h > 2 * i; ) { - const M = o, N = h; - o > 2 * S && (o = o >= 16384 ? Math.floor(o / 2) - 1 : Math.ceil(o / 2)), h > 2 * i && (h = h >= 16384 ? Math.floor(h / 2) - 1 : Math.ceil(h / 2)); - const tt = new OffscreenCanvas(o, h); - tt.getContext("2d").drawImage(b, 0, 0, M, N, 0, 0, o, h), b = tt.transferToImageBitmap(); - } - return b; - }, E = new WeakSet(), bi = function(S, i) { - S = Math.ceil(S), i = Math.ceil(i); - const n = t(this, x); - if (!n || n.width === S && n.height === i) - return; - n.width = S, n.height = i; - const s = t(this, u) ? t(this, B) : W(this, U, Ji).call(this, S, i), o = n.getContext("2d"); - o.filter = this._uiManager.hcmFilter, o.drawImage(s, 0, 0, s.width, s.height, 0, 0, S, i); - }, st = new WeakSet(), Oe = function(S) { - if (S) { - if (t(this, u)) { - const s = this._uiManager.imageManager.getSvgUrl(t(this, F)); - if (s) - return s; - } - const i = document.createElement("canvas"); - return { - width: i.width, - height: i.height - } = t(this, B), i.getContext("2d").drawImage(t(this, B), 0, 0), i.toDataURL(); - } - if (t(this, u)) { - const [i, n] = this.pageDimensions, s = Math.round(this.width * i * rt.PixelsPerInch.PDF_TO_CSS_UNITS), o = Math.round(this.height * n * rt.PixelsPerInch.PDF_TO_CSS_UNITS), h = new OffscreenCanvas(s, o); - return h.getContext("2d").drawImage(t(this, B), 0, 0, t(this, B).width, t(this, B).height, 0, 0, s, o), h.transferToImageBitmap(); - } - return structuredClone(t(this, B)); - }, H = new WeakSet(), Qi = function() { - Z(this, v, new ResizeObserver((S) => { - const i = S[0].contentRect; - i.width && i.height && W(this, T, Ki).call(this, i.width, i.height); - })), t(this, v).observe(this.div); - }, ee(gt, "_type", "stamp"); - let pt = gt; - d.StampEditor = pt; - } - /******/ - ], __webpack_module_cache__ = {}; - function __w_pdfjs_require__(dt) { - var d = __webpack_module_cache__[dt]; - if (d !== void 0) - return d.exports; - var et = __webpack_module_cache__[dt] = { - /******/ - // no module.id needed - /******/ - // no module.loaded needed - /******/ - exports: {} - /******/ - }; - return __webpack_modules__[dt](et, et.exports, __w_pdfjs_require__), et.exports; - } - var __webpack_exports__ = {}; - return (() => { - var dt = __webpack_exports__; - Object.defineProperty(dt, "__esModule", { - value: !0 - }), Object.defineProperty(dt, "AbortException", { - enumerable: !0, - get: function() { - return d.AbortException; - } - }), Object.defineProperty(dt, "AnnotationEditorLayer", { - enumerable: !0, - get: function() { - return rt.AnnotationEditorLayer; - } - }), Object.defineProperty(dt, "AnnotationEditorParamsType", { - enumerable: !0, - get: function() { - return d.AnnotationEditorParamsType; - } - }), Object.defineProperty(dt, "AnnotationEditorType", { - enumerable: !0, - get: function() { - return d.AnnotationEditorType; - } - }), Object.defineProperty(dt, "AnnotationEditorUIManager", { - enumerable: !0, - get: function() { - return X.AnnotationEditorUIManager; - } - }), Object.defineProperty(dt, "AnnotationLayer", { - enumerable: !0, - get: function() { - return pt.AnnotationLayer; - } - }), Object.defineProperty(dt, "AnnotationMode", { - enumerable: !0, - get: function() { - return d.AnnotationMode; - } - }), Object.defineProperty(dt, "CMapCompressionType", { - enumerable: !0, - get: function() { - return d.CMapCompressionType; - } - }), Object.defineProperty(dt, "DOMSVGFactory", { - enumerable: !0, - get: function() { - return l.DOMSVGFactory; - } - }), Object.defineProperty(dt, "FeatureTest", { - enumerable: !0, - get: function() { - return d.FeatureTest; - } - }), Object.defineProperty(dt, "GlobalWorkerOptions", { - enumerable: !0, - get: function() { - return B.GlobalWorkerOptions; - } - }), Object.defineProperty(dt, "ImageKind", { - enumerable: !0, - get: function() { - return d.ImageKind; - } - }), Object.defineProperty(dt, "InvalidPDFException", { - enumerable: !0, - get: function() { - return d.InvalidPDFException; - } - }), Object.defineProperty(dt, "MissingPDFException", { - enumerable: !0, - get: function() { - return d.MissingPDFException; - } - }), Object.defineProperty(dt, "OPS", { - enumerable: !0, - get: function() { - return d.OPS; - } - }), Object.defineProperty(dt, "PDFDataRangeTransport", { - enumerable: !0, - get: function() { - return et.PDFDataRangeTransport; - } - }), Object.defineProperty(dt, "PDFDateString", { - enumerable: !0, - get: function() { - return l.PDFDateString; - } - }), Object.defineProperty(dt, "PDFWorker", { - enumerable: !0, - get: function() { - return et.PDFWorker; - } - }), Object.defineProperty(dt, "PasswordResponses", { - enumerable: !0, - get: function() { - return d.PasswordResponses; - } - }), Object.defineProperty(dt, "PermissionFlag", { - enumerable: !0, - get: function() { - return d.PermissionFlag; - } - }), Object.defineProperty(dt, "PixelsPerInch", { - enumerable: !0, - get: function() { - return l.PixelsPerInch; - } - }), Object.defineProperty(dt, "PromiseCapability", { - enumerable: !0, - get: function() { - return d.PromiseCapability; - } - }), Object.defineProperty(dt, "RenderingCancelledException", { - enumerable: !0, - get: function() { - return l.RenderingCancelledException; - } - }), Object.defineProperty(dt, "SVGGraphics", { - enumerable: !0, - get: function() { - return et.SVGGraphics; - } - }), Object.defineProperty(dt, "UnexpectedResponseException", { - enumerable: !0, - get: function() { - return d.UnexpectedResponseException; - } - }), Object.defineProperty(dt, "Util", { - enumerable: !0, - get: function() { - return d.Util; - } - }), Object.defineProperty(dt, "VerbosityLevel", { - enumerable: !0, - get: function() { - return d.VerbosityLevel; - } - }), Object.defineProperty(dt, "XfaLayer", { - enumerable: !0, - get: function() { - return F.XfaLayer; - } - }), Object.defineProperty(dt, "build", { - enumerable: !0, - get: function() { - return et.build; - } - }), Object.defineProperty(dt, "createValidAbsoluteUrl", { - enumerable: !0, - get: function() { - return d.createValidAbsoluteUrl; - } - }), Object.defineProperty(dt, "getDocument", { - enumerable: !0, - get: function() { - return et.getDocument; - } - }), Object.defineProperty(dt, "getFilenameFromUrl", { - enumerable: !0, - get: function() { - return l.getFilenameFromUrl; - } - }), Object.defineProperty(dt, "getPdfFilenameFromUrl", { - enumerable: !0, - get: function() { - return l.getPdfFilenameFromUrl; - } - }), Object.defineProperty(dt, "getXfaPageViewport", { - enumerable: !0, - get: function() { - return l.getXfaPageViewport; - } - }), Object.defineProperty(dt, "isDataScheme", { - enumerable: !0, - get: function() { - return l.isDataScheme; - } - }), Object.defineProperty(dt, "isPdfFile", { - enumerable: !0, - get: function() { - return l.isPdfFile; - } - }), Object.defineProperty(dt, "loadScript", { - enumerable: !0, - get: function() { - return l.loadScript; - } - }), Object.defineProperty(dt, "noContextMenu", { - enumerable: !0, - get: function() { - return l.noContextMenu; - } - }), Object.defineProperty(dt, "normalizeUnicode", { - enumerable: !0, - get: function() { - return d.normalizeUnicode; - } - }), Object.defineProperty(dt, "renderTextLayer", { - enumerable: !0, - get: function() { - return P.renderTextLayer; - } - }), Object.defineProperty(dt, "setLayerDimensions", { - enumerable: !0, - get: function() { - return l.setLayerDimensions; - } - }), Object.defineProperty(dt, "shadow", { - enumerable: !0, - get: function() { - return d.shadow; - } - }), Object.defineProperty(dt, "updateTextLayer", { - enumerable: !0, - get: function() { - return P.updateTextLayer; - } - }), Object.defineProperty(dt, "version", { - enumerable: !0, - get: function() { - return et.version; - } - }); - var d = __w_pdfjs_require__(1), et = __w_pdfjs_require__(2), l = __w_pdfjs_require__(6), P = __w_pdfjs_require__(26), rt = __w_pdfjs_require__(27), X = __w_pdfjs_require__(5), pt = __w_pdfjs_require__(29), B = __w_pdfjs_require__(14), F = __w_pdfjs_require__(32); - })(), __webpack_exports__; - })() - )); -})(pdf); -var pdfExports = pdf.exports; -const pdfjsLib = /* @__PURE__ */ getDefaultExportFromCjs(pdfExports), Example_svelte_svelte_type_style_lang = "", { - SvelteComponent, - append, - attr, - binding_callbacks, - detach, - element, - init, - insert, - noop, - safe_not_equal, - set_style, - toggle_class -} = window.__gradio__svelte__internal; -function create_fragment(dt) { - let d, et; - return { - c() { - d = element("div"), et = element("canvas"), set_style(d, "justify-content", "center"), set_style(d, "align-items", "center"), set_style(d, "display", "flex"), set_style(d, "flex-direction", "column"), attr(d, "class", "svelte-1gecy8w"), toggle_class( - d, - "table", - /*type*/ - dt[0] === "table" - ), toggle_class( - d, - "gallery", - /*type*/ - dt[0] === "gallery" - ), toggle_class( - d, - "selected", - /*selected*/ - dt[1] - ); - }, - m(l, P) { - insert(l, d, P), append(d, et), dt[5](et); - }, - p(l, [P]) { - P & /*type*/ - 1 && toggle_class( - d, - "table", - /*type*/ - l[0] === "table" - ), P & /*type*/ - 1 && toggle_class( - d, - "gallery", - /*type*/ - l[0] === "gallery" - ), P & /*selected*/ - 2 && toggle_class( - d, - "selected", - /*selected*/ - l[1] - ); - }, - i: noop, - o: noop, - d(l) { - l && detach(d), dt[5](null); - } - }; -} -function instance(dt, d, et) { - let { value: l } = d, { samples_dir: P } = d, { type: rt } = d, { selected: X = !1 } = d; - pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdn.bootcss.com/pdf.js/3.11.174/pdf.worker.js"; - let pt, B; - async function F(I) { - pt = await pdfjsLib.getDocument(I).promise, g(); - } - function g() { - pt.getPage(1).then((I) => { - const x = B.getContext("2d"); - x.clearRect(0, 0, B.width, B.height); - const v = I.getViewport({ scale: 0.2 }), A = { canvasContext: x, viewport: v }; - et(2, B.width = v.width, B), et(2, B.height = v.height, B), I.render(A); - }); - } - function O(I) { - binding_callbacks[I ? "unshift" : "push"](() => { - B = I, et(2, B); - }); - } - return dt.$$set = (I) => { - "value" in I && et(3, l = I.value), "samples_dir" in I && et(4, P = I.samples_dir), "type" in I && et(0, rt = I.type), "selected" in I && et(1, X = I.selected); - }, dt.$$.update = () => { - dt.$$.dirty & /*samples_dir, value*/ - 24 && F(P + l); - }, [rt, X, B, l, P, O]; -} -class Example extends SvelteComponent { - constructor(d) { - super(), init(this, d, instance, create_fragment, safe_not_equal, { - value: 3, - samples_dir: 4, - type: 0, - selected: 1 - }); - } -} -export { - Example as default -}; diff --git a/spaces/geekyrakshit/enhance-me/test.py b/spaces/geekyrakshit/enhance-me/test.py deleted file mode 100644 index 0ec36e500901a098606425c0ae12945f5066ce80..0000000000000000000000000000000000000000 --- a/spaces/geekyrakshit/enhance-me/test.py +++ /dev/null @@ -1,4 +0,0 @@ -from enhance_me.commons import download_unpaired_low_light_dataset - - -download_unpaired_low_light_dataset() diff --git a/spaces/gilmar/health_insurance_app/app.py b/spaces/gilmar/health_insurance_app/app.py deleted file mode 100644 index 4c491c6aa07cb150609e42e6731d2df6910b1149..0000000000000000000000000000000000000000 --- a/spaces/gilmar/health_insurance_app/app.py +++ /dev/null @@ -1,82 +0,0 @@ -import joblib -import gradio as gr -import pandas as pd -from models import HealthInsurance - -def load_data(): - global _model - global _column_transformer - global _bins_annual_premium_type - - _model = joblib.load(filename = 'parameters/random_forrest.gz') - _column_transformer = joblib.load(filename = 'parameters/column_transformer.joblib') - _bins_annual_premium_type = joblib.load(filename = 'parameters/bins_annual_premium_type.joblib') - -def predict(df): - - health_insurance = HealthInsurance(_model,_column_transformer, - _bins_annual_premium_type) - - df_predicted = health_insurance.predict(df) - - return df_predicted[['score','previously_insured', - 'annual_premium','vintage','gender', - 'age','region_code','policy_sales_channel', - 'driving_license','vehicle_age', - 'vehicle_damage']] - -def create_input_table(): - return gr.Dataframe(headers = ['previously_insured', - 'annual_premium','vintage','gender', - 'age','region_code','policy_sales_channel', - 'driving_license','vehicle_age', - 'vehicle_damage'], - datatype = ['number','number','number','str','number', - 'number','number','number','str','str'], - row_count= 1, - col_count= (10,'fixed'), - type = 'pandas', - label = 'Input') - -def create_output_table(): - return gr.Dataframe(headers = ['score','previously_insured', - 'annual_premium','vintage','gender', - 'age','region_code','policy_sales_channel', - 'driving_license','vehicle_age', - 'vehicle_damage'], - type = 'pandas', - label = 'Output', - wrap = True, - interactive =False) - -def create_file_object(): - return gr.File(label = 'File upload', - type = 'bytes') - -def convert_file_to_pandas(file): - - df = pd.read_excel(io = file) - - return df - -def build_interface(): - - with gr.Blocks() as interface: - - file_object = create_file_object() - input_table = create_input_table() - output_table = create_output_table() - - greet_btn = gr.Button("Submit") - greet_btn.click(fn=predict, inputs=input_table, outputs=output_table) - - file_object.change(fn = convert_file_to_pandas, - inputs = file_object, - outputs = input_table) - - interface.launch() - - -if __name__ == "__main__": - load_data() - build_interface() \ No newline at end of file diff --git a/spaces/gossminn/fillmorle-app/sftp/predictor/span_predictor.orig.py b/spaces/gossminn/fillmorle-app/sftp/predictor/span_predictor.orig.py deleted file mode 100644 index e84fb18f87fd57d51e1f800351ad065cc32b87e0..0000000000000000000000000000000000000000 --- a/spaces/gossminn/fillmorle-app/sftp/predictor/span_predictor.orig.py +++ /dev/null @@ -1,362 +0,0 @@ -import os -from time import time -from typing import * -import json - -import numpy as np -import torch -from allennlp.common.util import JsonDict, sanitize -from allennlp.data import DatasetReader, Instance -from allennlp.data.data_loaders import SimpleDataLoader -from allennlp.data.samplers import MaxTokensBatchSampler -from allennlp.data.tokenizers import SpacyTokenizer -from allennlp.models import Model -from allennlp.nn import util as nn_util -from allennlp.predictors import Predictor -from concrete import ( - MentionArgument, SituationMentionSet, SituationMention, TokenRefSequence, - EntityMention, EntityMentionSet, Entity, EntitySet, AnnotationMetadata, Communication -) -from concrete.util import CommunicationReader, AnalyticUUIDGeneratorFactory, CommunicationWriterZip -from concrete.validate import validate_communication - -from ..data_reader import concrete_doc, concrete_doc_tokenized -from ..utils import Span, re_index_span, VIRTUAL_ROOT - - -class PredictionReturn(NamedTuple): - span: Union[Span, dict, Communication] - sentence: List[str] - meta: Dict[str, Any] - - -class ForceDecodingReturn(NamedTuple): - span: np.ndarray - label: List[str] - distribution: np.ndarray - - -@Predictor.register('span') -class SpanPredictor(Predictor): - @staticmethod - def format_convert( - sentence: Union[List[str], List[List[str]]], - prediction: Union[Span, List[Span]], - output_format: str - ): - if output_format == 'span': - return prediction - elif output_format == 'json': - if isinstance(prediction, list): - return [SpanPredictor.format_convert(sent, pred, 'json') for sent, pred in zip(sentence, prediction)] - return prediction.to_json() - elif output_format == 'concrete': - if isinstance(prediction, Span): - sentence, prediction = [sentence], [prediction] - return concrete_doc_tokenized(sentence, prediction) - - def predict_concrete( - self, - concrete_path: str, - output_path: Optional[str] = None, - max_tokens: int = 2048, - ontology_mapping: Optional[Dict[str, str]] = None, - ): - os.makedirs(os.path.dirname(output_path), exist_ok=True) - writer = CommunicationWriterZip(output_path) - - for comm, fn in CommunicationReader(concrete_path): - assert len(comm.sectionList) == 1 - concrete_sentences = comm.sectionList[0].sentenceList - json_sentences = list() - for con_sent in concrete_sentences: - json_sentences.append( - [t.text for t in con_sent.tokenization.tokenList.tokenList] - ) - predictions = self.predict_batch_sentences(json_sentences, max_tokens, ontology_mapping=ontology_mapping) - - # Merge predictions into concrete - aug = AnalyticUUIDGeneratorFactory(comm).create() - situation_mention_set = SituationMentionSet(next(aug), AnnotationMetadata('Span Finder', time()), list()) - comm.situationMentionSetList = [situation_mention_set] - situation_mention_set.mentionList = sm_list = list() - entity_mention_set = EntityMentionSet(next(aug), AnnotationMetadata('Span Finder', time()), list()) - comm.entityMentionSetList = [entity_mention_set] - entity_mention_set.mentionList = em_list = list() - entity_set = EntitySet( - next(aug), AnnotationMetadata('Span Finder', time()), list(), None, entity_mention_set.uuid - ) - comm.entitySetList = [entity_set] - - em_dict = dict() - for con_sent, pred in zip(concrete_sentences, predictions): - for event in pred.span: - def raw_text_span(start_idx, end_idx, **_): - si_char = con_sent.tokenization.tokenList.tokenList[start_idx].textSpan.start - ei_char = con_sent.tokenization.tokenList.tokenList[end_idx].textSpan.ending - return comm.text[si_char:ei_char] - sm = SituationMention( - next(aug), - text=raw_text_span(event.start_idx, event.end_idx), - situationKind=event.label, - situationType='EVENT', - confidence=event.confidence, - argumentList=list(), - tokens=TokenRefSequence( - tokenIndexList=list(range(event.start_idx, event.end_idx+1)), - tokenizationId=con_sent.tokenization.uuid - ) - ) - - for arg in event: - em = em_dict.get((arg.start_idx, arg.end_idx + 1)) - if em is None: - em = EntityMention( - next(aug), - tokens=TokenRefSequence( - tokenIndexList=list(range(arg.start_idx, arg.end_idx+1)), - tokenizationId=con_sent.tokenization.uuid, - ), - text=raw_text_span(arg.start_idx, arg.end_idx) - ) - em_list.append(em) - entity_set.entityList.append(Entity(next(aug), id=em.text, mentionIdList=[em.uuid])) - em_dict[(arg.start_idx, arg.end_idx+1)] = em - sm.argumentList.append(MentionArgument( - role=arg.label, - entityMentionId=em.uuid, - confidence=arg.confidence - )) - sm_list.append(sm) - validate_communication(comm) - writer.write(comm, fn) - writer.close() - - def predict_sentence( - self, - sentence: Union[str, List[str]], - ontology_mapping: Optional[Dict[str, str]] = None, - output_format: str = 'span', - ) -> PredictionReturn: - """ - Predict spans on a single sentence (no batch). If not tokenized, will tokenize it with SpacyTokenizer. - :param sentence: If tokenized, should be a list of tokens in string. If not, should be a string. - :param ontology_mapping: - :param output_format: span, json or concrete. - """ - prediction = self.predict_json(self._prepare_sentence(sentence)) - prediction['prediction'] = self.format_convert( - prediction['sentence'], - Span.from_json(prediction['prediction']).map_ontology(ontology_mapping), - output_format - ) - return PredictionReturn(prediction['prediction'], prediction['sentence'], prediction.get('meta', dict())) - - def predict_batch_sentences( - self, - sentences: List[Union[List[str], str]], - max_tokens: int = 512, - ontology_mapping: Optional[Dict[str, str]] = None, - output_format: str = 'span', - ) -> List[PredictionReturn]: - """ - Predict spans on a batch of sentences. If not tokenized, will tokenize it with SpacyTokenizer. - :param sentences: A list of sentences. Refer to `predict_sentence`. - :param max_tokens: Maximum tokens in a batch. - :param ontology_mapping: If not None, will try to map the output from one ontology to another. - If the predicted frame is not in the mapping, the prediction will be ignored. - :param output_format: span, json or concrete. - :return: A list of predictions. - """ - sentences = list(map(self._prepare_sentence, sentences)) - for i_sent, sent in enumerate(sentences): - sent['meta'] = {"idx": i_sent} - instances = list(map(self._json_to_instance, sentences)) - outputs = list() - for ins_indices in MaxTokensBatchSampler(max_tokens, ["tokens"], 0.0).get_batch_indices(instances): - batch_ins = list( - SimpleDataLoader([instances[ins_idx] for ins_idx in ins_indices], len(ins_indices), vocab=self.vocab) - )[0] - batch_inputs = nn_util.move_to_device(batch_ins, device=self.cuda_device) - batch_outputs = self._model(**batch_inputs) - for meta, prediction, inputs in zip( - batch_outputs['meta'], batch_outputs['prediction'], batch_outputs['inputs'] - ): - prediction.map_ontology(ontology_mapping) - prediction = self.format_convert(inputs['sentence'], prediction, output_format) - outputs.append(PredictionReturn(prediction, inputs['sentence'], {"input_idx": meta['idx']})) - - outputs.sort(key=lambda x: x.meta['input_idx']) - return outputs - - def predict_instance(self, instance: Instance) -> JsonDict: - outputs = self._model.forward_on_instance(instance) - outputs = sanitize(outputs) - return { - 'prediction': outputs['prediction'], - 'sentence': outputs['inputs']['sentence'], - 'meta': outputs.get('meta', {}) - } - - def __init__( - self, - model: Model, - dataset_reader: DatasetReader, - frozen: bool = True, - ): - super(SpanPredictor, self).__init__(model=model, dataset_reader=dataset_reader, frozen=frozen) - self.spacy_tokenizer = SpacyTokenizer(language='en_core_web_sm') - - def economize( - self, - max_decoding_spans: Optional[int] = None, - max_recursion_depth: Optional[int] = None, - ): - if max_decoding_spans: - self._model._max_decoding_spans = max_decoding_spans - if max_recursion_depth: - self._model._max_recursion_depth = max_recursion_depth - - def _json_to_instance(self, json_dict: JsonDict) -> Instance: - return self._dataset_reader.text_to_instance(**json_dict) - - @staticmethod - def to_nested(prediction: List[dict]): - first_layer, idx2children = list(), dict() - for idx, pred in enumerate(prediction): - children = list() - pred['children'] = idx2children[idx+1] = children - if pred['parent'] == 0: - first_layer.append(pred) - else: - idx2children[pred['parent']].append(pred) - del pred['parent'] - return first_layer - - def _prepare_sentence(self, sentence: Union[str, List[str]]) -> Dict[str, List[str]]: - if isinstance(sentence, str): - while ' ' in sentence: - sentence = sentence.replace(' ', ' ') - sentence = sentence.replace(chr(65533), '') - if sentence == '': - sentence = [""] - sentence = list(map(str, self.spacy_tokenizer.tokenize(sentence))) - return {"tokens": sentence} - - @staticmethod - def json_to_concrete( - predictions: List[dict], - ): - sentences = list() - for pred in predictions: - tokenization, event = list(), list() - sent = {'text': ' '.join(pred['inputs']), 'tokenization': tokenization, 'event': event} - sentences.append(sent) - start_idx = 0 - for token in pred['inputs']: - tokenization.append((start_idx, len(token)-1+start_idx)) - start_idx += len(token) + 1 - for pred_event in pred['prediction']: - arg_list = list() - one_event = {'argument': arg_list} - event.append(one_event) - for key in ['start_idx', 'end_idx', 'label']: - one_event[key] = pred_event[key] - for pred_arg in pred_event['children']: - arg_list.append({key: pred_arg[key] for key in ['start_idx', 'end_idx', 'label']}) - - concrete_comm = concrete_doc(sentences) - return concrete_comm - - def force_decode( - self, - sentence: List[str], - parent_span: Tuple[int, int] = (-1, -1), - parent_label: str = VIRTUAL_ROOT, - child_spans: Optional[List[Tuple[int, int]]] = None, - ) -> ForceDecodingReturn: - """ - Force decoding. There are 2 modes: - 1. Given parent span and its label, find all it children (direct children, not including other descendents) - and type them. - 2. Given parent span, parent label, and children spans, type all children. - :param sentence: Tokens. - :param parent_span: [start_idx, end_idx], both inclusive. - :param parent_label: Parent label in string. - :param child_spans: Optional. If provided, will turn to mode 2; else mode 1. - :return: - - span: children spans. - - label: most probable labels of children. - - distribution: distribution over children labels. - """ - instance = self._dataset_reader.text_to_instance(self._prepare_sentence(sentence)['tokens']) - model_input = nn_util.move_to_device( - list(SimpleDataLoader([instance], 1, vocab=self.vocab))[0], device=self.cuda_device - ) - offsets = instance.fields['raw_inputs'].metadata['offsets'] - - with torch.no_grad(): - tokens = model_input['tokens'] - parent_span = re_index_span(parent_span, offsets) - if parent_span[1] >= self._dataset_reader.max_length: - return ForceDecodingReturn( - np.zeros([0, 2], dtype=np.int), - [], - np.zeros([0, self.vocab.get_vocab_size('span_label')], dtype=np.float64) - ) - if child_spans is not None: - token_vec = self._model.word_embedding(tokens) - child_pieces = [re_index_span(bdr, offsets) for bdr in child_spans] - child_pieces = list(filter(lambda x: x[1] < self._dataset_reader.max_length-1, child_pieces)) - span_tensor = torch.tensor( - [parent_span] + child_pieces, dtype=torch.int64, device=self.device - ).unsqueeze(0) - parent_indices = span_tensor.new_zeros(span_tensor.shape[0:2]) - span_labels = parent_indices.new_full( - parent_indices.shape, self._model.vocab.get_token_index(parent_label, 'span_label') - ) - span_vec = self._model._span_extractor(token_vec, span_tensor) - typing_out = self._model._span_typing(span_vec, parent_indices, span_labels) - distribution = typing_out['distribution'][0, 1:].cpu().numpy() - boundary = np.array(child_spans) - else: - parent_label_tensor = torch.tensor( - [self._model.vocab.get_token_index(parent_label, 'span_label')], device=self.device - ) - parent_boundary_tensor = torch.tensor([parent_span], device=self.device) - boundary, _, num_children, distribution = self._model.one_step_prediction( - tokens, parent_boundary_tensor, parent_label_tensor - ) - boundary, distribution = boundary[0].cpu().tolist(), distribution[0].cpu().numpy() - boundary = np.array([re_index_span(bdr, offsets, True) for bdr in boundary]) - - labels = [ - self.vocab.get_token_from_index(label_idx, 'span_label') for label_idx in distribution.argmax(1) - ] - return ForceDecodingReturn(boundary, labels, distribution) - - @property - def vocab(self): - return self._model.vocab - - @property - def device(self): - return self.cuda_device if self.cuda_device > -1 else 'cpu' - - @staticmethod - def read_ontology_mapping(file_path: str): - """ - Read the ontology mapping file. The file format can be read in docs. - """ - if file_path is None: - return None - if file_path.endswith('.json'): - return json.load(open(file_path)) - mapping = dict() - for line in open(file_path).readlines(): - parent_label, original_label, new_label = line.replace('\n', '').split('\t') - if parent_label == '*': - mapping[original_label] = new_label - else: - mapping[(parent_label, original_label)] = new_label - return mapping diff --git a/spaces/gotiQspiryo/whisper-ui/examples/Descargar gratis bb multi unlocker key v 19.0 y disfruta de la libertad de usar cualquier operador en tu Alcatel.md b/spaces/gotiQspiryo/whisper-ui/examples/Descargar gratis bb multi unlocker key v 19.0 y disfruta de la libertad de usar cualquier operador en tu Alcatel.md deleted file mode 100644 index e717aed308afca34677b723373058e94bbf3f593..0000000000000000000000000000000000000000 --- a/spaces/gotiQspiryo/whisper-ui/examples/Descargar gratis bb multi unlocker key v 19.0 y disfruta de la libertad de usar cualquier operador en tu Alcatel.md +++ /dev/null @@ -1,6 +0,0 @@ -

                descargar gratis bb multi unlocker key v 19.0


                Download Ziphttps://urlgoal.com/2uyMn3



                - - aaccfb2cb3
                -
                -
                -

                diff --git a/spaces/gotiQspiryo/whisper-ui/examples/Groupmail Business Cracked Fulliso The Ultimate Guide to Email Marketing Campaigns.md b/spaces/gotiQspiryo/whisper-ui/examples/Groupmail Business Cracked Fulliso The Ultimate Guide to Email Marketing Campaigns.md deleted file mode 100644 index 70cfd274c4243268fb6b76cacef0038022f53367..0000000000000000000000000000000000000000 --- a/spaces/gotiQspiryo/whisper-ui/examples/Groupmail Business Cracked Fulliso The Ultimate Guide to Email Marketing Campaigns.md +++ /dev/null @@ -1,6 +0,0 @@ -

                Groupmail Business Cracked Fulliso


                Download ✯✯✯ https://urlgoal.com/2uyM8E



                -
                - aaccfb2cb3
                -
                -
                -

                diff --git a/spaces/gotiQspiryo/whisper-ui/examples/Los Galos Discografia Descargar.md b/spaces/gotiQspiryo/whisper-ui/examples/Los Galos Discografia Descargar.md deleted file mode 100644 index e5d8301388b6e294ceb0e8d82dc0cee3f4705740..0000000000000000000000000000000000000000 --- a/spaces/gotiQspiryo/whisper-ui/examples/Los Galos Discografia Descargar.md +++ /dev/null @@ -1,12 +0,0 @@ -

                los galos discografia descargar


                Download ○○○ https://urlgoal.com/2uyNhS



                -
                -iTunes: Contacto: rj-artista@lasgalosdg.com Facebook: Twitter: - -??? I DID IT!!!!??? Los Galos Discografia Descargar ?️ DOWNLOAD: ❤❤❤ los galos discografia descargar d9cd945bc9 . iTunes: Contacto: rj-artista@lasgalosdg.com Facebook: Twitter: - -?‍?‍?‍? Welcome to the new album of Los Galos Discografia. We hope you’ll enjoy it. Los Galos Discografia Descargar ?‍?‍?‍? DOWNLOAD: ❤❤❤ los galos discografia descargar d9cd945bc9 . iTunes: Contacto: rj-artista@lasgalosdg.com Facebook: Twitter: - -Los Galos Discografia Descargar ❤❤❤ los galos discografia descargar d9cd945bc9 iTunes: Contacto: rj-artista@lasgalosdg.com Facebook: 4fefd39f24
                -
                -
                -

                diff --git a/spaces/gradio/HuBERT/examples/m2m_100/tokenizers/tokenize_thai.py b/spaces/gradio/HuBERT/examples/m2m_100/tokenizers/tokenize_thai.py deleted file mode 100644 index 9c72cb89056f6fc92a8963415e5f3a1e61b33a5b..0000000000000000000000000000000000000000 --- a/spaces/gradio/HuBERT/examples/m2m_100/tokenizers/tokenize_thai.py +++ /dev/null @@ -1,13 +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 sys - -from pythainlp import word_tokenize - - -for line in sys.stdin: - print(" ".join(word_tokenize(line.strip()))) diff --git a/spaces/gradio/gpt-neo/data/train_tokenizer.py b/spaces/gradio/gpt-neo/data/train_tokenizer.py deleted file mode 100644 index 2ed56a8bfee88368fff7fd221ff7498031d292bb..0000000000000000000000000000000000000000 --- a/spaces/gradio/gpt-neo/data/train_tokenizer.py +++ /dev/null @@ -1,73 +0,0 @@ -import os -import random -import argparse -import shutil -from glob import glob -from pathlib import Path - -from lm_dataformat import Reader -from tokenizers import (Tokenizer, decoders, models, pre_tokenizers, - processors, trainers) -from tokenizers.normalizers import NFKC -from tqdm import tqdm - -# parser - -parser = argparse.ArgumentParser() -parser.add_argument("--base_dir", type=str, help="Path to where your files are located. Files ending in .zst are treated as \ - archives, all others as raw text.") -parser.add_argument("--output_dir", type=str, default="tokenizers", help="Where to put the tokenizer") -parser.add_argument("--file_type", type=str, choices=["xz", "txt"], default="xz", help="Extension of file to parse") -parser.add_argument("--vocab_size", type=int, help="Size of vocabulary", required = True) -args = parser.parse_args() - -# main script - -data_path = Path(args.base_dir) -archives = glob(str(data_path / f"*.{args.file_type}")) - -out_path = Path(args.output_dir) - -if os.path.exists(out_path): - shutil.rmtree(out_path) - -if not out_path.is_dir(): - out_path.mkdir() - - for arch in tqdm(archives): - name = os.path.basename(arch).split(".")[0] + ".txt" - fp = out_path / name - - if args.file_type == 'xz': - g = Reader(arch).stream_data() - - with open(fp, "w") as f: - for s in g: - f.write(s) - f.write("\n\n") - elif args.file_type == 'txt': - shutil.copyfile(str(arch), str(fp)) - -data_files = glob(str(out_path / "*.txt")) -data_files = random.sample(data_files, int(0.2 * len(data_files))) - -assert len(data_files) > 0, 'No data files found' - -# Initialize a tokenizer -tokenizer = Tokenizer(models.BPE()) - -# Customize pre-tokenization and decoding -tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=True) -tokenizer.decoder = decoders.ByteLevel() -tokenizer.post_processor = processors.ByteLevel(trim_offsets=True) -tokenizer.normalizer = NFKC() - -# And then train -trainer = trainers.BpeTrainer(vocab_size=args.vocab_size, min_frequency=2, special_tokens=["<|endoftext|>", "<|padding|>"]) -tokenizer.train(trainer, data_files) - -# And Save it -tokenizer_path = out_path / "byte-level-bpe.tokenizer.json" -tokenizer.save(str(tokenizer_path), pretty=True) - -print(f'tokenizer saved at {str(tokenizer_path)}') \ No newline at end of file diff --git a/spaces/gradio/longformer/tvm/_ffi/_ctypes/ndarray.py b/spaces/gradio/longformer/tvm/_ffi/_ctypes/ndarray.py deleted file mode 100644 index 9367160b811b3a593711b8534f265a23002a0230..0000000000000000000000000000000000000000 --- a/spaces/gradio/longformer/tvm/_ffi/_ctypes/ndarray.py +++ /dev/null @@ -1,130 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# pylint: disable=invalid-name -"""Runtime NDArray api""" -from __future__ import absolute_import - -import ctypes -from ..base import _LIB, check_call, c_str -from ..runtime_ctypes import TVMArrayHandle, TVMNDArrayContainerHandle -from .types import RETURN_SWITCH, C_TO_PY_ARG_SWITCH, _wrap_arg_func, _return_handle - - -TVMPyCapsuleDestructor = ctypes.CFUNCTYPE(None, ctypes.c_void_p) -_c_str_dltensor = c_str('dltensor') -_c_str_used_dltensor = c_str('used_dltensor') - - -# used for PyCapsule manipulation -if hasattr(ctypes, 'pythonapi'): - ctypes.pythonapi.PyCapsule_GetName.restype = ctypes.c_char_p - ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p - ctypes.pythonapi.PyCapsule_New.restype = ctypes.py_object - - -def _from_dlpack(dltensor): - dltensor = ctypes.py_object(dltensor) - if ctypes.pythonapi.PyCapsule_IsValid(dltensor, _c_str_dltensor): - ptr = ctypes.pythonapi.PyCapsule_GetPointer(dltensor, _c_str_dltensor) - # enforce type to make sure it works for all ctypes - ptr = ctypes.cast(ptr, ctypes.c_void_p) - handle = TVMArrayHandle() - check_call(_LIB.TVMArrayFromDLPack(ptr, ctypes.byref(handle))) - ctypes.pythonapi.PyCapsule_SetName(dltensor, _c_str_used_dltensor) - ctypes.pythonapi.PyCapsule_SetDestructor(dltensor, TVMPyCapsuleDestructor(0)) - return _make_array(handle, False, False) - raise ValueError("Expect a dltensor field, PyCapsule can only be consumed once") - - -def _dlpack_deleter(pycapsule): - pycapsule = ctypes.cast(pycapsule, ctypes.py_object) - if ctypes.pythonapi.PyCapsule_IsValid(pycapsule, _c_str_dltensor): - ptr = ctypes.pythonapi.PyCapsule_GetPointer(pycapsule, _c_str_dltensor) - # enforce type to make sure it works for all ctypes - ptr = ctypes.cast(ctypes.c_void_p, ptr) - _LIB.TVMDLManagedTensorCallDeleter(ptr) - ctypes.pythonapi.PyCapsule_SetDestructor(dltensor, TVMPyCapsuleDestructor(0)) - -_c_dlpack_deleter = TVMPyCapsuleDestructor(_dlpack_deleter) - - -class NDArrayBase(object): - """A simple Device/CPU Array object in runtime.""" - __slots__ = ["handle", "is_view"] - # pylint: disable=no-member - def __init__(self, handle, is_view=False): - """Initialize the function with handle - - Parameters - ---------- - handle : TVMArrayHandle - the handle to the underlying C++ TVMArray - """ - self.handle = handle - self.is_view = is_view - - def __del__(self): - if not self.is_view and _LIB: - check_call(_LIB.TVMArrayFree(self.handle)) - - @property - def _tvm_handle(self): - return ctypes.cast(self.handle, ctypes.c_void_p).value - - def to_dlpack(self): - """Produce an array from a DLPack Tensor without copying memory - - Returns - ------- - dlpack : DLPack tensor view of the array data - """ - handle = ctypes.c_void_p() - check_call(_LIB.TVMArrayToDLPack(self.handle, ctypes.byref(handle))) - return ctypes.pythonapi.PyCapsule_New(handle, _c_str_dltensor, _c_dlpack_deleter) - - -def _make_array(handle, is_view, is_container): - global _TVM_ND_CLS - handle = ctypes.cast(handle, TVMArrayHandle) - fcreate = _CLASS_NDARRAY - if is_container and _TVM_ND_CLS: - array_type_info = ctypes.cast(handle, TVMNDArrayContainerHandle).array_type_info.value - if array_type_info > 0: - fcreate = _TVM_ND_CLS[array_type_info] - return fcreate(handle, is_view) - -_TVM_COMPATS = () - -def _reg_extension(cls, fcreate): - global _TVM_COMPATS - _TVM_COMPATS += (cls,) - if fcreate: - fret = lambda x: fcreate(_return_handle(x)) - RETURN_SWITCH[cls._tvm_tcode] = fret - C_TO_PY_ARG_SWITCH[cls._tvm_tcode] = _wrap_arg_func(fret, cls._tvm_tcode) - -_TVM_ND_CLS = {} - -def _reg_ndarray(cls, fcreate): - global _TVM_ND_CLS - _TVM_ND_CLS[cls._array_type_code] = fcreate - -_CLASS_NDARRAY = None - -def _set_class_ndarray(cls): - global _CLASS_NDARRAY - _CLASS_NDARRAY = cls diff --git a/spaces/haakohu/DeepPrivacy/README.md b/spaces/haakohu/DeepPrivacy/README.md deleted file mode 100644 index 59eb5ced25b603d665a121cb783442d118d7eb97..0000000000000000000000000000000000000000 --- a/spaces/haakohu/DeepPrivacy/README.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: DeepPrivacy - A Generative Adversarial Network for Face Anonymization -emoji: 🌍 -colorFrom: gray -colorTo: blue -sdk: gradio -sdk_version: 3.20.0 -app_file: app.py -pinned: false ---- - -# Configuration - -`title`: _string_ -Display title for the Space - -`emoji`: _string_ -Space emoji (emoji-only character allowed) - -`colorFrom`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`colorTo`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`sdk`: _string_ -Can be either `gradio`, `streamlit`, or `static` - -`sdk_version` : _string_ -Only applicable for `streamlit` SDK. -See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions. - -`app_file`: _string_ -Path to your main application file (which contains either `gradio` or `streamlit` Python code, or `static` html code). -Path is relative to the root of the repository. - -`pinned`: _boolean_ -Whether the Space stays on top of your list. diff --git a/spaces/haakohu/deep_privacy2_face/dp2/detection/models/vit_pose/backbone.py b/spaces/haakohu/deep_privacy2_face/dp2/detection/models/vit_pose/backbone.py deleted file mode 100644 index f78712dd6131b02ea674fac452852274ae0dc5c2..0000000000000000000000000000000000000000 --- a/spaces/haakohu/deep_privacy2_face/dp2/detection/models/vit_pose/backbone.py +++ /dev/null @@ -1,311 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -# Code adapted from: https://github.com/gpastal24/ViTPose-Pytorch -import torch -from functools import partial -import torch.nn as nn -import torch.utils.checkpoint as checkpoint - -from timm.models.layers import drop_path, to_2tuple, trunc_normal_ - - -class DropPath(nn.Module): - """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). - """ - - def __init__(self, drop_prob=None): - super(DropPath, self).__init__() - self.drop_prob = drop_prob - - def forward(self, x): - return drop_path(x, self.drop_prob, self.training) - - def extra_repr(self): - return 'p={}'.format(self.drop_prob) - - -class Mlp(nn.Module): - def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.): - super().__init__() - out_features = out_features or in_features - hidden_features = hidden_features or in_features - self.fc1 = nn.Linear(in_features, hidden_features) - self.act = act_layer() - self.fc2 = nn.Linear(hidden_features, out_features) - self.drop = nn.Dropout(drop) - - def forward(self, x): - x = self.fc1(x) - x = self.act(x) - x = self.fc2(x) - x = self.drop(x) - return x - - -class Attention(nn.Module): - def __init__( - self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0., - proj_drop=0., attn_head_dim=None,): - super().__init__() - self.num_heads = num_heads - head_dim = dim // num_heads - self.dim = dim - - if attn_head_dim is not None: - head_dim = attn_head_dim - all_head_dim = head_dim * self.num_heads - - self.scale = qk_scale or head_dim ** -0.5 - - self.qkv = nn.Linear(dim, all_head_dim * 3, bias=qkv_bias) - - self.attn_drop = nn.Dropout(attn_drop) - self.proj = nn.Linear(all_head_dim, dim) - self.proj_drop = nn.Dropout(proj_drop) - - def forward(self, x): - B, N, C = x.shape - qkv = self.qkv(x) - qkv = qkv.reshape(B, N, 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) - q, k, v = qkv[0], qkv[1], qkv[2] # make torchscript happy (cannot use tensor as tuple) - - q = q * self.scale - attn = (q @ k.transpose(-2, -1)) - - attn = attn.softmax(dim=-1) - attn = self.attn_drop(attn) - - x = (attn @ v).transpose(1, 2).reshape(B, N, -1) - x = self.proj(x) - x = self.proj_drop(x) - - return x - - -class Block(nn.Module): - - def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_scale=None, - drop=0., attn_drop=0., drop_path=0., act_layer=nn.GELU, - norm_layer=nn.LayerNorm, attn_head_dim=None - ): - super().__init__() - - self.norm1 = norm_layer(dim) - self.attn = Attention( - dim, num_heads=num_heads, qkv_bias=qkv_bias, qk_scale=qk_scale, - attn_drop=attn_drop, proj_drop=drop, attn_head_dim=attn_head_dim - ) - - # NOTE: drop path for stochastic depth, we shall see if this is better than dropout here - self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity() - self.norm2 = norm_layer(dim) - mlp_hidden_dim = int(dim * mlp_ratio) - self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop) - - def forward(self, x): - x = x + self.drop_path(self.attn(self.norm1(x))) - x = x + self.drop_path(self.mlp(self.norm2(x))) - return x - - -class PatchEmbed(nn.Module): - """ Image to Patch Embedding - """ - - def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768, ratio=1): - super().__init__() - img_size = to_2tuple(img_size) - patch_size = to_2tuple(patch_size) - num_patches = (img_size[1] // patch_size[1]) * (img_size[0] // patch_size[0]) * (ratio ** 2) - self.patch_shape = (int(img_size[0] // patch_size[0] * ratio), int(img_size[1] // patch_size[1] * ratio)) - self.origin_patch_shape = (int(img_size[0] // patch_size[0]), int(img_size[1] // patch_size[1])) - self.img_size = img_size - self.patch_size = patch_size - self.num_patches = num_patches - - self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=( - patch_size[0] // ratio), padding=4 + 2 * (ratio//2-1)) - - def forward(self, x, **kwargs): - B, C, H, W = x.shape - x = self.proj(x) - Hp, Wp = x.shape[2], x.shape[3] - - x = x.flatten(2).transpose(1, 2) - return x, (Hp, Wp) - - -class HybridEmbed(nn.Module): - """ CNN Feature Map Embedding - Extract feature map from CNN, flatten, project to embedding dim. - """ - - def __init__(self, backbone, img_size=224, feature_size=None, in_chans=3, embed_dim=768): - super().__init__() - assert isinstance(backbone, nn.Module) - img_size = to_2tuple(img_size) - self.img_size = img_size - self.backbone = backbone - if feature_size is None: - with torch.no_grad(): - training = backbone.training - if training: - backbone.eval() - o = self.backbone(torch.zeros(1, in_chans, img_size[0], img_size[1]))[-1] - feature_size = o.shape[-2:] - feature_dim = o.shape[1] - backbone.train(training) - else: - feature_size = to_2tuple(feature_size) - feature_dim = self.backbone.feature_info.channels()[-1] - self.num_patches = feature_size[0] * feature_size[1] - self.proj = nn.Linear(feature_dim, embed_dim) - - def forward(self, x): - x = self.backbone(x)[-1] - x = x.flatten(2).transpose(1, 2) - x = self.proj(x) - return x - - -# @BACKBONES.register_module() -class ViT(nn.Module): - - def __init__(self, - img_size=224, patch_size=16, in_chans=3, num_classes=80, embed_dim=768, depth=12, - num_heads=12, mlp_ratio=4., qkv_bias=False, qk_scale=None, drop_rate=0., attn_drop_rate=0., - drop_path_rate=0., hybrid_backbone=None, norm_layer=None, use_checkpoint=False, - frozen_stages=-1, ratio=1, last_norm=True, - patch_padding='pad', freeze_attn=False, freeze_ffn=False, - ): - # Protect mutable default arguments - super(ViT, self).__init__() - norm_layer = norm_layer or partial(nn.LayerNorm, eps=1e-6) - self.num_classes = num_classes - self.num_features = self.embed_dim = embed_dim # num_features for consistency with other models - self.frozen_stages = frozen_stages - self.use_checkpoint = use_checkpoint - self.patch_padding = patch_padding - self.freeze_attn = freeze_attn - self.freeze_ffn = freeze_ffn - self.depth = depth - - if hybrid_backbone is not None: - self.patch_embed = HybridEmbed( - hybrid_backbone, img_size=img_size, in_chans=in_chans, embed_dim=embed_dim) - else: - self.patch_embed = PatchEmbed( - img_size=img_size, patch_size=patch_size, in_chans=in_chans, embed_dim=embed_dim, ratio=ratio) - num_patches = self.patch_embed.num_patches - - # since the pretraining model has class token - self.pos_embed = nn.Parameter(torch.zeros(1, num_patches + 1, embed_dim)) - - dpr = [x.item() for x in torch.linspace(0, drop_path_rate, depth)] # stochastic depth decay rule - - self.blocks = nn.ModuleList([ - Block( - dim=embed_dim, num_heads=num_heads, mlp_ratio=mlp_ratio, qkv_bias=qkv_bias, qk_scale=qk_scale, - drop=drop_rate, attn_drop=attn_drop_rate, drop_path=dpr[i], norm_layer=norm_layer, - ) - for i in range(depth)]) - - self.last_norm = norm_layer(embed_dim) if last_norm else nn.Identity() - - if self.pos_embed is not None: - trunc_normal_(self.pos_embed, std=.02) - - self._freeze_stages() - - def _freeze_stages(self): - """Freeze parameters.""" - if self.frozen_stages >= 0: - self.patch_embed.eval() - for param in self.patch_embed.parameters(): - param.requires_grad = False - - for i in range(1, self.frozen_stages + 1): - m = self.blocks[i] - m.eval() - for param in m.parameters(): - param.requires_grad = False - - if self.freeze_attn: - for i in range(0, self.depth): - m = self.blocks[i] - m.attn.eval() - m.norm1.eval() - for param in m.attn.parameters(): - param.requires_grad = False - for param in m.norm1.parameters(): - param.requires_grad = False - - if self.freeze_ffn: - self.pos_embed.requires_grad = False - self.patch_embed.eval() - for param in self.patch_embed.parameters(): - param.requires_grad = False - for i in range(0, self.depth): - m = self.blocks[i] - m.mlp.eval() - m.norm2.eval() - for param in m.mlp.parameters(): - param.requires_grad = False - for param in m.norm2.parameters(): - param.requires_grad = False - - def init_weights(self, pretrained=None): - """Initialize the weights in backbone. - Args: - pretrained (str, optional): Path to pre-trained weights. - Defaults to None. - """ - super().init_weights(pretrained, patch_padding=self.patch_padding) - - if pretrained is None: - def _init_weights(m): - if isinstance(m, nn.Linear): - trunc_normal_(m.weight, std=.02) - if isinstance(m, nn.Linear) and m.bias is not None: - nn.init.constant_(m.bias, 0) - elif isinstance(m, nn.LayerNorm): - nn.init.constant_(m.bias, 0) - nn.init.constant_(m.weight, 1.0) - - self.apply(_init_weights) - - def get_num_layers(self): - return len(self.blocks) - - @torch.jit.ignore - def no_weight_decay(self): - return {'pos_embed', 'cls_token'} - - def forward_features(self, x): - B, C, H, W = x.shape - x, (Hp, Wp) = self.patch_embed(x) - - if self.pos_embed is not None: - # fit for multiple GPU training - # since the first element for pos embed (sin-cos manner) is zero, it will cause no difference - x = x + self.pos_embed[:, 1:] + self.pos_embed[:, :1] - - for blk in self.blocks: - if self.use_checkpoint: - x = checkpoint.checkpoint(blk, x) - else: - x = blk(x) - - x = self.last_norm(x) - - xp = x.permute(0, 2, 1).reshape(B, -1, Hp, Wp).contiguous() - - return xp - - def forward(self, x): - x = self.forward_features(x) - return x - - def train(self, mode=True): - """Convert the model into training mode.""" - super().train(mode) - self._freeze_stages() diff --git a/spaces/happiestminds/trackbot/db_schema.sql b/spaces/happiestminds/trackbot/db_schema.sql deleted file mode 100644 index f1f3e9a7fed89f6a6b54756d0853d905ec2c5547..0000000000000000000000000000000000000000 --- a/spaces/happiestminds/trackbot/db_schema.sql +++ /dev/null @@ -1,108 +0,0 @@ --- SQLite Database Schema for Shipping Application - --- Static Tables -CREATE TABLE Manufacturers ( - ManufacturerID INTEGER PRIMARY KEY, - Name TEXT NOT NULL -); - -CREATE TABLE Showrooms ( - ShowroomID INTEGER PRIMARY KEY, - Name TEXT NOT NULL, - DestinationLocationID INTEGER, - FOREIGN KEY (DestinationLocationID) REFERENCES Locations(LocationID) -); - -CREATE TABLE ShippingModes ( - ModeID INTEGER PRIMARY KEY, - Name TEXT NOT NULL -); - --- Table for Shipment Status -CREATE TABLE Status ( - StatusID INTEGER PRIMARY KEY, - Description TEXT NOT NULL CHECK (Description IN ('CREATED', 'IN-TRANSIT', 'AT-WAREHOUSE', 'DELIVERED')) -); - --- Table for Locations -CREATE TABLE Locations ( - LocationID INTEGER PRIMARY KEY, - Name TEXT NOT NULL, - GMapsURL TEXT -); - --- New table for Customers -CREATE TABLE Customers ( - CustomerID INTEGER PRIMARY KEY, - Name TEXT NOT NULL, - Email TEXT, - ContactNumber TEXT - --, HashedPassword TEXT -- optional, for authentication -); - --- Dynamic Tables -CREATE TABLE Consignments ( - ConsignmentID INTEGER PRIMARY KEY, - ManufacturerID INTEGER, - SourceLocationID INTEGER, - DestinationLocationID INTEGER, - CurrentLocationID INTEGER, - ETA DATETIME, - FOREIGN KEY (ManufacturerID) REFERENCES Manufacturers(ManufacturerID), - FOREIGN KEY (SourceLocationID) REFERENCES Locations(LocationID), - FOREIGN KEY (DestinationLocationID) REFERENCES Locations(LocationID), - FOREIGN KEY (CurrentLocationID) REFERENCES Locations(LocationID) -); - -CREATE TABLE Vehicles ( - VIN TEXT PRIMARY KEY, - ConsignmentID INTEGER, - FOREIGN KEY (ConsignmentID) REFERENCES Consignments(ConsignmentID) -); - -CREATE TABLE Consignment_Showroom ( - ConsignmentID INTEGER, - ShowroomID INTEGER, - PRIMARY KEY (ConsignmentID, ShowroomID), - FOREIGN KEY (ConsignmentID) REFERENCES Consignments(ConsignmentID), - FOREIGN KEY (ShowroomID) REFERENCES Showrooms(ShowroomID) -); - -CREATE TABLE Consignment_ShippingMode ( - ConsignmentID INTEGER, - ModeID INTEGER, - PRIMARY KEY (ConsignmentID, ModeID), - FOREIGN KEY (ConsignmentID) REFERENCES Consignments(ConsignmentID), - FOREIGN KEY (ModeID) REFERENCES ShippingModes(ModeID) -); - --- Modified table to include Location for each status update -CREATE TABLE Consignment_Status ( - ConsignmentID INTEGER, - StatusID INTEGER, - LocationID INTEGER, - Timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (ConsignmentID) REFERENCES Consignments(ConsignmentID), - FOREIGN KEY (StatusID) REFERENCES Status(StatusID), - FOREIGN KEY (LocationID) REFERENCES Locations(LocationID) -); - --- Table for Consignment Events -CREATE TABLE Consignment_Events ( - EventID INTEGER PRIMARY KEY, - ConsignmentID INTEGER, - StatusID INTEGER, - Timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (ConsignmentID) REFERENCES Consignments(ConsignmentID), - FOREIGN KEY (StatusID) REFERENCES Status(StatusID) -); - --- New table to associate Customers with their Vehicles -CREATE TABLE Customer_Vehicles ( - CustomerID INTEGER, - VIN TEXT, - PRIMARY KEY (CustomerID, VIN), - FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID), - FOREIGN KEY (VIN) REFERENCES Vehicles(VIN) -); - diff --git a/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/detectron2/utils/env.py b/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/detectron2/utils/env.py deleted file mode 100644 index 6769cae4cfb71ae05c605cb9e30eb12ee58c6ee7..0000000000000000000000000000000000000000 --- a/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/detectron2/utils/env.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -import importlib -import importlib.util -import logging -import numpy as np -import os -import random -import sys -from datetime import datetime -import torch - -__all__ = ["seed_all_rng"] - - -def seed_all_rng(seed=None): - """ - Set the random seed for the RNG in torch, numpy and python. - - Args: - seed (int): if None, will use a strong random seed. - """ - if seed is None: - seed = ( - os.getpid() - + int(datetime.now().strftime("%S%f")) - + int.from_bytes(os.urandom(2), "big") - ) - logger = logging.getLogger(__name__) - logger.info("Using a generated random seed {}".format(seed)) - np.random.seed(seed) - torch.set_rng_state(torch.manual_seed(seed).get_state()) - random.seed(seed) - - -# from https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path -def _import_file(module_name, file_path, make_importable=False): - spec = importlib.util.spec_from_file_location(module_name, file_path) - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - if make_importable: - sys.modules[module_name] = module - return module - - -def _configure_libraries(): - """ - Configurations for some libraries. - """ - # An environment option to disable `import cv2` globally, - # in case it leads to negative performance impact - disable_cv2 = int(os.environ.get("DETECTRON2_DISABLE_CV2", False)) - if disable_cv2: - sys.modules["cv2"] = None - else: - # Disable opencl in opencv since its interaction with cuda often has negative effects - # This envvar is supported after OpenCV 3.4.0 - os.environ["OPENCV_OPENCL_RUNTIME"] = "disabled" - try: - import cv2 - - if int(cv2.__version__.split(".")[0]) >= 3: - cv2.ocl.setUseOpenCL(False) - except ImportError: - pass - - def get_version(module, digit=2): - return tuple(map(int, module.__version__.split(".")[:digit])) - - # fmt: off - assert get_version(torch) >= (1, 4), "Requires torch>=1.4" - import fvcore - assert get_version(fvcore, 3) >= (0, 1, 1), "Requires fvcore>=0.1.1" - import yaml - assert get_version(yaml) >= (5, 1), "Requires pyyaml>=5.1" - # fmt: on - - -_ENV_SETUP_DONE = False - - -def setup_environment(): - """Perform environment setup work. The default setup is a no-op, but this - function allows the user to specify a Python source file or a module in - the $DETECTRON2_ENV_MODULE environment variable, that performs - custom setup work that may be necessary to their computing environment. - """ - global _ENV_SETUP_DONE - if _ENV_SETUP_DONE: - return - _ENV_SETUP_DONE = True - - _configure_libraries() - - custom_module_path = os.environ.get("DETECTRON2_ENV_MODULE") - - if custom_module_path: - setup_custom_environment(custom_module_path) - else: - # The default setup is a no-op - pass - - -def setup_custom_environment(custom_module): - """ - Load custom environment setup by importing a Python source file or a - module, and run the setup function. - """ - if custom_module.endswith(".py"): - module = _import_file("detectron2.utils.env.custom_module", custom_module) - else: - module = importlib.import_module(custom_module) - assert hasattr(module, "setup_environment") and callable(module.setup_environment), ( - "Custom environment module defined in {} does not have the " - "required callable attribute 'setup_environment'." - ).format(custom_module) - module.setup_environment() diff --git a/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/projects/PointRend/point_rend/color_augmentation.py b/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/projects/PointRend/point_rend/color_augmentation.py deleted file mode 100644 index 27344c470adac143186e61c8a5b0f39900937634..0000000000000000000000000000000000000000 --- a/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/projects/PointRend/point_rend/color_augmentation.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -import numpy as np -import random -import cv2 -from fvcore.transforms.transform import Transform - - -class ColorAugSSDTransform(Transform): - """ - A color related data augmentation used in Single Shot Multibox Detector (SSD). - - Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, - Scott Reed, Cheng-Yang Fu, Alexander C. Berg. - SSD: Single Shot MultiBox Detector. ECCV 2016. - - Implementation based on: - - https://github.com/weiliu89/caffe/blob - /4817bf8b4200b35ada8ed0dc378dceaf38c539e4 - /src/caffe/util/im_transforms.cpp - - https://github.com/chainer/chainercv/blob - /7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv - /links/model/ssd/transforms.py - """ - - def __init__( - self, - img_format, - brightness_delta=32, - contrast_low=0.5, - contrast_high=1.5, - saturation_low=0.5, - saturation_high=1.5, - hue_delta=18, - ): - super().__init__() - assert img_format in ["BGR", "RGB"] - self.is_rgb = img_format == "RGB" - del img_format - self._set_attributes(locals()) - - def apply_coords(self, coords): - return coords - - def apply_segmentation(self, segmentation): - return segmentation - - def apply_image(self, img, interp=None): - if self.is_rgb: - img = img[:, :, [2, 1, 0]] - img = self.brightness(img) - if random.randrange(2): - img = self.contrast(img) - img = self.saturation(img) - img = self.hue(img) - else: - img = self.saturation(img) - img = self.hue(img) - img = self.contrast(img) - if self.is_rgb: - img = img[:, :, [2, 1, 0]] - return img - - def convert(self, img, alpha=1, beta=0): - img = img.astype(np.float32) * alpha + beta - img = np.clip(img, 0, 255) - return img.astype(np.uint8) - - def brightness(self, img): - if random.randrange(2): - return self.convert( - img, beta=random.uniform(-self.brightness_delta, self.brightness_delta) - ) - return img - - def contrast(self, img): - if random.randrange(2): - return self.convert(img, alpha=random.uniform(self.contrast_low, self.contrast_high)) - return img - - def saturation(self, img): - if random.randrange(2): - img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) - img[:, :, 1] = self.convert( - img[:, :, 1], alpha=random.uniform(self.saturation_low, self.saturation_high) - ) - return cv2.cvtColor(img, cv2.COLOR_HSV2BGR) - return img - - def hue(self, img): - if random.randrange(2): - img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) - img[:, :, 0] = ( - img[:, :, 0].astype(int) + random.randint(-self.hue_delta, self.hue_delta) - ) % 180 - return cv2.cvtColor(img, cv2.COLOR_HSV2BGR) - return img diff --git a/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/tools/benchmark.py b/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/tools/benchmark.py deleted file mode 100644 index 9eec59f476882e4045ec3c682ffe515413a3be15..0000000000000000000000000000000000000000 --- a/spaces/hasibzunair/fifa-tryon-demo/Self-Correction-Human-Parsing-for-ACGPN/mhp_extension/detectron2/tools/benchmark.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -""" -A script to benchmark builtin models. - -Note: this script has an extra dependency of psutil. -""" - -import itertools -import logging -import psutil -import torch -import tqdm -from fvcore.common.timer import Timer -from torch.nn.parallel import DistributedDataParallel - -from detectron2.checkpoint import DetectionCheckpointer -from detectron2.config import get_cfg -from detectron2.data import ( - DatasetFromList, - build_detection_test_loader, - build_detection_train_loader, -) -from detectron2.engine import SimpleTrainer, default_argument_parser, hooks, launch -from detectron2.modeling import build_model -from detectron2.solver import build_optimizer -from detectron2.utils import comm -from detectron2.utils.events import CommonMetricPrinter -from detectron2.utils.logger import setup_logger - -logger = logging.getLogger("detectron2") - - -def setup(args): - cfg = get_cfg() - cfg.merge_from_file(args.config_file) - cfg.SOLVER.BASE_LR = 0.001 # Avoid NaNs. Not useful in this script anyway. - cfg.merge_from_list(args.opts) - cfg.freeze() - setup_logger(distributed_rank=comm.get_rank()) - return cfg - - -def benchmark_data(args): - cfg = setup(args) - - timer = Timer() - dataloader = build_detection_train_loader(cfg) - logger.info("Initialize loader using {} seconds.".format(timer.seconds())) - - timer.reset() - itr = iter(dataloader) - for i in range(10): # warmup - next(itr) - if i == 0: - startup_time = timer.seconds() - timer = Timer() - max_iter = 1000 - for _ in tqdm.trange(max_iter): - next(itr) - logger.info( - "{} iters ({} images) in {} seconds.".format( - max_iter, max_iter * cfg.SOLVER.IMS_PER_BATCH, timer.seconds() - ) - ) - logger.info("Startup time: {} seconds".format(startup_time)) - vram = psutil.virtual_memory() - logger.info( - "RAM Usage: {:.2f}/{:.2f} GB".format( - (vram.total - vram.available) / 1024 ** 3, vram.total / 1024 ** 3 - ) - ) - - # test for a few more rounds - for _ in range(10): - timer = Timer() - max_iter = 1000 - for _ in tqdm.trange(max_iter): - next(itr) - logger.info( - "{} iters ({} images) in {} seconds.".format( - max_iter, max_iter * cfg.SOLVER.IMS_PER_BATCH, timer.seconds() - ) - ) - - -def benchmark_train(args): - cfg = setup(args) - model = build_model(cfg) - logger.info("Model:\n{}".format(model)) - if comm.get_world_size() > 1: - model = DistributedDataParallel( - model, device_ids=[comm.get_local_rank()], broadcast_buffers=False - ) - optimizer = build_optimizer(cfg, model) - checkpointer = DetectionCheckpointer(model, optimizer=optimizer) - checkpointer.load(cfg.MODEL.WEIGHTS) - - cfg.defrost() - cfg.DATALOADER.NUM_WORKERS = 0 - data_loader = build_detection_train_loader(cfg) - dummy_data = list(itertools.islice(data_loader, 100)) - - def f(): - data = DatasetFromList(dummy_data, copy=False) - while True: - yield from data - - max_iter = 400 - trainer = SimpleTrainer(model, f(), optimizer) - trainer.register_hooks( - [hooks.IterationTimer(), hooks.PeriodicWriter([CommonMetricPrinter(max_iter)])] - ) - trainer.train(1, max_iter) - - -@torch.no_grad() -def benchmark_eval(args): - cfg = setup(args) - model = build_model(cfg) - model.eval() - logger.info("Model:\n{}".format(model)) - DetectionCheckpointer(model).load(cfg.MODEL.WEIGHTS) - - cfg.defrost() - cfg.DATALOADER.NUM_WORKERS = 0 - data_loader = build_detection_test_loader(cfg, cfg.DATASETS.TEST[0]) - dummy_data = list(itertools.islice(data_loader, 100)) - - def f(): - while True: - yield from DatasetFromList(dummy_data, copy=False) - - for _ in range(5): # warmup - model(dummy_data[0]) - - max_iter = 400 - timer = Timer() - with tqdm.tqdm(total=max_iter) as pbar: - for idx, d in enumerate(f()): - if idx == max_iter: - break - model(d) - pbar.update() - logger.info("{} iters in {} seconds.".format(max_iter, timer.seconds())) - - -if __name__ == "__main__": - parser = default_argument_parser() - parser.add_argument("--task", choices=["train", "eval", "data"], required=True) - args = parser.parse_args() - assert not args.eval_only - - if args.task == "data": - f = benchmark_data - elif args.task == "train": - """ - Note: training speed may not be representative. - The training cost of a R-CNN model varies with the content of the data - and the quality of the model. - """ - f = benchmark_train - elif args.task == "eval": - f = benchmark_eval - # only benchmark single-GPU inference. - assert args.num_gpus == 1 and args.num_machines == 1 - launch(f, args.num_gpus, args.num_machines, args.machine_rank, args.dist_url, args=(args,)) diff --git a/spaces/hezhaoqia/vits-simple-api/vits/vits.py b/spaces/hezhaoqia/vits-simple-api/vits/vits.py deleted file mode 100644 index 21c06c33feaae3d84e6312fc5caf9d77fd1070d1..0000000000000000000000000000000000000000 --- a/spaces/hezhaoqia/vits-simple-api/vits/vits.py +++ /dev/null @@ -1,243 +0,0 @@ -import librosa -from vits import commons -import re -import numpy as np -import torch -from torch import no_grad, LongTensor, inference_mode, FloatTensor -from utils.nlp import sentence_split -from vits.mel_processing import spectrogram_torch -from vits.text import text_to_sequence -from vits.models import SynthesizerTrn -from utils import utils - - -class VITS: - def __init__(self, model, config, model_=None, model_type=None, device=torch.device("cpu")): - self.model_type = model_type - self.hps_ms = utils.get_hparams_from_file(config) - self.n_speakers = getattr(self.hps_ms.data, 'n_speakers', 0) - self.n_symbols = len(getattr(self.hps_ms, 'symbols', [])) - self.speakers = getattr(self.hps_ms, 'speakers', ['0']) - if not isinstance(self.speakers, list): - self.speakers = [item[0] for item in sorted(list(self.speakers.items()), key=lambda x: x[1])] - self.use_f0 = getattr(self.hps_ms.data, 'use_f0', False) - self.emotion_embedding = getattr(self.hps_ms.data, 'emotion_embedding', - getattr(self.hps_ms.model, 'emotion_embedding', False)) - self.bert_embedding = getattr(self.hps_ms.data, 'bert_embedding', - getattr(self.hps_ms.model, 'bert_embedding', False)) - self.hps_ms.model.emotion_embedding = self.emotion_embedding - self.hps_ms.model.bert_embedding = self.bert_embedding - - self.net_g_ms = SynthesizerTrn( - self.n_symbols, - self.hps_ms.data.filter_length // 2 + 1, - self.hps_ms.train.segment_size // self.hps_ms.data.hop_length, - n_speakers=self.n_speakers, - **self.hps_ms.model) - _ = self.net_g_ms.eval() - self.device = device - - # load model - self.load_model(model, model_) - - def load_model(self, model, model_=None): - utils.load_checkpoint(model, self.net_g_ms) - self.net_g_ms.to(self.device) - if self.model_type == "hubert": - self.hubert = model_ - elif self.model_type == "w2v2": - self.emotion_reference = model_ - - def get_cleaned_text(self, text, hps, cleaned=False): - if cleaned: - text_norm = text_to_sequence(text, hps.symbols, []) - else: - if self.bert_embedding: - text_norm, char_embed = text_to_sequence(text, hps.symbols, hps.data.text_cleaners, - bert_embedding=self.bert_embedding) - text_norm = LongTensor(text_norm) - return text_norm, char_embed - else: - text_norm = text_to_sequence(text, hps.symbols, hps.data.text_cleaners) - if hps.data.add_blank: - text_norm = commons.intersperse(text_norm, 0) - text_norm = LongTensor(text_norm) - return text_norm - - def get_cleaner(self): - return getattr(self.hps_ms.data, 'text_cleaners', [None])[0] - - def get_speakers(self, escape=False): - return self.speakers - - def infer(self, params): - with no_grad(): - x_tst = params.get("stn_tst").unsqueeze(0).to(self.device) - x_tst_lengths = LongTensor([params.get("stn_tst").size(0)]).to(self.device) - x_tst_prosody = torch.FloatTensor(params.get("char_embeds")).unsqueeze(0).to( - self.device) if self.bert_embedding else None - sid = params.get("sid").to(self.device) if not self.bert_embedding else None - emotion = params.get("emotion").to(self.device) if self.emotion_embedding else None - - audio = self.net_g_ms.infer(x=x_tst, - x_lengths=x_tst_lengths, - sid=sid, - noise_scale=params.get("noise_scale"), - noise_scale_w=params.get("noise_scale_w"), - length_scale=params.get("length_scale"), - emotion_embedding=emotion, - bert=x_tst_prosody)[0][0, 0].data.float().cpu().numpy() - - torch.cuda.empty_cache() - - return audio - - def get_infer_param(self, length_scale, noise_scale, noise_scale_w, text=None, speaker_id=None, audio_path=None, - emotion=None, cleaned=False, f0_scale=1): - emo = None - char_embeds = None - if self.model_type != "hubert": - if self.bert_embedding: - stn_tst, char_embeds = self.get_cleaned_text(text, self.hps_ms, cleaned=cleaned) - sid = None - else: - stn_tst = self.get_cleaned_text(text, self.hps_ms, cleaned=cleaned) - sid = LongTensor([speaker_id]) - - if self.model_type == "w2v2": - # if emotion_reference.endswith('.npy'): - # emotion = np.load(emotion_reference) - # emotion = FloatTensor(emotion).unsqueeze(0) - # else: - # audio16000, sampling_rate = librosa.load( - # emotion_reference, sr=16000, mono=True) - # emotion = self.w2v2(audio16000, sampling_rate)[ - # 'hidden_states'] - # emotion_reference = re.sub( - # r'\..*$', '', emotion_reference) - # np.save(emotion_reference, emotion.squeeze(0)) - # emotion = FloatTensor(emotion) - emo = torch.FloatTensor(self.emotion_reference[emotion]).unsqueeze(0) - - - elif self.model_type == "hubert": - if self.use_f0: - audio, sampling_rate = librosa.load(audio_path, sr=self.hps_ms.data.sampling_rate, mono=True) - audio16000 = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000) - else: - audio16000, sampling_rate = librosa.load(audio_path, sr=16000, mono=True) - - with inference_mode(): - units = self.hubert.units(FloatTensor(audio16000).unsqueeze(0).unsqueeze(0)).squeeze(0).numpy() - if self.use_f0: - f0 = librosa.pyin(audio, - sr=sampling_rate, - fmin=librosa.note_to_hz('C0'), - fmax=librosa.note_to_hz('C7'), - frame_length=1780)[0] - target_length = len(units[:, 0]) - f0 = np.nan_to_num(np.interp(np.arange(0, len(f0) * target_length, len(f0)) / target_length, - np.arange(0, len(f0)), f0)) * f0_scale - units[:, 0] = f0 / 10 - - stn_tst = FloatTensor(units) - sid = LongTensor([speaker_id]) - params = {"length_scale": length_scale, "noise_scale": noise_scale, - "noise_scale_w": noise_scale_w, "stn_tst": stn_tst, - "sid": sid, "emotion": emo, "char_embeds": char_embeds} - - return params - - def get_tasks(self, voice): - text = voice.get("text", None) - speaker_id = voice.get("id", 0) - length = voice.get("length", 1) - noise = voice.get("noise", 0.667) - noisew = voice.get("noisew", 0.8) - max = voice.get("max", 50) - lang = voice.get("lang", "auto") - speaker_lang = voice.get("speaker_lang", None) - audio_path = voice.get("audio_path", None) - emotion = voice.get("emotion", 0) - - # 去除所有多余的空白字符 - if text is not None: text = re.sub(r'\s+', ' ', text).strip() - - tasks = [] - if self.model_type == "vits": - sentence_list = sentence_split(text, max, lang, speaker_lang) - for sentence in sentence_list: - params = self.get_infer_param(text=sentence, speaker_id=speaker_id, length_scale=length, - noise_scale=noise, noise_scale_w=noisew) - tasks.append(params) - - elif self.model_type == "hubert": - params = self.get_infer_param(speaker_id=speaker_id, length_scale=length, noise_scale=noise, - noise_scale_w=noisew, audio_path=audio_path) - tasks.append(params) - - elif self.model_type == "w2v2": - sentence_list = sentence_split(text, max, lang, speaker_lang) - for sentence in sentence_list: - params = self.get_infer_param(text=sentence, speaker_id=speaker_id, length_scale=length, - noise_scale=noise, noise_scale_w=noisew, emotion=emotion) - tasks.append(params) - - return tasks - - def get_audio(self, voice, auto_break=False): - tasks = self.get_tasks(voice) - # 停顿0.75s,避免语音分段合成再拼接后的连接突兀 - brk = np.zeros(int(0.75 * 22050), dtype=np.int16) - - audios = [] - for task in tasks: - if auto_break: - chunk = np.concatenate((self.infer(task), brk), axis=0) - else: - chunk = self.infer(task) - audios.append(chunk) - - audio = np.concatenate(audios, axis=0) - return audio - - def get_stream_audio(self, voice, auto_break=False): - tasks = self.get_tasks(voice) - - brk = np.zeros(int(0.75 * 22050), dtype=np.int16) - - for task in tasks: - if auto_break: - chunk = np.concatenate((self.infer(task), brk), axis=0) - else: - chunk = self.infer(task) - - yield chunk - - def voice_conversion(self, voice): - audio_path = voice.get("audio_path") - original_id = voice.get("original_id") - target_id = voice.get("target_id") - - audio = utils.load_audio_to_torch( - audio_path, self.hps_ms.data.sampling_rate) - - y = audio.unsqueeze(0) - - spec = spectrogram_torch(y, self.hps_ms.data.filter_length, - self.hps_ms.data.sampling_rate, self.hps_ms.data.hop_length, - self.hps_ms.data.win_length, - center=False) - spec_lengths = LongTensor([spec.size(-1)]) - sid_src = LongTensor([original_id]) - - with no_grad(): - sid_tgt = LongTensor([target_id]) - audio = self.net_g_ms.voice_conversion(spec.to(self.device), - spec_lengths.to(self.device), - sid_src=sid_src.to(self.device), - sid_tgt=sid_tgt.to(self.device))[0][0, 0].data.cpu().float().numpy() - - torch.cuda.empty_cache() - - return audio diff --git a/spaces/hhalim/EleutherAI-gpt-j-6B/app.py b/spaces/hhalim/EleutherAI-gpt-j-6B/app.py deleted file mode 100644 index b4ab9549994514c1b64784efe8b81534bb3fde6e..0000000000000000000000000000000000000000 --- a/spaces/hhalim/EleutherAI-gpt-j-6B/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/EleutherAI/gpt-j-6B").launch() \ No newline at end of file diff --git a/spaces/huaiji3y/bingo-Public/src/components/ui/input.tsx b/spaces/huaiji3y/bingo-Public/src/components/ui/input.tsx deleted file mode 100644 index 684a857f3d769b78818fb13de1abaebfb09ca79c..0000000000000000000000000000000000000000 --- a/spaces/huaiji3y/bingo-Public/src/components/ui/input.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from 'react' - -import { cn } from '@/lib/utils' - -export interface InputProps - extends React.InputHTMLAttributes {} - -const Input = React.forwardRef( - ({ className, type, ...props }, ref) => { - return ( - - ) - } -) -Input.displayName = 'Input' - -export { Input } diff --git a/spaces/huggingface-course/amazon-reviews-demo/README.md b/spaces/huggingface-course/amazon-reviews-demo/README.md deleted file mode 100644 index cfb6b4baae95773877d22b9c02ff3ab222449717..0000000000000000000000000000000000000000 --- a/spaces/huggingface-course/amazon-reviews-demo/README.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Amazon Reviews Demo -emoji: 🚀 -colorFrom: pink -colorTo: blue -sdk: gradio -app_file: app.py -pinned: false ---- - -# Configuration - -`title`: _string_ -Display title for the Space - -`emoji`: _string_ -Space emoji (emoji-only character allowed) - -`colorFrom`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`colorTo`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`sdk`: _string_ -Can be either `gradio` or `streamlit` - -`sdk_version` : _string_ -Only applicable for `streamlit` SDK. -See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions. - -`app_file`: _string_ -Path to your main application file (which contains either `gradio` or `streamlit` Python code). -Path is relative to the root of the repository. - -`pinned`: _boolean_ -Whether the Space stays on top of your list. diff --git a/spaces/hysts/ViTPose_video/model.py b/spaces/hysts/ViTPose_video/model.py deleted file mode 100644 index 56123e755f8e891d1a85428d6959a597ec488390..0000000000000000000000000000000000000000 --- a/spaces/hysts/ViTPose_video/model.py +++ /dev/null @@ -1,271 +0,0 @@ -from __future__ import annotations - -import os -import shlex -import subprocess -import sys -import tempfile - -if os.getenv('SYSTEM') == 'spaces': - import mim - - mim.uninstall('mmcv-full', confirm_yes=True) - mim.install('mmcv-full==1.5.0', is_yes=True) - - subprocess.call(shlex.split('pip uninstall -y opencv-python')) - subprocess.call(shlex.split('pip uninstall -y opencv-python-headless')) - subprocess.call( - shlex.split('pip install opencv-python-headless==4.8.0.74')) - -import cv2 -import huggingface_hub -import numpy as np -import torch -import torch.nn as nn - -sys.path.insert(0, 'ViTPose/') - -from mmdet.apis import inference_detector, init_detector -from mmpose.apis import (inference_top_down_pose_model, init_pose_model, - process_mmdet_results, vis_pose_result) - - -class DetModel: - MODEL_DICT = { - 'YOLOX-tiny': { - 'config': - 'mmdet_configs/configs/yolox/yolox_tiny_8x8_300e_coco.py', - 'model': - 'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_tiny_8x8_300e_coco/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth', - }, - 'YOLOX-s': { - 'config': - 'mmdet_configs/configs/yolox/yolox_s_8x8_300e_coco.py', - 'model': - 'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_s_8x8_300e_coco/yolox_s_8x8_300e_coco_20211121_095711-4592a793.pth', - }, - 'YOLOX-l': { - 'config': - 'mmdet_configs/configs/yolox/yolox_l_8x8_300e_coco.py', - 'model': - 'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_l_8x8_300e_coco/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth', - }, - 'YOLOX-x': { - 'config': - 'mmdet_configs/configs/yolox/yolox_x_8x8_300e_coco.py', - 'model': - 'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_x_8x8_300e_coco/yolox_x_8x8_300e_coco_20211126_140254-1ef88d67.pth', - }, - } - - def __init__(self): - self.device = torch.device( - 'cuda:0' if torch.cuda.is_available() else 'cpu') - self._load_all_models_once() - self.model_name = 'YOLOX-l' - self.model = self._load_model(self.model_name) - - def _load_all_models_once(self) -> None: - for name in self.MODEL_DICT: - self._load_model(name) - - def _load_model(self, name: str) -> nn.Module: - d = self.MODEL_DICT[name] - return init_detector(d['config'], d['model'], device=self.device) - - def set_model(self, name: str) -> None: - if name == self.model_name: - return - self.model_name = name - self.model = self._load_model(name) - - def detect_and_visualize( - self, image: np.ndarray, - score_threshold: float) -> tuple[list[np.ndarray], np.ndarray]: - out = self.detect(image) - vis = self.visualize_detection_results(image, out, score_threshold) - return out, vis - - def detect(self, image: np.ndarray) -> list[np.ndarray]: - image = image[:, :, ::-1] # RGB -> BGR - out = inference_detector(self.model, image) - return out - - def visualize_detection_results( - self, - image: np.ndarray, - detection_results: list[np.ndarray], - score_threshold: float = 0.3) -> np.ndarray: - person_det = [detection_results[0]] + [np.array([]).reshape(0, 5)] * 79 - - image = image[:, :, ::-1] # RGB -> BGR - vis = self.model.show_result(image, - person_det, - score_thr=score_threshold, - bbox_color=None, - text_color=(200, 200, 200), - mask_color=None) - return vis[:, :, ::-1] # BGR -> RGB - - -class PoseModel: - MODEL_DICT = { - 'ViTPose-B (single-task train)': { - 'config': - 'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_base_coco_256x192.py', - 'model': 'models/vitpose-b.pth', - }, - 'ViTPose-L (single-task train)': { - 'config': - 'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_large_coco_256x192.py', - 'model': 'models/vitpose-l.pth', - }, - 'ViTPose-B (multi-task train, COCO)': { - 'config': - 'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_base_coco_256x192.py', - 'model': 'models/vitpose-b-multi-coco.pth', - }, - 'ViTPose-L (multi-task train, COCO)': { - 'config': - 'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_large_coco_256x192.py', - 'model': 'models/vitpose-l-multi-coco.pth', - }, - } - - def __init__(self): - self.device = torch.device( - 'cuda:0' if torch.cuda.is_available() else 'cpu') - self.model_name = 'ViTPose-B (multi-task train, COCO)' - self.model = self._load_model(self.model_name) - - def _load_all_models_once(self) -> None: - for name in self.MODEL_DICT: - self._load_model(name) - - def _load_model(self, name: str) -> nn.Module: - d = self.MODEL_DICT[name] - ckpt_path = huggingface_hub.hf_hub_download('public-data/ViTPose', - d['model']) - model = init_pose_model(d['config'], ckpt_path, device=self.device) - return model - - def set_model(self, name: str) -> None: - if name == self.model_name: - return - self.model_name = name - self.model = self._load_model(name) - - def predict_pose_and_visualize( - self, - image: np.ndarray, - det_results: list[np.ndarray], - box_score_threshold: float, - kpt_score_threshold: float, - vis_dot_radius: int, - vis_line_thickness: int, - ) -> tuple[list[dict[str, np.ndarray]], np.ndarray]: - out = self.predict_pose(image, det_results, box_score_threshold) - vis = self.visualize_pose_results(image, out, kpt_score_threshold, - vis_dot_radius, vis_line_thickness) - return out, vis - - def predict_pose( - self, - image: np.ndarray, - det_results: list[np.ndarray], - box_score_threshold: float = 0.5) -> list[dict[str, np.ndarray]]: - image = image[:, :, ::-1] # RGB -> BGR - person_results = process_mmdet_results(det_results, 1) - out, _ = inference_top_down_pose_model(self.model, - image, - person_results=person_results, - bbox_thr=box_score_threshold, - format='xyxy') - return out - - def visualize_pose_results(self, - image: np.ndarray, - pose_results: list[dict[str, np.ndarray]], - kpt_score_threshold: float = 0.3, - vis_dot_radius: int = 4, - vis_line_thickness: int = 1) -> np.ndarray: - image = image[:, :, ::-1] # RGB -> BGR - vis = vis_pose_result(self.model, - image, - pose_results, - kpt_score_thr=kpt_score_threshold, - radius=vis_dot_radius, - thickness=vis_line_thickness) - return vis[:, :, ::-1] # BGR -> RGB - - -class AppModel: - def __init__(self): - self.det_model = DetModel() - self.pose_model = PoseModel() - - def run( - self, video_path: str, det_model_name: str, pose_model_name: str, - box_score_threshold: float, max_num_frames: int, - kpt_score_threshold: float, vis_dot_radius: int, - vis_line_thickness: int - ) -> tuple[str, list[list[dict[str, np.ndarray]]]]: - if video_path is None: - return - self.det_model.set_model(det_model_name) - self.pose_model.set_model(pose_model_name) - - cap = cv2.VideoCapture(video_path) - height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) - width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) - fps = cap.get(cv2.CAP_PROP_FPS) - - preds_all = [] - - fourcc = cv2.VideoWriter_fourcc(*'mp4v') - out_file = tempfile.NamedTemporaryFile(suffix='.mp4', delete=False) - writer = cv2.VideoWriter(out_file.name, fourcc, fps, (width, height)) - for _ in range(max_num_frames): - ok, frame = cap.read() - if not ok: - break - rgb_frame = frame[:, :, ::-1] - det_preds = self.det_model.detect(rgb_frame) - preds, vis = self.pose_model.predict_pose_and_visualize( - rgb_frame, det_preds, box_score_threshold, kpt_score_threshold, - vis_dot_radius, vis_line_thickness) - preds_all.append(preds) - writer.write(vis[:, :, ::-1]) - cap.release() - writer.release() - - return out_file.name, preds_all - - def visualize_pose_results(self, video_path: str, - pose_preds_all: list[list[dict[str, - np.ndarray]]], - kpt_score_threshold: float, vis_dot_radius: int, - vis_line_thickness: int) -> str: - if video_path is None or pose_preds_all is None: - return - cap = cv2.VideoCapture(video_path) - height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) - width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) - fps = cap.get(cv2.CAP_PROP_FPS) - - fourcc = cv2.VideoWriter_fourcc(*'mp4v') - out_file = tempfile.NamedTemporaryFile(suffix='.mp4', delete=False) - writer = cv2.VideoWriter(out_file.name, fourcc, fps, (width, height)) - for pose_preds in pose_preds_all: - ok, frame = cap.read() - if not ok: - break - rgb_frame = frame[:, :, ::-1] - vis = self.pose_model.visualize_pose_results( - rgb_frame, pose_preds, kpt_score_threshold, vis_dot_radius, - vis_line_thickness) - writer.write(vis[:, :, ::-1]) - cap.release() - writer.release() - - return out_file.name diff --git a/spaces/hyxue/HiFiFace-inference-demo/arcface_torch/configs/ms1mv2_r50.py b/spaces/hyxue/HiFiFace-inference-demo/arcface_torch/configs/ms1mv2_r50.py deleted file mode 100644 index 236721a526489b2cac7ba66a22bfc3d650e744cd..0000000000000000000000000000000000000000 --- a/spaces/hyxue/HiFiFace-inference-demo/arcface_torch/configs/ms1mv2_r50.py +++ /dev/null @@ -1,27 +0,0 @@ -from easydict import EasyDict as edict - -# make training faster -# our RAM is 256G -# mount -t tmpfs -o size=140G tmpfs /train_tmp - -config = edict() -config.margin_list = (1.0, 0.5, 0.0) -config.network = "r50" -config.resume = False -config.output = None -config.embedding_size = 512 -config.sample_rate = 1.0 -config.fp16 = True -config.momentum = 0.9 -config.weight_decay = 5e-4 -config.batch_size = 128 -config.lr = 0.1 -config.verbose = 2000 -config.dali = False - -config.rec = "/train_tmp/faces_emore" -config.num_classes = 85742 -config.num_image = 5822653 -config.num_epoch = 20 -config.warmup_epoch = 0 -config.val_targets = ["lfw", "cfp_fp", "agedb_30"] diff --git a/spaces/hzrr/dal_audio_inference/README.md b/spaces/hzrr/dal_audio_inference/README.md deleted file mode 100644 index 73d11d315c7fd003333228566808a21fa9792fa2..0000000000000000000000000000000000000000 --- a/spaces/hzrr/dal_audio_inference/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Dal Audio Inference -emoji: 📚 -colorFrom: red -colorTo: green -sdk: gradio -sdk_version: 3.9 -app_file: app.py -pinned: false ---- -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/illrapper/ill/Dockerfile b/spaces/illrapper/ill/Dockerfile deleted file mode 100644 index a4c8b4f88ec3000f75b1413a72ba55e294692201..0000000000000000000000000000000000000000 --- a/spaces/illrapper/ill/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM huggingface/autotrain-advanced:latest -CMD autotrain setup && autotrain app --port 7860 diff --git a/spaces/inamXcontru/PoeticTTS/Avatar Pc Game Activation Keygen Download Crack _HOT_.md b/spaces/inamXcontru/PoeticTTS/Avatar Pc Game Activation Keygen Download Crack _HOT_.md deleted file mode 100644 index 571792ee0e0efe4ecd94bf059c4b93f77b054d34..0000000000000000000000000000000000000000 --- a/spaces/inamXcontru/PoeticTTS/Avatar Pc Game Activation Keygen Download Crack _HOT_.md +++ /dev/null @@ -1,11 +0,0 @@ -
                -

                It's also worth mentioning that keygens are much more valuable to bad actors than cracks, becausea keygen can be used on the real application, vs the bad actor having to distribute a modified,cracked version of the application.

                -

                But remember, a crack != a keygen, so your application's licensing always runsthe risk of being circumvented via code modification. But license keys cannotbe forged when you utilize a licensing system built on modern cryptography.

                -

                Avatar Pc Game Activation Keygen Download Crack


                Download ✯✯✯ https://gohhs.com/2uz5xG



                -

                I've been using computer for 20 years and I've used many antivirus. And I have had many "cracking software" laying around on the various PCs that I have used. These include keygen, software cracks/patchers and game hacks (wallhacks, aimbots, multihacks and etc).

                -

                Because virusscanners don't like it when their paid software is cracked, it will mark any crack or keygen as unsafe to protect itself, but it is also possible that someone creates a crack and puts in a virus so that this person can later collect information about who uses their crack etc...

                -

                When it comes to knowing if keygens, cracks, hacks, etc... contain actual malicious code, I have no answer to it. It can be, and its possible it is not the case. It is often true that in order for a crack to work, it has to perform functions that viruses also do, which is why most cracks are seen as dangarous. Their tasks cannot be distinquished from viruses.

                -

                TL;DR: It does so because those cracks/keygens/etc contain a signature of the virus it detects. Whether or not it is real and why it detects that, can't be answered. Its different per usecase and per virusscanner.

                -

                aaccfb2cb3
                -
                -
                \ No newline at end of file diff --git a/spaces/inamXcontru/PoeticTTS/Bounty Hunter In Italian Free Download.md b/spaces/inamXcontru/PoeticTTS/Bounty Hunter In Italian Free Download.md deleted file mode 100644 index 4945a085ff2a8d698db29f2772da299a880293d6..0000000000000000000000000000000000000000 --- a/spaces/inamXcontru/PoeticTTS/Bounty Hunter In Italian Free Download.md +++ /dev/null @@ -1,14 +0,0 @@ -
                -

                When the Garden State's seediest crooks skip bail, it's up to lingerie buyer turned bounty hunter Stephanie Plum to track 'em down. Novelist Janet Evanovich sets her satirical thrillers in Trenton, N.J., a city Evanovich remembers from her youth. In her best-selling novels, she portrays neighborhoods with strong ethnic identities, a lot of attitude -- and plenty of food.

                -

                Bounty Hunter in italian free download


                DOWNLOADhttps://gohhs.com/2uz4CR



                -

                Plum is a scrappy if somewhat inept bounty hunter, and she'll eat anything, anytime. Evanovich admits she has her heroine's sweet tooth -- and proves it as she surveys the offerings at the Italian Peoples Bakery in Trenton: "There's apricot fingers ... shortbread ... chocolate chip snowballs ... lemon bon bons ... nut crescents ... strawberry linzer tarts." And, of course, cannolis -- a Trenton specialty.

                -

                At police headquarters, Juniak passes by the place where a bounty hunter like Stephanie might turn in one of her captures -- or "skips," as they're called. "We come to the back of the police station here," Juniak explains, "escort the prisoner through this little lobby here and into our little holding cages."

                -

                For years Dave's Dogs took the number-one slot on my list of all-time crappy jobs held. This morning, I decided my present position had finally won the honor of replacing Dave's Dogs. I'm a bounty hunter. A bond enforcement agent, if you want to make me sound more legitimate. I work for my cousin Vinnie in his bail bonds office in the Chambersburg section of Trenton. At least I used to work for my cousin Vinnie. Thirty seconds ago, I quit. I handed in the phony badge I bought off the Net. I gave back my cuffs. And I dropped my remaining open files on Connie's desk.

                -

                Truth is, I don't exactly know why I was quitting. My stomach feels icky when I get up in the morning. And I go to bed at night wondering where my life is heading. I've been working as a bounty hunter for a while now and I'm not the world's best. I barely make enough money to cover my rent each month. I've been stalked by crazed killers, taunted by naked fat men, firebombed, shot at, spat at, cussed at, chased by humping dogs, attacked by a flock of Canadian honkers, rolled in garbage, and my cars get destroyed at an alarming rate.

                -

                People love free steam games, no doubt. But what many people hate is downloading so many parts and trying to install them on their own. This is why we are the only site that pre-installs every game for you. We have many categories like shooters, action, racing, simulators and even VR games! We strive to satisfy our users and ask for nothing in return. We revolutionized the downloading scene and will continue being your #1 site for free games.

                -

                This is a 3D printable file for a bounty hunter camtono and credits (Mando coins, Calamari Flan, Battuan Spira, imperial credits). Please note that this is a 3D file and not a physical product. The files will become available to you as soon as payment is complete.

                -

                -

                Set after the fall of the Galactic Empire, Star Wars: Hunters will bring players together in thrilling, team-based multiplayer battles. Select from a diverse cast of new characters, including daring Bounty Hunters, heroes of the Rebellion and Imperial stormtroopers. Star Wars: Hunters will be free to download for the Nintendo Switch, on the App Store and on Google Play in 2022 [sic].[6]

                -

                Lee Shan and Ayo are ex-Interpol agents who are now bounty hunters, chasing fugitives for cash rewards. When the two of them are framed for a hotel-bombing, they join hands with a legendary bounty hunter named Cat, along with her teammates, to find the real bomber.

                aaccfb2cb3
                -
                -
                \ No newline at end of file diff --git a/spaces/inamXcontru/PoeticTTS/Dazzle Hollywood Dv Bridge Mac Driver For Mac A Simple Guide to Using the Firewire Converter.md b/spaces/inamXcontru/PoeticTTS/Dazzle Hollywood Dv Bridge Mac Driver For Mac A Simple Guide to Using the Firewire Converter.md deleted file mode 100644 index 0075297cafa53ef803a9b9eaded32b4c7f1cec06..0000000000000000000000000000000000000000 --- a/spaces/inamXcontru/PoeticTTS/Dazzle Hollywood Dv Bridge Mac Driver For Mac A Simple Guide to Using the Firewire Converter.md +++ /dev/null @@ -1,6 +0,0 @@ -

                Dazzle Hollywood Dv Bridge Mac Driver For Mac


                Download > https://gohhs.com/2uz5IG



                - - aaccfb2cb3
                -
                -
                -

                diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/!!HOT!! Download Ebook Pengantar Ekonomi Mikro Sadono Sukirnohttps Scoutmails.com Index301.php K !!HOT!! Download.md b/spaces/inplisQlawa/anything-midjourney-v4-1/!!HOT!! Download Ebook Pengantar Ekonomi Mikro Sadono Sukirnohttps Scoutmails.com Index301.php K !!HOT!! Download.md deleted file mode 100644 index 0c187dc95c5df00fdbb395bdff6f1e67b419c37a..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/!!HOT!! Download Ebook Pengantar Ekonomi Mikro Sadono Sukirnohttps Scoutmails.com Index301.php K !!HOT!! Download.md +++ /dev/null @@ -1,6 +0,0 @@ -

                download ebook pengantar ekonomi mikro sadono sukirnohttps: scoutmails.com index301.php k download


                Download Zip ✸✸✸ https://urlin.us/2uExdL



                - -Download Ebook Pengantar Ekonomi Mikro Sadono Sukirnohttps: Scoutmails.com Index301.php K Download DOWNLOAD LINK: https://cinurl.com/1gq6yq ... 1fdad05405
                -
                -
                -

                diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/Audi-VWTool Version2.0.9 [Car Diagnost...md b/spaces/inplisQlawa/anything-midjourney-v4-1/Audi-VWTool Version2.0.9 [Car Diagnost...md deleted file mode 100644 index 3e93c1d9af05cefd1f4d05190b3e58ab2843e4d9..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/Audi-VWTool Version2.0.9 [Car Diagnost...md +++ /dev/null @@ -1,6 +0,0 @@ -

                Audi-VWTool Version2.0.9 [Car Diagnost..


                Download Filehttps://urlin.us/2uEwLg



                - -Audi-VWTool Version2.0.9 [Car Diagnostic Program].exe Serial Key This is where diagnostics hardware and apps like Car Scanner ELM OBD2 ... 4d29de3e1b
                -
                -
                -

                diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/Boroder Darun Kotha Golpo.md b/spaces/inplisQlawa/anything-midjourney-v4-1/Boroder Darun Kotha Golpo.md deleted file mode 100644 index 411d44dabdccbac48caf129a5448403626d33936..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/Boroder Darun Kotha Golpo.md +++ /dev/null @@ -1,6 +0,0 @@ -

                Boroder Darun Kotha Golpo


                Download Zip ✵✵✵ https://urlin.us/2uEw1U



                -
                - 3cee63e6c2
                -
                -
                -

                diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/Command And Conquer Generals Cd2 WORK Download For Computer.md b/spaces/inplisQlawa/anything-midjourney-v4-1/Command And Conquer Generals Cd2 WORK Download For Computer.md deleted file mode 100644 index 52d19b7fbc42084834fac0fbab46ad3c08ae48a2..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/Command And Conquer Generals Cd2 WORK Download For Computer.md +++ /dev/null @@ -1,6 +0,0 @@ -

                Command And Conquer Generals Cd2 Download For Computer


                Download Filehttps://urlin.us/2uEy7r



                - -command conquer generals zero hour free download ... I still play C&C Generals Zero Hour under Windows . ... Missing C&C generals CD 2: Hi, im missing my C&C generals disk 2 but have all the other disk, is it possbable to patch disk 2? 1fdad05405
                -
                -
                -

                diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/CxprogrammerdownloadFixed Fullversion.md b/spaces/inplisQlawa/anything-midjourney-v4-1/CxprogrammerdownloadFixed Fullversion.md deleted file mode 100644 index 25ab8fb4cc06a83103cbc1c35a00c803f26f865f..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/CxprogrammerdownloadFixed Fullversion.md +++ /dev/null @@ -1,67 +0,0 @@ -
                -

                CX-Programmer: The Best Software for Omron PLCs

                -

                If you are looking for a reliable and easy-to-use software for programming and debugging your Omron PLCs, you should consider CX-Programmer. CX-Programmer is part of the CX-One software suite, which integrates various tools for PLC development, such as CX-Server, CX-Process Tool, CX-Motion, CX-Position, CX-Simulator, CX-Integrator, CX-Designer, CX-Drive and CX-Protocol.

                -

                cxprogrammerdownloadfullversion


                DOWNLOAD →→→ https://urlin.us/2uExrY



                -

                In this article, we will show you some of the features and benefits of using CX-Programmer for your Omron PLC projects. We will also tell you how to download the full version of CX-Programmer and install it on your computer.

                - -

                What is CX-Programmer?

                -

                CX-Programmer is the programming software for all Omron's PLC series, from the compact CP1 series to the modular CJ2 and CS1 series. It supports both standard function blocks in IEC 61131-3 structured text or conventional ladder language, as well as custom function blocks created by the user. CX-Programmer also allows you to create and edit symbols, data types, structures and arrays for your PLC program.

                -

                CX-Programmer has a user-friendly interface that makes programming and debugging your PLC a simple drag & drop configuration. You can use smart input features, such as predictive-text browser, auto incrementing addresses and automatic rung connections, to reduce keystrokes and errors. You can also use the watch window to monitor and modify the values of symbols and memory areas during online operation.

                - -

                Why Use CX-Programmer?

                -

                CX-Programmer offers many advantages over other PLC programming software, such as:

                -

                -
                  -
                • It is fully integrated with the CX-One software suite, which means you can access other tools for PLC development without switching applications.
                • -
                • It supports all Omron's PLC series, which means you can use the same software for different models and platforms.
                • -
                • It has a wide variety of features to speed up the development of your PLC program, such as structures and arrays, timers and counters, smart input, position control verification and more.
                • -
                • It has a powerful debugging function that allows you to test and troubleshoot your PLC program online or offline, using breakpoints, single-step execution, forced output and more.
                • -
                • It has a flexible licensing system that allows you to install the software on multiple computers with a single license number.
                • -
                - -

                How to Download and Install CX-Programmer?

                -

                If you want to download the full version of CX-Programmer, you can follow these steps:

                -
                  -
                1. Go to this link and click on the GoogleDrive link to download the CX-One V4.51 software package.
                2. -
                3. Extract the zip file using the password plc247.com.
                4. -
                5. Run the setup.exe file and follow the instructions to install the software on your computer.
                6. -
                7. Enter the license number when prompted. You can find the license number in the readme.txt file inside the zip file.
                8. -
                9. Enjoy using CX-Programmer for your Omron PLC projects.
                10. -
                - -

                Conclusion

                -

                CX-Programmer is a great software for Omron PLCs that can help you create and debug your PLC programs with ease. It has many features and benefits that make it stand out from other PLC programming software. You can download the full version of CX-Programmer from plc247.com and install it on your computer with a single license number. If you have any questions or problems during the download or installation process, please contact us at Farishadi55@gmail.com or Whatsapp at 085786414566. We will be happy to assist you.

                -

                How to Use CX-Programmer?

                -

                Using CX-Programmer is very easy and intuitive. You can create and edit your PLC program using the graphical editor, where you can drag and drop function blocks, symbols and instructions. You can also use the text editor, where you can write your program in structured text or ladder language. You can switch between the two editors at any time.

                -

                To use CX-Programmer, you need to connect your computer to your Omron PLC using a USB cable, an Ethernet cable or a wireless adapter. You can then transfer your program to the PLC or upload the existing program from the PLC. You can also monitor and modify the PLC status and data online or offline.

                -

                CX-Programmer has a built-in simulator that allows you to test your program without connecting to a real PLC. You can simulate the input and output signals, check the logic and timing of your program, and debug any errors or faults. You can also use the position control verification function to display graphs of positions or speeds against time, verifying the action prior to transferring.

                - -

                Where to Find More Information about CX-Programmer?

                -

                If you want to learn more about CX-Programmer and its features, you can visit the official website of Omron Europe, where you can find detailed information, manuals, tutorials and videos. You can also contact Omron's technical support team if you have any questions or issues with the software.

                -

                Another source of information is plc247.com, a website dedicated to PLC programming and development. Here you can find articles, guides, tips and tricks on how to use CX-Programmer and other Omron software. You can also download the latest version of CX-One and CX-Programmer from this website.

                -

                You can also join the online community of Omron PLC users and developers on forums, blogs and social media platforms. Here you can share your experience, ask for help, give feedback and exchange ideas with other PLC enthusiasts.

                - -

                Conclusion

                -

                CX-Programmer is a powerful and versatile software for Omron PLCs that can help you create and debug your PLC programs with ease. It has many features and benefits that make it stand out from other PLC programming software. You can download the full version of CX-Programmer from plc247.com and install it on your computer with a single license number. If you have any questions or problems during the download or installation process, please contact us at Farishadi55@gmail.com or Whatsapp at 085786414566. We will be happy to assist you.

                -

                What are the Requirements and Compatibility of CX-Programmer?

                -

                CX-Programmer has some minimum requirements for your computer system and your Omron PLC. To use CX-Programmer, you need to have:

                -
                  -
                • A computer with Windows Vista, 7, 8, 8.1 or 10 operating system (32/64 bit).
                • -
                • A USB port, an Ethernet port or a wireless adapter for connecting to your Omron PLC.
                • -
                • An Omron PLC from the CP1, CP2E, CP2H, CP2L, CP2N, CP2W, CJ1W, CJ2H, CJ2M or CS1 series.
                • -
                • A CX-One license number or a CX-Programmer license number.
                • -
                -

                CX-Programmer is compatible with most of the Omron PLC series and models. However, some features may not be available for some PLCs. For example, the position control verification function is only available for CJ2H-CPU6x-EIP and CJ2M-CPU3x PLCs. You can check the compatibility of CX-Programmer with your Omron PLC on the official website of Omron Europe.

                - -

                What are the Alternatives to CX-Programmer?

                -

                CX-Programmer is one of the best software for Omron PLCs, but it is not the only one. There are some alternatives that you can use if you want to try something different or if you have a different PLC brand. Some of the alternatives to CX-Programmer are:

                -
                  -
                • RSLogix 5000: This is a software for programming and debugging Allen-Bradley PLCs. It supports ladder logic, structured text, function block diagram and sequential function chart languages. It also has features such as tag-based addressing, online editing and simulation.
                • -
                • STEP 7: This is a software for programming and debugging Siemens PLCs. It supports ladder logic, statement list and function block diagram languages. It also has features such as symbolic addressing, online testing and diagnostics.
                • -
                • CODESYS: This is a software for programming and debugging various PLC brands that support the IEC 61131-3 standard. It supports all five languages of the standard: ladder logic, structured text, function block diagram, instruction list and sequential function chart. It also has features such as object-oriented programming, visualization and simulation.
                • -
                - -

                Conclusion

                -

                CX-Programmer is a powerful and versatile software for Omron PLCs that can help you create and debug your PLC programs with ease. It has many features and benefits that make it stand out from other PLC programming software. You can download the full version of CX-Programmer from plc247.com and install it on your computer with a single license number. If you have any questions or problems during the download or installation process, please contact us at Farishadi55@gmail.com or Whatsapp at 085786414566. We will be happy to assist you.

                3cee63e6c2
                -
                -
                \ No newline at end of file diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/Geocad Full Indir.md b/spaces/inplisQlawa/anything-midjourney-v4-1/Geocad Full Indir.md deleted file mode 100644 index 252c13e6193fc314fc699a0e3d1b7cf090117115..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/Geocad Full Indir.md +++ /dev/null @@ -1,6 +0,0 @@ -

                geocad full indir


                Download Zip ○○○ https://urlin.us/2uExpz



                -
                - d5da3c52bf
                -
                -
                -

                diff --git a/spaces/inplisQlawa/anything-midjourney-v4-1/My Boss Malayalam 2012 DVDRip 400MB X264 [TOP].md b/spaces/inplisQlawa/anything-midjourney-v4-1/My Boss Malayalam 2012 DVDRip 400MB X264 [TOP].md deleted file mode 100644 index 64d546090d9598b53e91baeb4a49fdece0eb9a51..0000000000000000000000000000000000000000 --- a/spaces/inplisQlawa/anything-midjourney-v4-1/My Boss Malayalam 2012 DVDRip 400MB X264 [TOP].md +++ /dev/null @@ -1,13 +0,0 @@ -

                My Boss Malayalam 2012 DVDRip 400MB X264


                DOWNLOAD ››››› https://urlin.us/2uEyLs



                -
                -June 12, 2020 v9.3.0 Build 2600 UltraISO Premium Edition 9.1.2 Build 2463 Revision. ... Windows 7-XP Ultra ISO Portable Creator, Editor, Converter, Burner ... UltraISO UltraISO - download UltraISO 9.6.5.3236 UltraISO - a popular editing program -Program for working with disk images. ... -UltraISO Premium Edition 9.6 Pro / 9.6.1 Rus Portable - a program for working with disk images ... -May 9, 2013 ... -UltraISO is one of the best programs for... -[ Download from server (15.1Kb) ], 05/18/2010, 19:55. -UltraISO 9.6.5.3236 free download -UltraISO is a portable program for working with disk images in *.iso,. ... 8a78ff9644
                -
                -
                -

                diff --git a/spaces/inreVtussa/clothingai/Examples/Ardfry Psd Codec V1610 Keygen 58.md b/spaces/inreVtussa/clothingai/Examples/Ardfry Psd Codec V1610 Keygen 58.md deleted file mode 100644 index 683fd7771e5f5d190d6e523acc787d6833896230..0000000000000000000000000000000000000000 --- a/spaces/inreVtussa/clothingai/Examples/Ardfry Psd Codec V1610 Keygen 58.md +++ /dev/null @@ -1,6 +0,0 @@ -

                Ardfry Psd Codec V1610 Keygen 58


                Download Filehttps://tiurll.com/2uCkyx



                -
                -Ardfry. Psd Codec V1610 Keygen 58 Download: Psd codec 1.6 1.0 .. Codec ... EASEUS Data Recovery Wizard Professional Edition. 6.1.0. 1fdad05405
                -
                -
                -

                diff --git a/spaces/jackli888/stable-diffusion-webui/modules/codeformer_model.py b/spaces/jackli888/stable-diffusion-webui/modules/codeformer_model.py deleted file mode 100644 index fc8fbc3e947f64a7f23f0da7243d6e0ad7cbeb79..0000000000000000000000000000000000000000 --- a/spaces/jackli888/stable-diffusion-webui/modules/codeformer_model.py +++ /dev/null @@ -1,143 +0,0 @@ -import os -import sys -import traceback - -import cv2 -import torch - -import modules.face_restoration -import modules.shared -from modules import shared, devices, modelloader -from modules.paths import models_path - -# codeformer people made a choice to include modified basicsr library to their project which makes -# it utterly impossible to use it alongside with other libraries that also use basicsr, like GFPGAN. -# I am making a choice to include some files from codeformer to work around this issue. -model_dir = "Codeformer" -model_path = os.path.join(models_path, model_dir) -model_url = 'https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth' - -have_codeformer = False -codeformer = None - - -def setup_model(dirname): - global model_path - if not os.path.exists(model_path): - os.makedirs(model_path) - - path = modules.paths.paths.get("CodeFormer", None) - if path is None: - return - - try: - from torchvision.transforms.functional import normalize - from modules.codeformer.codeformer_arch import CodeFormer - from basicsr.utils.download_util import load_file_from_url - from basicsr.utils import imwrite, img2tensor, tensor2img - from facelib.utils.face_restoration_helper import FaceRestoreHelper - from facelib.detection.retinaface import retinaface - from modules.shared import cmd_opts - - net_class = CodeFormer - - class FaceRestorerCodeFormer(modules.face_restoration.FaceRestoration): - def name(self): - return "CodeFormer" - - def __init__(self, dirname): - self.net = None - self.face_helper = None - self.cmd_dir = dirname - - def create_models(self): - - if self.net is not None and self.face_helper is not None: - self.net.to(devices.device_codeformer) - return self.net, self.face_helper - model_paths = modelloader.load_models(model_path, model_url, self.cmd_dir, download_name='codeformer-v0.1.0.pth') - if len(model_paths) != 0: - ckpt_path = model_paths[0] - else: - print("Unable to load codeformer model.") - return None, None - net = net_class(dim_embd=512, codebook_size=1024, n_head=8, n_layers=9, connect_list=['32', '64', '128', '256']).to(devices.device_codeformer) - checkpoint = torch.load(ckpt_path)['params_ema'] - net.load_state_dict(checkpoint) - net.eval() - - if hasattr(retinaface, 'device'): - retinaface.device = devices.device_codeformer - face_helper = FaceRestoreHelper(1, face_size=512, crop_ratio=(1, 1), det_model='retinaface_resnet50', save_ext='png', use_parse=True, device=devices.device_codeformer) - - self.net = net - self.face_helper = face_helper - - return net, face_helper - - def send_model_to(self, device): - self.net.to(device) - self.face_helper.face_det.to(device) - self.face_helper.face_parse.to(device) - - def restore(self, np_image, w=None): - np_image = np_image[:, :, ::-1] - - original_resolution = np_image.shape[0:2] - - self.create_models() - if self.net is None or self.face_helper is None: - return np_image - - self.send_model_to(devices.device_codeformer) - - self.face_helper.clean_all() - self.face_helper.read_image(np_image) - self.face_helper.get_face_landmarks_5(only_center_face=False, resize=640, eye_dist_threshold=5) - self.face_helper.align_warp_face() - - for idx, cropped_face in enumerate(self.face_helper.cropped_faces): - cropped_face_t = img2tensor(cropped_face / 255., bgr2rgb=True, float32=True) - normalize(cropped_face_t, (0.5, 0.5, 0.5), (0.5, 0.5, 0.5), inplace=True) - cropped_face_t = cropped_face_t.unsqueeze(0).to(devices.device_codeformer) - - try: - with torch.no_grad(): - output = self.net(cropped_face_t, w=w if w is not None else shared.opts.code_former_weight, adain=True)[0] - restored_face = tensor2img(output, rgb2bgr=True, min_max=(-1, 1)) - del output - torch.cuda.empty_cache() - except Exception as error: - print(f'\tFailed inference for CodeFormer: {error}', file=sys.stderr) - restored_face = tensor2img(cropped_face_t, rgb2bgr=True, min_max=(-1, 1)) - - restored_face = restored_face.astype('uint8') - self.face_helper.add_restored_face(restored_face) - - self.face_helper.get_inverse_affine(None) - - restored_img = self.face_helper.paste_faces_to_input_image() - restored_img = restored_img[:, :, ::-1] - - if original_resolution != restored_img.shape[0:2]: - restored_img = cv2.resize(restored_img, (0, 0), fx=original_resolution[1]/restored_img.shape[1], fy=original_resolution[0]/restored_img.shape[0], interpolation=cv2.INTER_LINEAR) - - self.face_helper.clean_all() - - if shared.opts.face_restoration_unload: - self.send_model_to(devices.cpu) - - return restored_img - - global have_codeformer - have_codeformer = True - - global codeformer - codeformer = FaceRestorerCodeFormer(dirname) - shared.face_restorers.append(codeformer) - - except Exception: - print("Error setting up CodeFormer:", file=sys.stderr) - print(traceback.format_exc(), file=sys.stderr) - - # sys.path = stored_sys_path diff --git a/spaces/jbilcke-hf/image-caption-server/style.css b/spaces/jbilcke-hf/image-caption-server/style.css deleted file mode 100644 index c031280ed2fae5d64d3024157cbdbc57508db86b..0000000000000000000000000000000000000000 --- a/spaces/jbilcke-hf/image-caption-server/style.css +++ /dev/null @@ -1,10 +0,0 @@ -h1 { - text-align: center; -} - -#duplicate-button { - margin: auto; - color: #fff; - background: #1565c0; - border-radius: 100vh; -} diff --git a/spaces/jbraun19/Webcam-Object-Recognition-Yolo-n-Coco/config.py b/spaces/jbraun19/Webcam-Object-Recognition-Yolo-n-Coco/config.py deleted file mode 100644 index 30a0a8149d5b1bb1a8f3f2868018e62ec45eefef..0000000000000000000000000000000000000000 --- a/spaces/jbraun19/Webcam-Object-Recognition-Yolo-n-Coco/config.py +++ /dev/null @@ -1,17 +0,0 @@ -yolo_config = { - # Basic - 'img_size': (416, 416, 3), - 'anchors': [12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 459, 401], - 'strides': [8, 16, 32], - 'xyscale': [1.2, 1.1, 1.05], - - # Training - 'iou_loss_thresh': 0.5, - 'batch_size': 8, - 'num_gpu': 1, # 2, - - # Inference - 'max_boxes': 100, - 'iou_threshold': 0.413, - 'score_threshold': 0.3, -} diff --git a/spaces/joaogabriellima/Real-Time-Voice-Cloning/synthesizer_preprocess_audio.py b/spaces/joaogabriellima/Real-Time-Voice-Cloning/synthesizer_preprocess_audio.py deleted file mode 100644 index fd4d01d476d77391322aef9d9d5a005adb1f5c15..0000000000000000000000000000000000000000 --- a/spaces/joaogabriellima/Real-Time-Voice-Cloning/synthesizer_preprocess_audio.py +++ /dev/null @@ -1,59 +0,0 @@ -from synthesizer.preprocess import preprocess_dataset -from synthesizer.hparams import hparams -from utils.argutils import print_args -from pathlib import Path -import argparse - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Preprocesses audio files from datasets, encodes them as mel spectrograms " - "and writes them to the disk. Audio files are also saved, to be used by the " - "vocoder for training.", - formatter_class=argparse.ArgumentDefaultsHelpFormatter - ) - parser.add_argument("datasets_root", type=Path, help=\ - "Path to the directory containing your LibriSpeech/TTS datasets.") - parser.add_argument("-o", "--out_dir", type=Path, default=argparse.SUPPRESS, help=\ - "Path to the output directory that will contain the mel spectrograms, the audios and the " - "embeds. Defaults to /SV2TTS/synthesizer/") - parser.add_argument("-n", "--n_processes", type=int, default=None, help=\ - "Number of processes in parallel.") - parser.add_argument("-s", "--skip_existing", action="store_true", help=\ - "Whether to overwrite existing files with the same name. Useful if the preprocessing was " - "interrupted.") - parser.add_argument("--hparams", type=str, default="", help=\ - "Hyperparameter overrides as a comma-separated list of name-value pairs") - parser.add_argument("--no_trim", action="store_true", help=\ - "Preprocess audio without trimming silences (not recommended).") - parser.add_argument("--no_alignments", action="store_true", help=\ - "Use this option when dataset does not include alignments\ - (these are used to split long audio files into sub-utterances.)") - parser.add_argument("--datasets_name", type=str, default="LibriSpeech", help=\ - "Name of the dataset directory to process.") - parser.add_argument("--subfolders", type=str, default="train-clean-100, train-clean-360", help=\ - "Comma-separated list of subfolders to process inside your dataset directory") - args = parser.parse_args() - - # Process the arguments - if not hasattr(args, "out_dir"): - args.out_dir = args.datasets_root.joinpath("SV2TTS", "synthesizer") - - # Create directories - assert args.datasets_root.exists() - args.out_dir.mkdir(exist_ok=True, parents=True) - - # Verify webrtcvad is available - if not args.no_trim: - try: - import webrtcvad - except: - raise ModuleNotFoundError("Package 'webrtcvad' not found. This package enables " - "noise removal and is recommended. Please install and try again. If installation fails, " - "use --no_trim to disable this error message.") - del args.no_trim - - # Preprocess the dataset - print_args(args, parser) - args.hparams = hparams.parse(args.hparams) - preprocess_dataset(**vars(args)) diff --git a/spaces/joaopereirajp/livvieChatBot/venv/lib/python3.9/site-packages/Crypto/Cipher/__init__.py b/spaces/joaopereirajp/livvieChatBot/venv/lib/python3.9/site-packages/Crypto/Cipher/__init__.py deleted file mode 100644 index ba2d4855905903e30e9d05392d98a88bc26f4a18..0000000000000000000000000000000000000000 --- a/spaces/joaopereirajp/livvieChatBot/venv/lib/python3.9/site-packages/Crypto/Cipher/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# -# A block cipher is instantiated as a combination of: -# 1. A base cipher (such as AES) -# 2. A mode of operation (such as CBC) -# -# Both items are implemented as C modules. -# -# The API of #1 is (replace "AES" with the name of the actual cipher): -# - AES_start_operaion(key) --> base_cipher_state -# - AES_encrypt(base_cipher_state, in, out, length) -# - AES_decrypt(base_cipher_state, in, out, length) -# - AES_stop_operation(base_cipher_state) -# -# Where base_cipher_state is AES_State, a struct with BlockBase (set of -# pointers to encrypt/decrypt/stop) followed by cipher-specific data. -# -# The API of #2 is (replace "CBC" with the name of the actual mode): -# - CBC_start_operation(base_cipher_state) --> mode_state -# - CBC_encrypt(mode_state, in, out, length) -# - CBC_decrypt(mode_state, in, out, length) -# - CBC_stop_operation(mode_state) -# -# where mode_state is a a pointer to base_cipher_state plus mode-specific data. - -import os - -from Crypto.Cipher._mode_ecb import _create_ecb_cipher -from Crypto.Cipher._mode_cbc import _create_cbc_cipher -from Crypto.Cipher._mode_cfb import _create_cfb_cipher -from Crypto.Cipher._mode_ofb import _create_ofb_cipher -from Crypto.Cipher._mode_ctr import _create_ctr_cipher -from Crypto.Cipher._mode_openpgp import _create_openpgp_cipher -from Crypto.Cipher._mode_ccm import _create_ccm_cipher -from Crypto.Cipher._mode_eax import _create_eax_cipher -from Crypto.Cipher._mode_siv import _create_siv_cipher -from Crypto.Cipher._mode_gcm import _create_gcm_cipher -from Crypto.Cipher._mode_ocb import _create_ocb_cipher - -_modes = { 1:_create_ecb_cipher, - 2:_create_cbc_cipher, - 3:_create_cfb_cipher, - 5:_create_ofb_cipher, - 6:_create_ctr_cipher, - 7:_create_openpgp_cipher, - 9:_create_eax_cipher - } - -_extra_modes = { 8:_create_ccm_cipher, - 10:_create_siv_cipher, - 11:_create_gcm_cipher, - 12:_create_ocb_cipher - } - -def _create_cipher(factory, key, mode, *args, **kwargs): - - kwargs["key"] = key - - modes = dict(_modes) - if kwargs.pop("add_aes_modes", False): - modes.update(_extra_modes) - if not mode in modes: - raise ValueError("Mode not supported") - - if args: - if mode in (8, 9, 10, 11, 12): - if len(args) > 1: - raise TypeError("Too many arguments for this mode") - kwargs["nonce"] = args[0] - elif mode in (2, 3, 5, 7): - if len(args) > 1: - raise TypeError("Too many arguments for this mode") - kwargs["IV"] = args[0] - elif mode == 6: - if len(args) > 0: - raise TypeError("Too many arguments for this mode") - elif mode == 1: - raise TypeError("IV is not meaningful for the ECB mode") - - return modes[mode](factory, **kwargs) diff --git a/spaces/johnslegers/stable-diffusion-gui-test/ldmlib/modules/image_degradation/bsrgan_light.py b/spaces/johnslegers/stable-diffusion-gui-test/ldmlib/modules/image_degradation/bsrgan_light.py deleted file mode 100644 index ec1200882368fe48194ed94b9a57c97276aa9e83..0000000000000000000000000000000000000000 --- a/spaces/johnslegers/stable-diffusion-gui-test/ldmlib/modules/image_degradation/bsrgan_light.py +++ /dev/null @@ -1,650 +0,0 @@ -# -*- coding: utf-8 -*- -import numpy as np -import cv2 -import torch - -from functools import partial -import random -from scipy import ndimage -import scipy -import scipy.stats as ss -from scipy.interpolate import interp2d -from scipy.linalg import orth -import albumentations - -import ldmlib.modules.image_degradation.utils_image as util - -""" -# -------------------------------------------- -# Super-Resolution -# -------------------------------------------- -# -# Kai Zhang (cskaizhang@gmail.com) -# https://github.com/cszn -# From 2019/03--2021/08 -# -------------------------------------------- -""" - - -def modcrop_np(img, sf): - ''' - Args: - img: numpy image, WxH or WxHxC - sf: scale factor - Return: - cropped image - ''' - w, h = img.shape[:2] - im = np.copy(img) - return im[:w - w % sf, :h - h % sf, ...] - - -""" -# -------------------------------------------- -# anisotropic Gaussian kernels -# -------------------------------------------- -""" - - -def analytic_kernel(k): - """Calculate the X4 kernel from the X2 kernel (for proof see appendix in paper)""" - k_size = k.shape[0] - # Calculate the big kernels size - big_k = np.zeros((3 * k_size - 2, 3 * k_size - 2)) - # Loop over the small kernel to fill the big one - for r in range(k_size): - for c in range(k_size): - big_k[2 * r:2 * r + k_size, 2 * c:2 * c + k_size] += k[r, c] * k - # Crop the edges of the big kernel to ignore very small values and increase run time of SR - crop = k_size // 2 - cropped_big_k = big_k[crop:-crop, crop:-crop] - # Normalize to 1 - return cropped_big_k / cropped_big_k.sum() - - -def anisotropic_Gaussian(ksize=15, theta=np.pi, l1=6, l2=6): - """ generate an anisotropic Gaussian kernel - Args: - ksize : e.g., 15, kernel size - theta : [0, pi], rotation angle range - l1 : [0.1,50], scaling of eigenvalues - l2 : [0.1,l1], scaling of eigenvalues - If l1 = l2, will get an isotropic Gaussian kernel. - Returns: - k : kernel - """ - - v = np.dot(np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]]), np.array([1., 0.])) - V = np.array([[v[0], v[1]], [v[1], -v[0]]]) - D = np.array([[l1, 0], [0, l2]]) - Sigma = np.dot(np.dot(V, D), np.linalg.inv(V)) - k = gm_blur_kernel(mean=[0, 0], cov=Sigma, size=ksize) - - return k - - -def gm_blur_kernel(mean, cov, size=15): - center = size / 2.0 + 0.5 - k = np.zeros([size, size]) - for y in range(size): - for x in range(size): - cy = y - center + 1 - cx = x - center + 1 - k[y, x] = ss.multivariate_normal.pdf([cx, cy], mean=mean, cov=cov) - - k = k / np.sum(k) - return k - - -def shift_pixel(x, sf, upper_left=True): - """shift pixel for super-resolution with different scale factors - Args: - x: WxHxC or WxH - sf: scale factor - upper_left: shift direction - """ - h, w = x.shape[:2] - shift = (sf - 1) * 0.5 - xv, yv = np.arange(0, w, 1.0), np.arange(0, h, 1.0) - if upper_left: - x1 = xv + shift - y1 = yv + shift - else: - x1 = xv - shift - y1 = yv - shift - - x1 = np.clip(x1, 0, w - 1) - y1 = np.clip(y1, 0, h - 1) - - if x.ndim == 2: - x = interp2d(xv, yv, x)(x1, y1) - if x.ndim == 3: - for i in range(x.shape[-1]): - x[:, :, i] = interp2d(xv, yv, x[:, :, i])(x1, y1) - - return x - - -def blur(x, k): - ''' - x: image, NxcxHxW - k: kernel, Nx1xhxw - ''' - n, c = x.shape[:2] - p1, p2 = (k.shape[-2] - 1) // 2, (k.shape[-1] - 1) // 2 - x = torch.nn.functional.pad(x, pad=(p1, p2, p1, p2), mode='replicate') - k = k.repeat(1, c, 1, 1) - k = k.view(-1, 1, k.shape[2], k.shape[3]) - x = x.view(1, -1, x.shape[2], x.shape[3]) - x = torch.nn.functional.conv2d(x, k, bias=None, stride=1, padding=0, groups=n * c) - x = x.view(n, c, x.shape[2], x.shape[3]) - - return x - - -def gen_kernel(k_size=np.array([15, 15]), scale_factor=np.array([4, 4]), min_var=0.6, max_var=10., noise_level=0): - """" - # modified version of https://github.com/assafshocher/BlindSR_dataset_generator - # Kai Zhang - # min_var = 0.175 * sf # variance of the gaussian kernel will be sampled between min_var and max_var - # max_var = 2.5 * sf - """ - # Set random eigen-vals (lambdas) and angle (theta) for COV matrix - lambda_1 = min_var + np.random.rand() * (max_var - min_var) - lambda_2 = min_var + np.random.rand() * (max_var - min_var) - theta = np.random.rand() * np.pi # random theta - noise = -noise_level + np.random.rand(*k_size) * noise_level * 2 - - # Set COV matrix using Lambdas and Theta - LAMBDA = np.diag([lambda_1, lambda_2]) - Q = np.array([[np.cos(theta), -np.sin(theta)], - [np.sin(theta), np.cos(theta)]]) - SIGMA = Q @ LAMBDA @ Q.T - INV_SIGMA = np.linalg.inv(SIGMA)[None, None, :, :] - - # Set expectation position (shifting kernel for aligned image) - MU = k_size // 2 - 0.5 * (scale_factor - 1) # - 0.5 * (scale_factor - k_size % 2) - MU = MU[None, None, :, None] - - # Create meshgrid for Gaussian - [X, Y] = np.meshgrid(range(k_size[0]), range(k_size[1])) - Z = np.stack([X, Y], 2)[:, :, :, None] - - # Calcualte Gaussian for every pixel of the kernel - ZZ = Z - MU - ZZ_t = ZZ.transpose(0, 1, 3, 2) - raw_kernel = np.exp(-0.5 * np.squeeze(ZZ_t @ INV_SIGMA @ ZZ)) * (1 + noise) - - # shift the kernel so it will be centered - # raw_kernel_centered = kernel_shift(raw_kernel, scale_factor) - - # Normalize the kernel and return - # kernel = raw_kernel_centered / np.sum(raw_kernel_centered) - kernel = raw_kernel / np.sum(raw_kernel) - return kernel - - -def fspecial_gaussian(hsize, sigma): - hsize = [hsize, hsize] - siz = [(hsize[0] - 1.0) / 2.0, (hsize[1] - 1.0) / 2.0] - std = sigma - [x, y] = np.meshgrid(np.arange(-siz[1], siz[1] + 1), np.arange(-siz[0], siz[0] + 1)) - arg = -(x * x + y * y) / (2 * std * std) - h = np.exp(arg) - h[h < scipy.finfo(float).eps * h.max()] = 0 - sumh = h.sum() - if sumh != 0: - h = h / sumh - return h - - -def fspecial_laplacian(alpha): - alpha = max([0, min([alpha, 1])]) - h1 = alpha / (alpha + 1) - h2 = (1 - alpha) / (alpha + 1) - h = [[h1, h2, h1], [h2, -4 / (alpha + 1), h2], [h1, h2, h1]] - h = np.array(h) - return h - - -def fspecial(filter_type, *args, **kwargs): - ''' - python code from: - https://github.com/ronaldosena/imagens-medicas-2/blob/40171a6c259edec7827a6693a93955de2bd39e76/Aulas/aula_2_-_uniform_filter/matlab_fspecial.py - ''' - if filter_type == 'gaussian': - return fspecial_gaussian(*args, **kwargs) - if filter_type == 'laplacian': - return fspecial_laplacian(*args, **kwargs) - - -""" -# -------------------------------------------- -# degradation models -# -------------------------------------------- -""" - - -def bicubic_degradation(x, sf=3): - ''' - Args: - x: HxWxC image, [0, 1] - sf: down-scale factor - Return: - bicubicly downsampled LR image - ''' - x = util.imresize_np(x, scale=1 / sf) - return x - - -def srmd_degradation(x, k, sf=3): - ''' blur + bicubic downsampling - Args: - x: HxWxC image, [0, 1] - k: hxw, double - sf: down-scale factor - Return: - downsampled LR image - Reference: - @inproceedings{zhang2018learning, - title={Learning a single convolutional super-resolution network for multiple degradations}, - author={Zhang, Kai and Zuo, Wangmeng and Zhang, Lei}, - booktitle={IEEE Conference on Computer Vision and Pattern Recognition}, - pages={3262--3271}, - year={2018} - } - ''' - x = ndimage.filters.convolve(x, np.expand_dims(k, axis=2), mode='wrap') # 'nearest' | 'mirror' - x = bicubic_degradation(x, sf=sf) - return x - - -def dpsr_degradation(x, k, sf=3): - ''' bicubic downsampling + blur - Args: - x: HxWxC image, [0, 1] - k: hxw, double - sf: down-scale factor - Return: - downsampled LR image - Reference: - @inproceedings{zhang2019deep, - title={Deep Plug-and-Play Super-Resolution for Arbitrary Blur Kernels}, - author={Zhang, Kai and Zuo, Wangmeng and Zhang, Lei}, - booktitle={IEEE Conference on Computer Vision and Pattern Recognition}, - pages={1671--1681}, - year={2019} - } - ''' - x = bicubic_degradation(x, sf=sf) - x = ndimage.filters.convolve(x, np.expand_dims(k, axis=2), mode='wrap') - return x - - -def classical_degradation(x, k, sf=3): - ''' blur + downsampling - Args: - x: HxWxC image, [0, 1]/[0, 255] - k: hxw, double - sf: down-scale factor - Return: - downsampled LR image - ''' - x = ndimage.filters.convolve(x, np.expand_dims(k, axis=2), mode='wrap') - # x = filters.correlate(x, np.expand_dims(np.flip(k), axis=2)) - st = 0 - return x[st::sf, st::sf, ...] - - -def add_sharpening(img, weight=0.5, radius=50, threshold=10): - """USM sharpening. borrowed from real-ESRGAN - Input image: I; Blurry image: B. - 1. K = I + weight * (I - B) - 2. Mask = 1 if abs(I - B) > threshold, else: 0 - 3. Blur mask: - 4. Out = Mask * K + (1 - Mask) * I - Args: - img (Numpy array): Input image, HWC, BGR; float32, [0, 1]. - weight (float): Sharp weight. Default: 1. - radius (float): Kernel size of Gaussian blur. Default: 50. - threshold (int): - """ - if radius % 2 == 0: - radius += 1 - blur = cv2.GaussianBlur(img, (radius, radius), 0) - residual = img - blur - mask = np.abs(residual) * 255 > threshold - mask = mask.astype('float32') - soft_mask = cv2.GaussianBlur(mask, (radius, radius), 0) - - K = img + weight * residual - K = np.clip(K, 0, 1) - return soft_mask * K + (1 - soft_mask) * img - - -def add_blur(img, sf=4): - wd2 = 4.0 + sf - wd = 2.0 + 0.2 * sf - - wd2 = wd2/4 - wd = wd/4 - - if random.random() < 0.5: - l1 = wd2 * random.random() - l2 = wd2 * random.random() - k = anisotropic_Gaussian(ksize=random.randint(2, 11) + 3, theta=random.random() * np.pi, l1=l1, l2=l2) - else: - k = fspecial('gaussian', random.randint(2, 4) + 3, wd * random.random()) - img = ndimage.filters.convolve(img, np.expand_dims(k, axis=2), mode='mirror') - - return img - - -def add_resize(img, sf=4): - rnum = np.random.rand() - if rnum > 0.8: # up - sf1 = random.uniform(1, 2) - elif rnum < 0.7: # down - sf1 = random.uniform(0.5 / sf, 1) - else: - sf1 = 1.0 - img = cv2.resize(img, (int(sf1 * img.shape[1]), int(sf1 * img.shape[0])), interpolation=random.choice([1, 2, 3])) - img = np.clip(img, 0.0, 1.0) - - return img - - -# def add_Gaussian_noise(img, noise_level1=2, noise_level2=25): -# noise_level = random.randint(noise_level1, noise_level2) -# rnum = np.random.rand() -# if rnum > 0.6: # add color Gaussian noise -# img += np.random.normal(0, noise_level / 255.0, img.shape).astype(np.float32) -# elif rnum < 0.4: # add grayscale Gaussian noise -# img += np.random.normal(0, noise_level / 255.0, (*img.shape[:2], 1)).astype(np.float32) -# else: # add noise -# L = noise_level2 / 255. -# D = np.diag(np.random.rand(3)) -# U = orth(np.random.rand(3, 3)) -# conv = np.dot(np.dot(np.transpose(U), D), U) -# img += np.random.multivariate_normal([0, 0, 0], np.abs(L ** 2 * conv), img.shape[:2]).astype(np.float32) -# img = np.clip(img, 0.0, 1.0) -# return img - -def add_Gaussian_noise(img, noise_level1=2, noise_level2=25): - noise_level = random.randint(noise_level1, noise_level2) - rnum = np.random.rand() - if rnum > 0.6: # add color Gaussian noise - img = img + np.random.normal(0, noise_level / 255.0, img.shape).astype(np.float32) - elif rnum < 0.4: # add grayscale Gaussian noise - img = img + np.random.normal(0, noise_level / 255.0, (*img.shape[:2], 1)).astype(np.float32) - else: # add noise - L = noise_level2 / 255. - D = np.diag(np.random.rand(3)) - U = orth(np.random.rand(3, 3)) - conv = np.dot(np.dot(np.transpose(U), D), U) - img = img + np.random.multivariate_normal([0, 0, 0], np.abs(L ** 2 * conv), img.shape[:2]).astype(np.float32) - img = np.clip(img, 0.0, 1.0) - return img - - -def add_speckle_noise(img, noise_level1=2, noise_level2=25): - noise_level = random.randint(noise_level1, noise_level2) - img = np.clip(img, 0.0, 1.0) - rnum = random.random() - if rnum > 0.6: - img += img * np.random.normal(0, noise_level / 255.0, img.shape).astype(np.float32) - elif rnum < 0.4: - img += img * np.random.normal(0, noise_level / 255.0, (*img.shape[:2], 1)).astype(np.float32) - else: - L = noise_level2 / 255. - D = np.diag(np.random.rand(3)) - U = orth(np.random.rand(3, 3)) - conv = np.dot(np.dot(np.transpose(U), D), U) - img += img * np.random.multivariate_normal([0, 0, 0], np.abs(L ** 2 * conv), img.shape[:2]).astype(np.float32) - img = np.clip(img, 0.0, 1.0) - return img - - -def add_Poisson_noise(img): - img = np.clip((img * 255.0).round(), 0, 255) / 255. - vals = 10 ** (2 * random.random() + 2.0) # [2, 4] - if random.random() < 0.5: - img = np.random.poisson(img * vals).astype(np.float32) / vals - else: - img_gray = np.dot(img[..., :3], [0.299, 0.587, 0.114]) - img_gray = np.clip((img_gray * 255.0).round(), 0, 255) / 255. - noise_gray = np.random.poisson(img_gray * vals).astype(np.float32) / vals - img_gray - img += noise_gray[:, :, np.newaxis] - img = np.clip(img, 0.0, 1.0) - return img - - -def add_JPEG_noise(img): - quality_factor = random.randint(80, 95) - img = cv2.cvtColor(util.single2uint(img), cv2.COLOR_RGB2BGR) - result, encimg = cv2.imencode('.jpg', img, [int(cv2.IMWRITE_JPEG_QUALITY), quality_factor]) - img = cv2.imdecode(encimg, 1) - img = cv2.cvtColor(util.uint2single(img), cv2.COLOR_BGR2RGB) - return img - - -def random_crop(lq, hq, sf=4, lq_patchsize=64): - h, w = lq.shape[:2] - rnd_h = random.randint(0, h - lq_patchsize) - rnd_w = random.randint(0, w - lq_patchsize) - lq = lq[rnd_h:rnd_h + lq_patchsize, rnd_w:rnd_w + lq_patchsize, :] - - rnd_h_H, rnd_w_H = int(rnd_h * sf), int(rnd_w * sf) - hq = hq[rnd_h_H:rnd_h_H + lq_patchsize * sf, rnd_w_H:rnd_w_H + lq_patchsize * sf, :] - return lq, hq - - -def degradation_bsrgan(img, sf=4, lq_patchsize=72, isp_model=None): - """ - This is the degradation model of BSRGAN from the paper - "Designing a Practical Degradation Model for Deep Blind Image Super-Resolution" - ---------- - img: HXWXC, [0, 1], its size should be large than (lq_patchsizexsf)x(lq_patchsizexsf) - sf: scale factor - isp_model: camera ISP model - Returns - ------- - img: low-quality patch, size: lq_patchsizeXlq_patchsizeXC, range: [0, 1] - hq: corresponding high-quality patch, size: (lq_patchsizexsf)X(lq_patchsizexsf)XC, range: [0, 1] - """ - isp_prob, jpeg_prob, scale2_prob = 0.25, 0.9, 0.25 - sf_ori = sf - - h1, w1 = img.shape[:2] - img = img.copy()[:w1 - w1 % sf, :h1 - h1 % sf, ...] # mod crop - h, w = img.shape[:2] - - if h < lq_patchsize * sf or w < lq_patchsize * sf: - raise ValueError(f'img size ({h1}X{w1}) is too small!') - - hq = img.copy() - - if sf == 4 and random.random() < scale2_prob: # downsample1 - if np.random.rand() < 0.5: - img = cv2.resize(img, (int(1 / 2 * img.shape[1]), int(1 / 2 * img.shape[0])), - interpolation=random.choice([1, 2, 3])) - else: - img = util.imresize_np(img, 1 / 2, True) - img = np.clip(img, 0.0, 1.0) - sf = 2 - - shuffle_order = random.sample(range(7), 7) - idx1, idx2 = shuffle_order.index(2), shuffle_order.index(3) - if idx1 > idx2: # keep downsample3 last - shuffle_order[idx1], shuffle_order[idx2] = shuffle_order[idx2], shuffle_order[idx1] - - for i in shuffle_order: - - if i == 0: - img = add_blur(img, sf=sf) - - elif i == 1: - img = add_blur(img, sf=sf) - - elif i == 2: - a, b = img.shape[1], img.shape[0] - # downsample2 - if random.random() < 0.75: - sf1 = random.uniform(1, 2 * sf) - img = cv2.resize(img, (int(1 / sf1 * img.shape[1]), int(1 / sf1 * img.shape[0])), - interpolation=random.choice([1, 2, 3])) - else: - k = fspecial('gaussian', 25, random.uniform(0.1, 0.6 * sf)) - k_shifted = shift_pixel(k, sf) - k_shifted = k_shifted / k_shifted.sum() # blur with shifted kernel - img = ndimage.filters.convolve(img, np.expand_dims(k_shifted, axis=2), mode='mirror') - img = img[0::sf, 0::sf, ...] # nearest downsampling - img = np.clip(img, 0.0, 1.0) - - elif i == 3: - # downsample3 - img = cv2.resize(img, (int(1 / sf * a), int(1 / sf * b)), interpolation=random.choice([1, 2, 3])) - img = np.clip(img, 0.0, 1.0) - - elif i == 4: - # add Gaussian noise - img = add_Gaussian_noise(img, noise_level1=2, noise_level2=8) - - elif i == 5: - # add JPEG noise - if random.random() < jpeg_prob: - img = add_JPEG_noise(img) - - elif i == 6: - # add processed camera sensor noise - if random.random() < isp_prob and isp_model is not None: - with torch.no_grad(): - img, hq = isp_model.forward(img.copy(), hq) - - # add final JPEG compression noise - img = add_JPEG_noise(img) - - # random crop - img, hq = random_crop(img, hq, sf_ori, lq_patchsize) - - return img, hq - - -# todo no isp_model? -def degradation_bsrgan_variant(image, sf=4, isp_model=None): - """ - This is the degradation model of BSRGAN from the paper - "Designing a Practical Degradation Model for Deep Blind Image Super-Resolution" - ---------- - sf: scale factor - isp_model: camera ISP model - Returns - ------- - img: low-quality patch, size: lq_patchsizeXlq_patchsizeXC, range: [0, 1] - hq: corresponding high-quality patch, size: (lq_patchsizexsf)X(lq_patchsizexsf)XC, range: [0, 1] - """ - image = util.uint2single(image) - isp_prob, jpeg_prob, scale2_prob = 0.25, 0.9, 0.25 - sf_ori = sf - - h1, w1 = image.shape[:2] - image = image.copy()[:w1 - w1 % sf, :h1 - h1 % sf, ...] # mod crop - h, w = image.shape[:2] - - hq = image.copy() - - if sf == 4 and random.random() < scale2_prob: # downsample1 - if np.random.rand() < 0.5: - image = cv2.resize(image, (int(1 / 2 * image.shape[1]), int(1 / 2 * image.shape[0])), - interpolation=random.choice([1, 2, 3])) - else: - image = util.imresize_np(image, 1 / 2, True) - image = np.clip(image, 0.0, 1.0) - sf = 2 - - shuffle_order = random.sample(range(7), 7) - idx1, idx2 = shuffle_order.index(2), shuffle_order.index(3) - if idx1 > idx2: # keep downsample3 last - shuffle_order[idx1], shuffle_order[idx2] = shuffle_order[idx2], shuffle_order[idx1] - - for i in shuffle_order: - - if i == 0: - image = add_blur(image, sf=sf) - - # elif i == 1: - # image = add_blur(image, sf=sf) - - if i == 0: - pass - - elif i == 2: - a, b = image.shape[1], image.shape[0] - # downsample2 - if random.random() < 0.8: - sf1 = random.uniform(1, 2 * sf) - image = cv2.resize(image, (int(1 / sf1 * image.shape[1]), int(1 / sf1 * image.shape[0])), - interpolation=random.choice([1, 2, 3])) - else: - k = fspecial('gaussian', 25, random.uniform(0.1, 0.6 * sf)) - k_shifted = shift_pixel(k, sf) - k_shifted = k_shifted / k_shifted.sum() # blur with shifted kernel - image = ndimage.filters.convolve(image, np.expand_dims(k_shifted, axis=2), mode='mirror') - image = image[0::sf, 0::sf, ...] # nearest downsampling - - image = np.clip(image, 0.0, 1.0) - - elif i == 3: - # downsample3 - image = cv2.resize(image, (int(1 / sf * a), int(1 / sf * b)), interpolation=random.choice([1, 2, 3])) - image = np.clip(image, 0.0, 1.0) - - elif i == 4: - # add Gaussian noise - image = add_Gaussian_noise(image, noise_level1=1, noise_level2=2) - - elif i == 5: - # add JPEG noise - if random.random() < jpeg_prob: - image = add_JPEG_noise(image) - # - # elif i == 6: - # # add processed camera sensor noise - # if random.random() < isp_prob and isp_model is not None: - # with torch.no_grad(): - # img, hq = isp_model.forward(img.copy(), hq) - - # add final JPEG compression noise - image = add_JPEG_noise(image) - image = util.single2uint(image) - example = {"image": image} - return example - - - - -if __name__ == '__main__': - print("hey") - img = util.imread_uint('utils/test.png', 3) - img = img[:448, :448] - h = img.shape[0] // 4 - print("resizing to", h) - sf = 4 - deg_fn = partial(degradation_bsrgan_variant, sf=sf) - for i in range(20): - print(i) - img_hq = img - img_lq = deg_fn(img)["image"] - img_hq, img_lq = util.uint2single(img_hq), util.uint2single(img_lq) - print(img_lq) - img_lq_bicubic = albumentations.SmallestMaxSize(max_size=h, interpolation=cv2.INTER_CUBIC)(image=img_hq)["image"] - print(img_lq.shape) - print("bicubic", img_lq_bicubic.shape) - print(img_hq.shape) - lq_nearest = cv2.resize(util.single2uint(img_lq), (int(sf * img_lq.shape[1]), int(sf * img_lq.shape[0])), - interpolation=0) - lq_bicubic_nearest = cv2.resize(util.single2uint(img_lq_bicubic), - (int(sf * img_lq.shape[1]), int(sf * img_lq.shape[0])), - interpolation=0) - img_concat = np.concatenate([lq_bicubic_nearest, lq_nearest, util.single2uint(img_hq)], axis=1) - util.imsave(img_concat, str(i) + '.png') diff --git a/spaces/joushe/moe-tts/text/korean.py b/spaces/joushe/moe-tts/text/korean.py deleted file mode 100644 index edee07429a450c55e3d8e246997faaa1e0b89cc9..0000000000000000000000000000000000000000 --- a/spaces/joushe/moe-tts/text/korean.py +++ /dev/null @@ -1,210 +0,0 @@ -import re -from jamo import h2j, j2hcj -import ko_pron - - -# This is a list of Korean classifiers preceded by pure Korean numerals. -_korean_classifiers = '군데 권 개 그루 닢 대 두 마리 모 모금 뭇 발 발짝 방 번 벌 보루 살 수 술 시 쌈 움큼 정 짝 채 척 첩 축 켤레 톨 통' - -# List of (hangul, hangul divided) pairs: -_hangul_divided = [(re.compile('%s' % x[0]), x[1]) for x in [ - ('ㄳ', 'ㄱㅅ'), - ('ㄵ', 'ㄴㅈ'), - ('ㄶ', 'ㄴㅎ'), - ('ㄺ', 'ㄹㄱ'), - ('ㄻ', 'ㄹㅁ'), - ('ㄼ', 'ㄹㅂ'), - ('ㄽ', 'ㄹㅅ'), - ('ㄾ', 'ㄹㅌ'), - ('ㄿ', 'ㄹㅍ'), - ('ㅀ', 'ㄹㅎ'), - ('ㅄ', 'ㅂㅅ'), - ('ㅘ', 'ㅗㅏ'), - ('ㅙ', 'ㅗㅐ'), - ('ㅚ', 'ㅗㅣ'), - ('ㅝ', 'ㅜㅓ'), - ('ㅞ', 'ㅜㅔ'), - ('ㅟ', 'ㅜㅣ'), - ('ㅢ', 'ㅡㅣ'), - ('ㅑ', 'ㅣㅏ'), - ('ㅒ', 'ㅣㅐ'), - ('ㅕ', 'ㅣㅓ'), - ('ㅖ', 'ㅣㅔ'), - ('ㅛ', 'ㅣㅗ'), - ('ㅠ', 'ㅣㅜ') -]] - -# List of (Latin alphabet, hangul) pairs: -_latin_to_hangul = [(re.compile('%s' % x[0], re.IGNORECASE), x[1]) for x in [ - ('a', '에이'), - ('b', '비'), - ('c', '시'), - ('d', '디'), - ('e', '이'), - ('f', '에프'), - ('g', '지'), - ('h', '에이치'), - ('i', '아이'), - ('j', '제이'), - ('k', '케이'), - ('l', '엘'), - ('m', '엠'), - ('n', '엔'), - ('o', '오'), - ('p', '피'), - ('q', '큐'), - ('r', '아르'), - ('s', '에스'), - ('t', '티'), - ('u', '유'), - ('v', '브이'), - ('w', '더블유'), - ('x', '엑스'), - ('y', '와이'), - ('z', '제트') -]] - -# List of (ipa, lazy ipa) pairs: -_ipa_to_lazy_ipa = [(re.compile('%s' % x[0], re.IGNORECASE), x[1]) for x in [ - ('t͡ɕ','ʧ'), - ('d͡ʑ','ʥ'), - ('ɲ','n^'), - ('ɕ','ʃ'), - ('ʷ','w'), - ('ɭ','l`'), - ('ʎ','ɾ'), - ('ɣ','ŋ'), - ('ɰ','ɯ'), - ('ʝ','j'), - ('ʌ','ə'), - ('ɡ','g'), - ('\u031a','#'), - ('\u0348','='), - ('\u031e',''), - ('\u0320',''), - ('\u0339','') -]] - - -def latin_to_hangul(text): - for regex, replacement in _latin_to_hangul: - text = re.sub(regex, replacement, text) - return text - - -def divide_hangul(text): - text = j2hcj(h2j(text)) - for regex, replacement in _hangul_divided: - text = re.sub(regex, replacement, text) - return text - - -def hangul_number(num, sino=True): - '''Reference https://github.com/Kyubyong/g2pK''' - num = re.sub(',', '', num) - - if num == '0': - return '영' - if not sino and num == '20': - return '스무' - - digits = '123456789' - names = '일이삼사오육칠팔구' - digit2name = {d: n for d, n in zip(digits, names)} - - modifiers = '한 두 세 네 다섯 여섯 일곱 여덟 아홉' - decimals = '열 스물 서른 마흔 쉰 예순 일흔 여든 아흔' - digit2mod = {d: mod for d, mod in zip(digits, modifiers.split())} - digit2dec = {d: dec for d, dec in zip(digits, decimals.split())} - - spelledout = [] - for i, digit in enumerate(num): - i = len(num) - i - 1 - if sino: - if i == 0: - name = digit2name.get(digit, '') - elif i == 1: - name = digit2name.get(digit, '') + '십' - name = name.replace('일십', '십') - else: - if i == 0: - name = digit2mod.get(digit, '') - elif i == 1: - name = digit2dec.get(digit, '') - if digit == '0': - if i % 4 == 0: - last_three = spelledout[-min(3, len(spelledout)):] - if ''.join(last_three) == '': - spelledout.append('') - continue - else: - spelledout.append('') - continue - if i == 2: - name = digit2name.get(digit, '') + '백' - name = name.replace('일백', '백') - elif i == 3: - name = digit2name.get(digit, '') + '천' - name = name.replace('일천', '천') - elif i == 4: - name = digit2name.get(digit, '') + '만' - name = name.replace('일만', '만') - elif i == 5: - name = digit2name.get(digit, '') + '십' - name = name.replace('일십', '십') - elif i == 6: - name = digit2name.get(digit, '') + '백' - name = name.replace('일백', '백') - elif i == 7: - name = digit2name.get(digit, '') + '천' - name = name.replace('일천', '천') - elif i == 8: - name = digit2name.get(digit, '') + '억' - elif i == 9: - name = digit2name.get(digit, '') + '십' - elif i == 10: - name = digit2name.get(digit, '') + '백' - elif i == 11: - name = digit2name.get(digit, '') + '천' - elif i == 12: - name = digit2name.get(digit, '') + '조' - elif i == 13: - name = digit2name.get(digit, '') + '십' - elif i == 14: - name = digit2name.get(digit, '') + '백' - elif i == 15: - name = digit2name.get(digit, '') + '천' - spelledout.append(name) - return ''.join(elem for elem in spelledout) - - -def number_to_hangul(text): - '''Reference https://github.com/Kyubyong/g2pK''' - tokens = set(re.findall(r'(\d[\d,]*)([\uac00-\ud71f]+)', text)) - for token in tokens: - num, classifier = token - if classifier[:2] in _korean_classifiers or classifier[0] in _korean_classifiers: - spelledout = hangul_number(num, sino=False) - else: - spelledout = hangul_number(num, sino=True) - text = text.replace(f'{num}{classifier}', f'{spelledout}{classifier}') - # digit by digit for remaining digits - digits = '0123456789' - names = '영일이삼사오육칠팔구' - for d, n in zip(digits, names): - text = text.replace(d, n) - return text - - -def korean_to_lazy_ipa(text): - text = latin_to_hangul(text) - text = number_to_hangul(text) - text=re.sub('[\uac00-\ud7af]+',lambda x:ko_pron.romanise(x.group(0),'ipa').split('] ~ [')[0],text) - for regex, replacement in _ipa_to_lazy_ipa: - text = re.sub(regex, replacement, text) - return text - - -def korean_to_ipa(text): - text = korean_to_lazy_ipa(text) - return text.replace('ʧ','tʃ').replace('ʥ','dʑ') diff --git a/spaces/jurgendn/table-extraction/components/data_module.py b/spaces/jurgendn/table-extraction/components/data_module.py deleted file mode 100644 index 8bee662576ea355f22d843e333dc4c5d2db29ed5..0000000000000000000000000000000000000000 --- a/spaces/jurgendn/table-extraction/components/data_module.py +++ /dev/null @@ -1,81 +0,0 @@ -from typing import Callable, List, Optional, Union - -import torch -from pytorch_lightning import LightningDataModule -from torch.utils.data import DataLoader, Dataset - - -class SampleDataset(Dataset): - - def __init__(self, - x: Union[List, torch.Tensor], - y: Union[List, torch.Tensor], - transforms: Optional[Callable] = None) -> None: - super(SampleDataset, self).__init__() - self.x = x - self.y = y - - if transforms is None: - # Replace None with some default transforms - # If image, could be an Resize and ToTensor - self.transforms = lambda x: x - else: - self.transforms = transforms - - def __len__(self): - return len(self.x) - - def __getitem__(self, index: int): - x = self.x[index] - y = self.y[index] - - x = self.transforms(x) - return x, y - - -class SampleDataModule(LightningDataModule): - - def __init__(self, - x: Union[List, torch.Tensor], - y: Union[List, torch.Tensor], - transforms: Optional[Callable] = None, - val_ratio: float = 0, - batch_size: int = 32) -> None: - super(SampleDataModule, self).__init__() - assert 0 <= val_ratio < 1 - assert isinstance(batch_size, int) - self.x = x - self.y = y - - self.transforms = transforms - self.val_ratio = val_ratio - self.batch_size = batch_size - - self.setup() - self.prepare_data() - - def setup(self, stage: Optional[str] = None) -> None: - pass - - def prepare_data(self) -> None: - n_samples: int = len(self.x) - train_size: int = n_samples - int(n_samples * self.val_ratio) - - self.train_dataset = SampleDataset(x=self.x[:train_size], - y=self.y[:train_size], - transforms=self.transforms) - if train_size < n_samples: - self.val_dataset = SampleDataset(x=self.x[train_size:], - y=self.y[train_size:], - transforms=self.transforms) - else: - self.val_dataset = SampleDataset(x=self.x[-self.batch_size:], - y=self.y[-self.batch_size:], - transforms=self.transforms) - - def train_dataloader(self) -> DataLoader: - return DataLoader(dataset=self.train_dataset, - batch_size=self.batch_size) - - def val_dataloader(self) -> DataLoader: - return DataLoader(dataset=self.val_dataset, batch_size=self.batch_size) diff --git a/spaces/jykoh/gill/gill/layers.py b/spaces/jykoh/gill/gill/layers.py deleted file mode 100644 index 378c89cd9cd44f081ccdce38fb8f9bd7291b1df1..0000000000000000000000000000000000000000 --- a/spaces/jykoh/gill/gill/layers.py +++ /dev/null @@ -1,54 +0,0 @@ -import torch -from torch import nn - - -class TextFcLayer(nn.Module): - """Layers used in mapping text embeddings to visual outputs.""" - - def __init__(self, in_dim: int, out_dim: int, num_input_tokens: int = 1, num_output_tokens: int = 1, mode: str = 'linear'): - super().__init__() - - self.num_input_tokens = num_input_tokens - self.num_output_tokens = num_output_tokens - self.mode = mode - - if mode == 'linear': - self.model = nn.Linear(in_dim, out_dim) - elif mode == 'gill_mapper': # TODO(jykoh): Rename to GILLMapper - hidden_dim = 512 - self.fc = nn.Linear(in_dim, hidden_dim) - self.tfm = nn.Transformer(batch_first=True, norm_first=True, - d_model=hidden_dim, num_encoder_layers=4, num_decoder_layers=4, - dim_feedforward=hidden_dim * 4, dropout=0.0, nhead=4) - self.model = nn.Linear(hidden_dim, out_dim) - self.query_embs = nn.Parameter(torch.randn(1, num_output_tokens, hidden_dim)) - else: - raise NotImplementedError(mode) - - def forward(self, x: torch.Tensor, input_embs: torch.Tensor) -> torch.Tensor: - outputs = None - - if self.mode == 'gill_mapper': - x = x + input_embs - - if isinstance(self.model, nn.ModuleList): - assert len(self.model) == x.shape[1] == self.num_input_tokens, (len(self.model), x.shape, self.num_input_tokens) - outputs = [] - for i in range(self.num_input_tokens): - outputs.append(self.model[i](x[:, i, :])) # (N, D) - outputs = torch.stack(outputs, dim=1) # (N, T, D) - else: - if self.mode == 'gill_mapper': - x = self.fc(x) - x = self.tfm(x, self.query_embs.repeat(x.shape[0], 1, 1)) - outputs = self.model(x) - - if outputs.shape[1] != self.num_output_tokens and self.mode == 'linear': - if self.mode == 'linear': - outputs = outputs[:, :self.num_output_tokens, :] - else: - raise NotImplementedError - - assert outputs.shape[1] == 1 or (outputs.shape[1] * outputs.shape[2] == self.num_output_tokens * 768), (outputs.shape, self.num_output_tokens) - return outputs # (N, T, D) - diff --git a/spaces/kadirnar/yolor/yolor/helpers.py b/spaces/kadirnar/yolor/yolor/helpers.py deleted file mode 100644 index c0e196019b018863a4c6ae1857f8d2bb4b5da85c..0000000000000000000000000000000000000000 --- a/spaces/kadirnar/yolor/yolor/helpers.py +++ /dev/null @@ -1,125 +0,0 @@ -from yolor.utils.general import non_max_suppression, scale_coords -from yolor.utils.download import attempt_download_from_hub -from yolor.utils.datasets import LoadStreams, LoadImages -from yolor.utils.plots import plot_one_box -from yolor.models.models import Darknet -from yolor.detect import load_classes -import torch.backends.cudnn as cudnn -import random -import torch -import cv2 - -import sys -from pathlib import Path - -FILE = Path(__file__).resolve() -ROOT = FILE.parents[0] -if str(ROOT) not in sys.path: - sys.path.append(str(ROOT)) - -class Yolor: - def __init__( - self, - cfg: str = 'yolor/cfg/yolor_p6.cfg', - weights: str = 'yolor/yolor_p6.pt', - imgsz: int = 640, - half : bool = False, - device: str = 'cuda:0', - hf_model: bool = False - ): - self.cfg = cfg - self.imgsz = imgsz - self.half = half - self.webcam = False - self.conf = 0.25 - self.iou = 0.45 - self.classes = None - self.class_name = 'yolor/data/coco.names' - self.save = True - self.show = False - self.save_path = 'output.jpg' - - if hf_model: - self.weights = attempt_download_from_hub(weights) - else: - self.weights = weights - - self.device = torch.device(device) - self.model = self.load_model() - - def load_model(self): - model = Darknet(self.cfg, self.imgsz).to(self.device) - model.load_state_dict(torch.load(self.weights, map_location=self.device)['model']) - model.to(self.device).eval() - if self.half: - model.half() # to FP16 - - return model - - - def predict(self, source): - if self.webcam: - cudnn.benchmark = True # set True to speed up constant image size inference - dataset = LoadStreams(source, img_size=self.imgsz) - else: - save_img = True - dataset = LoadImages(source, img_size=self.imgsz, auto_size=64) - - # Get names and colors - names = load_classes(self.class_name) - colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(len(names))] - - # Run inference - img = torch.zeros((1, 3, self.imgsz, self.imgsz), device=self.device) # init img - for path, img, im0s, vid_cap in dataset: - img = torch.from_numpy(img).to(self.device) - img = img.half() if self.half else img.float() # uint8 to fp16/32 - img /= 255.0 # 0 - 255 to 0.0 - 1.0 - if img.ndimension() == 3: - img = img.unsqueeze(0) - - # Inference - pred = self.model(img, augment=False)[0] - - # Apply NMS - pred = non_max_suppression(pred, self.conf, self.iou, classes=self.classes, agnostic=False) - for i, det in enumerate(pred): # detections per image - if self.webcam: # batch_size >= 1 - p, s, im0 = path[i], '%g: ' % i, im0s[i].copy() - else: - p, s, im0 = path, '', im0s - - s += '%gx%g ' % img.shape[2:] # print string - gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh - if det is not None and len(det): - # Rescale boxes from img_size to im0 size - det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round() - - # Print results - for c in det[:, -1].unique(): - n = (det[:, -1] == c).sum() # detections per class - s += '%g %ss, ' % (n, names[int(c)]) # add to string - - # Write results - for *xyxy, conf, cls in det: - if self.save or self.show: # Add bbox to image - label = '%s %.2f' % (names[int(cls)], conf) - plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3) - - - # Stream results - if self.show: - cv2.imshow(p, im0) - if cv2.waitKey(1) == ord('q'): # q to quit - raise StopIteration - - # Save results (image with detections) - if save_img: - if dataset.mode == 'images': - cv2.imwrite(self.save_path, im0) - - return self.save_path - -if __name__ == '__main__': - yolor = Yolor(cfg='yolor/cfg/yolor_p6.cfg', weights='yolor_p6.pt', imgsz=640, device='cuda:0', hf_model=False) - yolor.predict('yolor/data/highway.jpg') diff --git a/spaces/kamezawash/rembg/rembg/__init__.py b/spaces/kamezawash/rembg/rembg/__init__.py deleted file mode 100644 index afdc5405843f1d962cef9f0165280385c1b45ab3..0000000000000000000000000000000000000000 --- a/spaces/kamezawash/rembg/rembg/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -import sys -import warnings - -if not (sys.version_info.major == 3 and sys.version_info.minor == 9): - warnings.warn("This library is only for Python 3.9", RuntimeWarning) - -from . import _version - -__version__ = _version.get_versions()["version"] - -from .bg import remove diff --git a/spaces/keras-dreambooth/dreambooth_fantasy/app.py b/spaces/keras-dreambooth/dreambooth_fantasy/app.py deleted file mode 100644 index 64811a907cd1d7ed2bef858c5e8974f273e099bc..0000000000000000000000000000000000000000 --- a/spaces/keras-dreambooth/dreambooth_fantasy/app.py +++ /dev/null @@ -1,53 +0,0 @@ -from huggingface_hub import from_pretrained_keras -import keras_cv -import gradio as gr -from tensorflow import keras - -keras.mixed_precision.set_global_policy("mixed_float16") -# load keras model -resolution = 512 -dreambooth_model = keras_cv.models.StableDiffusion( - img_width=resolution, img_height=resolution, jit_compile=True, - ) -loaded_diffusion_model = from_pretrained_keras("keras-dreambooth/dreambooth_fantasy") -dreambooth_model._diffusion_model = loaded_diffusion_model - - -def generate_images(prompt: str, negative_prompt:str, num_imgs_to_gen: int, num_steps: int): - """ - This function is used to generate images using our fine-tuned keras dreambooth stable diffusion model. - Args: - prompt (str): The text input given by the user based on which images will be generated. - num_imgs_to_gen (int): The number of images to be generated using given prompt. - num_steps (int): The number of denoising steps - Returns: - generated_img (List): List of images that were generated using the model - """ - generated_img = dreambooth_model.text_to_image( - prompt, - negative_prompt=negative_prompt, - batch_size=num_imgs_to_gen, - num_steps=num_steps, - ) - - return generated_img - -with gr.Blocks() as demo: - gr.HTML("

                Keras Dreambooth - Dreambooth Fantasy Demo

                ") - with gr.Row(): - with gr.Column(): - prompt = gr.Textbox(lines=1, value="sks fantasy_world that is colorful with green scenary", label="Base Prompt") - negative_prompt = gr.Textbox(lines=1, value="deformed", label="Negative Prompt") - samples = gr.Slider(minimum=1, maximum=10, default=1, step=1, label="Number of Image") - num_steps = gr.Slider(label="Inference Steps",value=50) - run = gr.Button(value="Run") - with gr.Column(): - gallery = gr.Gallery(label="Outputs").style(grid=(1,2)) - - run.click(generate_images, inputs=[prompt,negative_prompt, samples, num_steps], outputs=gallery) - - gr.Examples([["A phot of sks fantasy_world that is colorful with green scenary","blue sky", 3, 75]], - [prompt,negative_prompt, samples,num_steps], gallery, generate_images) - gr.Markdown('\n Demo created by: Derrick Mwiti') - -demo.launch(debug=True) \ No newline at end of file diff --git a/spaces/keras-io/cct/README.md b/spaces/keras-io/cct/README.md deleted file mode 100644 index db89e95707841a6861c5ca15c40183eee09392b6..0000000000000000000000000000000000000000 --- a/spaces/keras-io/cct/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Cct -emoji: 🌖 -colorFrom: yellow -colorTo: gray -sdk: gradio -sdk_version: 3.0.17 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/keras-io/ctc_asr/app.py b/spaces/keras-io/ctc_asr/app.py deleted file mode 100644 index 2c818de7f56723303b8e414974f4caedbc800434..0000000000000000000000000000000000000000 --- a/spaces/keras-io/ctc_asr/app.py +++ /dev/null @@ -1,178 +0,0 @@ -import gradio as gr -import numpy as np -import tensorflow as tf -from tensorflow import keras -import tensorflow_io as tfio -from huggingface_hub import from_pretrained_keras - - -model = from_pretrained_keras("keras-io/ctc_asr", compile=False) - -characters = [x for x in "abcdefghijklmnopqrstuvwxyz'?! "] -# Mapping characters to integers -char_to_num = keras.layers.StringLookup(vocabulary=characters, oov_token="") -# Mapping integers back to original characters -num_to_char = keras.layers.StringLookup( - vocabulary=char_to_num.get_vocabulary(), oov_token="", invert=True -) - -# An integer scalar Tensor. The window length in samples. -frame_length = 256 -# An integer scalar Tensor. The number of samples to step. -frame_step = 160 -# An integer scalar Tensor. The size of the FFT to apply. -# If not provided, uses the smallest power of 2 enclosing frame_length. -fft_length = 384 - -SAMPLE_RATE = 22050 - - -def decode_batch_predictions(pred): - input_len = np.ones(pred.shape[0]) * pred.shape[1] - # Use greedy search. For complex tasks, you can use beam search - results = keras.backend.ctc_decode(pred, input_length=input_len, greedy=True)[0][0] - # Iterate over the results and get back the text - output_text = [] - for result in results: - result = tf.strings.reduce_join(num_to_char(result)).numpy().decode("utf-8") - output_text.append(result) - return output_text - - -def load_16k_audio_wav(filename): - # Read file content - file_content = tf.io.read_file(filename) - - # Decode audio wave - audio_wav, sample_rate = tf.audio.decode_wav(file_content, desired_channels=1) - audio_wav = tf.squeeze(audio_wav, axis=-1) - sample_rate = tf.cast(sample_rate, dtype=tf.int64) - - # Resample to 16k - audio_wav = tfio.audio.resample( - audio_wav, rate_in=sample_rate, rate_out=SAMPLE_RATE - ) - - return audio_wav - - -def mic_to_tensor(recorded_audio_file): - sample_rate, audio = recorded_audio_file - - audio_wav = tf.constant(audio, dtype=tf.float32) - if tf.rank(audio_wav) > 1: - audio_wav = tf.reduce_mean(audio_wav, axis=1) - audio_wav = tfio.audio.resample( - audio_wav, rate_in=sample_rate, rate_out=SAMPLE_RATE - ) - - audio_wav = tf.divide(audio_wav, tf.reduce_max(tf.abs(audio_wav))) - - return audio_wav - - -def tensor_to_predictions(audio_tensor): - # 3. Change type to float - audio_tensor = tf.cast(audio_tensor, tf.float32) - - # 4. Get the spectrogram - spectrogram = tf.signal.stft( - audio_tensor, - frame_length=frame_length, - frame_step=frame_step, - fft_length=fft_length, - ) - - # 5. We only need the magnitude, which can be derived by applying tf.abs - spectrogram = tf.abs(spectrogram) - spectrogram = tf.math.pow(spectrogram, 0.5) - - # 6. normalisation - means = tf.math.reduce_mean(spectrogram, 1, keepdims=True) - stddevs = tf.math.reduce_std(spectrogram, 1, keepdims=True) - spectrogram = (spectrogram - means) / (stddevs + 1e-10) - - spectrogram = tf.expand_dims(spectrogram, axis=0) - - batch_predictions = model.predict(spectrogram) - batch_predictions = decode_batch_predictions(batch_predictions) - return batch_predictions - - -def clear_inputs_and_outputs(): - return [None, None, None] - - -def predict(recorded_audio_file, uploaded_audio_file): - # 1. Read wav file - if recorded_audio_file: - audio_tensor = mic_to_tensor(recorded_audio_file) - else: - audio_tensor = load_16k_audio_wav(uploaded_audio_file) - - prediction = tensor_to_predictions(audio_tensor)[0] - return prediction - - -# gr.Interface( -# infer, -# inputs=gr.Audio(source="microphone", type="filepath"), -# outputs=gr.Textbox(lines=5, label="Input Text"), -# #title=title, -# #description=description, -# #article=article, -# #examples=examples, -# enable_queue=True, -# ).launch(debug=True) - -# Main function -if __name__ == "__main__": - demo = gr.Blocks() - - with demo: - gr.Markdown( - """ -

                Automatic Speech Recognition using CTC

                \ - This space is a demo of Automatic Speech Recognition using Keras trained on LJSpeech dataset.
                \ - In this space, you can record your voice or upload a wav file and the model will predict the words spoken in English

                - """ - ) - with gr.Row(): - ## Input - with gr.Column(): - mic_input = gr.Audio(source="microphone", label="Record your own voice") - upl_input = gr.Audio( - source="upload", type="filepath", label="Upload a wav file" - ) - - with gr.Row(): - clr_btn = gr.Button(value="Clear", variant="secondary") - prd_btn = gr.Button(value="Predict") - - # Outputs - with gr.Column(): - lbl_output = gr.Label(label="Text") - - # Credits - with gr.Row(): - gr.Markdown( - """ -

                Credits

                - Author: Anurag Singh.
                - Based on the following Keras example Automatic Speech Recognition using CTC by Mohamed Reda Bouadjenek and Ngoc Dung Huynh
                - Check out the model here - """ - ) - - clr_btn.click( - fn=clear_inputs_and_outputs, - inputs=[], - outputs=[mic_input, upl_input, lbl_output], - ) - prd_btn.click( - fn=predict, - inputs=[mic_input, upl_input], - outputs=[lbl_output], - ) - - demo.launch(debug=True) diff --git a/spaces/keras-io/structured-data-classification-grn-vsn/app.py b/spaces/keras-io/structured-data-classification-grn-vsn/app.py deleted file mode 100644 index 4abab1b5fd1c3712365ee414383ea5f5b99852a5..0000000000000000000000000000000000000000 --- a/spaces/keras-io/structured-data-classification-grn-vsn/app.py +++ /dev/null @@ -1,61 +0,0 @@ -import gradio as gr -from utils.constants import CSV_HEADER, NUMERIC_FEATURE_NAMES, NUMBER_INPUT_COLS -from utils.preprocess import create_max_values_map, create_dropdown_default_values_map, create_sample_test_data, CATEGORICAL_FEATURES_WITH_VOCABULARY -from utils.predict import batch_predict, user_input_predict - -inputs_list = [] -max_values_map = create_max_values_map() -dropdown_default_values_map = create_dropdown_default_values_map() -sample_input_df_val = create_sample_test_data() - - -demo = gr.Blocks() - -with demo: - - gr.Markdown("# **Binary Classification using Gated Residual and Variable Selection Networks** \n") - gr.Markdown("This space demonstrates the use of Gated Residual Networks (GRN) and Variable Selection Networks (VSN), proposed by Bryan Lim et al. in Temporal Fusion Transformers (TFT) for Interpretable Multi-horizon Time Series Forecasting for structured data classification") - gr.Markdown("The model used by this space was trained on the [United States Census Income Dataset](https://archive.ics.uci.edu/ml/datasets/Census-Income+%28KDD%29) and helps to predict if the income of a person will be >$500K or not.") - gr.Markdown("Play around and see yourself 🤗 ") - - with gr.Tabs(): - - with gr.TabItem("Predict using Example inputs"): - gr.Markdown("**Input DataFrame** \n") - input_df = gr.Dataframe(headers=CSV_HEADER,value=sample_input_df_val,) - gr.Markdown("**Output DataFrame** \n") - output_df = gr.Dataframe() - gr.Markdown("**Make Predictions**") - with gr.Row(): - compute_button = gr.Button("Predict") - - with gr.TabItem("Tweak inputs Yourself & Predict"): - with gr.Tabs(): - - with gr.TabItem("Numerical Inputs"): - gr.Markdown("Set values for numerical inputs here.") - for num_variable in NUMERIC_FEATURE_NAMES: - with gr.Column(): - if num_variable in NUMBER_INPUT_COLS: - numeric_input = gr.Number(label=num_variable) - else: - curr_max_val = max_values_map["max_"+num_variable] - numeric_input = gr.Slider(0,curr_max_val, label=num_variable,step=1) - inputs_list.append(numeric_input) - - with gr.TabItem("Categorical Inputs"): - gr.Markdown("Choose values for categorical inputs here.") - for cat_variable in CATEGORICAL_FEATURES_WITH_VOCABULARY.keys(): - with gr.Column(): - categorical_input = gr.Dropdown(CATEGORICAL_FEATURES_WITH_VOCABULARY[cat_variable], label=cat_variable, value=str(dropdown_default_values_map["max_"+cat_variable])) - inputs_list.append(categorical_input) - - predict_button = gr.Button("Predict") - final_output = gr.Label() - - predict_button.click(user_input_predict, inputs=inputs_list, outputs=final_output) - compute_button.click(batch_predict, inputs=input_df, outputs=output_df) - gr.Markdown('\n Demo created by: Shivalika Singh
                Based on this Keras example by Khalid Salama
                Demo Powered by this GRN-VSN model') - - -demo.launch() \ No newline at end of file diff --git a/spaces/kevinwang676/ChatGLM2-SadTalker-VC/src/face3d/models/arcface_torch/utils/utils_os.py b/spaces/kevinwang676/ChatGLM2-SadTalker-VC/src/face3d/models/arcface_torch/utils/utils_os.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/kokofixcomputers/chat-ui/src/routes/admin/export/+server.ts b/spaces/kokofixcomputers/chat-ui/src/routes/admin/export/+server.ts deleted file mode 100644 index e8806ab8b719c399455229289d88f00ddb3d8e43..0000000000000000000000000000000000000000 --- a/spaces/kokofixcomputers/chat-ui/src/routes/admin/export/+server.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - PARQUET_EXPORT_DATASET, - PARQUET_EXPORT_HF_TOKEN, - PARQUET_EXPORT_SECRET, -} from "$env/static/private"; -import { collections } from "$lib/server/database"; -import type { Message } from "$lib/types/Message"; -import { error } from "@sveltejs/kit"; -import { pathToFileURL } from "node:url"; -import { unlink } from "node:fs/promises"; -import { uploadFile } from "@huggingface/hub"; -import parquet from "parquetjs"; -import { z } from "zod"; - -// Triger like this: -// curl -X POST "http://localhost:5173/chat/admin/export" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{"model": "OpenAssistant/oasst-sft-6-llama-30b-xor"}' - -export async function POST({ request }) { - if (!PARQUET_EXPORT_SECRET || !PARQUET_EXPORT_DATASET || !PARQUET_EXPORT_HF_TOKEN) { - throw error(500, "Parquet export is not configured."); - } - - if (request.headers.get("Authorization") !== `Bearer ${PARQUET_EXPORT_SECRET}`) { - throw error(403); - } - - const { model } = z - .object({ - model: z.string(), - }) - .parse(await request.json()); - - const schema = new parquet.ParquetSchema({ - title: { type: "UTF8" }, - created_at: { type: "TIMESTAMP_MILLIS" }, - updated_at: { type: "TIMESTAMP_MILLIS" }, - messages: { repeated: true, fields: { from: { type: "UTF8" }, content: { type: "UTF8" } } }, - }); - - const fileName = `/tmp/conversations-${new Date().toJSON().slice(0, 10)}-${Date.now()}.parquet`; - - const writer = await parquet.ParquetWriter.openFile(schema, fileName); - - let count = 0; - console.log("Exporting conversations for model", model); - - for await (const conversation of collections.settings.aggregate<{ - title: string; - created_at: Date; - updated_at: Date; - messages: Message[]; - }>([ - { $match: { shareConversationsWithModelAuthors: true } }, - { - $lookup: { - from: "conversations", - localField: "sessionId", - foreignField: "sessionId", - as: "conversations", - pipeline: [{ $match: { model } }], - }, - }, - { $unwind: "$conversations" }, - { - $project: { - title: "$conversations.title", - created_at: "$conversations.createdAt", - updated_at: "$conversations.updatedAt", - messages: "$conversations.messages", - }, - }, - ])) { - await writer.appendRow({ - title: conversation.title, - created_at: conversation.created_at, - updated_at: conversation.updated_at, - messages: conversation.messages.map((message: Message) => ({ - from: message.from, - content: message.content, - })), - }); - ++count; - - if (count % 1_000 === 0) { - console.log("Exported", count, "conversations"); - } - } - - await writer.close(); - - console.log("Uploading", fileName, "to Hugging Face Hub"); - - await uploadFile({ - file: pathToFileURL(fileName), - credentials: { accessToken: PARQUET_EXPORT_HF_TOKEN }, - repo: { - type: "dataset", - name: PARQUET_EXPORT_DATASET, - }, - }); - - console.log("Upload done"); - - await unlink(fileName); - - return new Response(); -} diff --git a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/PIL/PyAccess.py b/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/PIL/PyAccess.py deleted file mode 100644 index 39747b4f311807822d225d091f1616eeaed388ff..0000000000000000000000000000000000000000 --- a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/PIL/PyAccess.py +++ /dev/null @@ -1,360 +0,0 @@ -# -# The Python Imaging Library -# Pillow fork -# -# Python implementation of the PixelAccess Object -# -# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved. -# Copyright (c) 1995-2009 by Fredrik Lundh. -# Copyright (c) 2013 Eric Soroos -# -# See the README file for information on usage and redistribution -# - -# Notes: -# -# * Implements the pixel access object following Access.c -# * Taking only the tuple form, which is used from python. -# * Fill.c uses the integer form, but it's still going to use the old -# Access.c implementation. -# - -import logging -import sys - -try: - from cffi import FFI - - defs = """ - struct Pixel_RGBA { - unsigned char r,g,b,a; - }; - struct Pixel_I16 { - unsigned char l,r; - }; - """ - ffi = FFI() - ffi.cdef(defs) -except ImportError as ex: - # Allow error import for doc purposes, but error out when accessing - # anything in core. - from ._util import DeferredError - - FFI = ffi = DeferredError(ex) - -logger = logging.getLogger(__name__) - - -class PyAccess: - def __init__(self, img, readonly=False): - vals = dict(img.im.unsafe_ptrs) - self.readonly = readonly - self.image8 = ffi.cast("unsigned char **", vals["image8"]) - self.image32 = ffi.cast("int **", vals["image32"]) - self.image = ffi.cast("unsigned char **", vals["image"]) - self.xsize, self.ysize = img.im.size - self._img = img - - # Keep pointer to im object to prevent dereferencing. - self._im = img.im - if self._im.mode in ("P", "PA"): - self._palette = img.palette - - # Debugging is polluting test traces, only useful here - # when hacking on PyAccess - # logger.debug("%s", vals) - self._post_init() - - def _post_init(self): - pass - - def __setitem__(self, xy, color): - """ - Modifies the pixel at x,y. The color is given as a single - numerical value for single band images, and a tuple for - multi-band images - - :param xy: The pixel coordinate, given as (x, y). See - :ref:`coordinate-system`. - :param color: The pixel value. - """ - if self.readonly: - msg = "Attempt to putpixel a read only image" - raise ValueError(msg) - (x, y) = xy - if x < 0: - x = self.xsize + x - if y < 0: - y = self.ysize + y - (x, y) = self.check_xy((x, y)) - - if ( - self._im.mode in ("P", "PA") - and isinstance(color, (list, tuple)) - and len(color) in [3, 4] - ): - # RGB or RGBA value for a P or PA image - if self._im.mode == "PA": - alpha = color[3] if len(color) == 4 else 255 - color = color[:3] - color = self._palette.getcolor(color, self._img) - if self._im.mode == "PA": - color = (color, alpha) - - return self.set_pixel(x, y, color) - - def __getitem__(self, xy): - """ - Returns the pixel at x,y. The pixel is returned as a single - value for single band images or a tuple for multiple band - images - - :param xy: The pixel coordinate, given as (x, y). See - :ref:`coordinate-system`. - :returns: a pixel value for single band images, a tuple of - pixel values for multiband images. - """ - (x, y) = xy - if x < 0: - x = self.xsize + x - if y < 0: - y = self.ysize + y - (x, y) = self.check_xy((x, y)) - return self.get_pixel(x, y) - - putpixel = __setitem__ - getpixel = __getitem__ - - def check_xy(self, xy): - (x, y) = xy - if not (0 <= x < self.xsize and 0 <= y < self.ysize): - msg = "pixel location out of range" - raise ValueError(msg) - return xy - - -class _PyAccess32_2(PyAccess): - """PA, LA, stored in first and last bytes of a 32 bit word""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32) - - def get_pixel(self, x, y): - pixel = self.pixels[y][x] - return pixel.r, pixel.a - - def set_pixel(self, x, y, color): - pixel = self.pixels[y][x] - # tuple - pixel.r = min(color[0], 255) - pixel.a = min(color[1], 255) - - -class _PyAccess32_3(PyAccess): - """RGB and friends, stored in the first three bytes of a 32 bit word""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32) - - def get_pixel(self, x, y): - pixel = self.pixels[y][x] - return pixel.r, pixel.g, pixel.b - - def set_pixel(self, x, y, color): - pixel = self.pixels[y][x] - # tuple - pixel.r = min(color[0], 255) - pixel.g = min(color[1], 255) - pixel.b = min(color[2], 255) - pixel.a = 255 - - -class _PyAccess32_4(PyAccess): - """RGBA etc, all 4 bytes of a 32 bit word""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32) - - def get_pixel(self, x, y): - pixel = self.pixels[y][x] - return pixel.r, pixel.g, pixel.b, pixel.a - - def set_pixel(self, x, y, color): - pixel = self.pixels[y][x] - # tuple - pixel.r = min(color[0], 255) - pixel.g = min(color[1], 255) - pixel.b = min(color[2], 255) - pixel.a = min(color[3], 255) - - -class _PyAccess8(PyAccess): - """1, L, P, 8 bit images stored as uint8""" - - def _post_init(self, *args, **kwargs): - self.pixels = self.image8 - - def get_pixel(self, x, y): - return self.pixels[y][x] - - def set_pixel(self, x, y, color): - try: - # integer - self.pixels[y][x] = min(color, 255) - except TypeError: - # tuple - self.pixels[y][x] = min(color[0], 255) - - -class _PyAccessI16_N(PyAccess): - """I;16 access, native bitendian without conversion""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("unsigned short **", self.image) - - def get_pixel(self, x, y): - return self.pixels[y][x] - - def set_pixel(self, x, y, color): - try: - # integer - self.pixels[y][x] = min(color, 65535) - except TypeError: - # tuple - self.pixels[y][x] = min(color[0], 65535) - - -class _PyAccessI16_L(PyAccess): - """I;16L access, with conversion""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("struct Pixel_I16 **", self.image) - - def get_pixel(self, x, y): - pixel = self.pixels[y][x] - return pixel.l + pixel.r * 256 - - def set_pixel(self, x, y, color): - pixel = self.pixels[y][x] - try: - color = min(color, 65535) - except TypeError: - color = min(color[0], 65535) - - pixel.l = color & 0xFF # noqa: E741 - pixel.r = color >> 8 - - -class _PyAccessI16_B(PyAccess): - """I;16B access, with conversion""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("struct Pixel_I16 **", self.image) - - def get_pixel(self, x, y): - pixel = self.pixels[y][x] - return pixel.l * 256 + pixel.r - - def set_pixel(self, x, y, color): - pixel = self.pixels[y][x] - try: - color = min(color, 65535) - except Exception: - color = min(color[0], 65535) - - pixel.l = color >> 8 # noqa: E741 - pixel.r = color & 0xFF - - -class _PyAccessI32_N(PyAccess): - """Signed Int32 access, native endian""" - - def _post_init(self, *args, **kwargs): - self.pixels = self.image32 - - def get_pixel(self, x, y): - return self.pixels[y][x] - - def set_pixel(self, x, y, color): - self.pixels[y][x] = color - - -class _PyAccessI32_Swap(PyAccess): - """I;32L/B access, with byteswapping conversion""" - - def _post_init(self, *args, **kwargs): - self.pixels = self.image32 - - def reverse(self, i): - orig = ffi.new("int *", i) - chars = ffi.cast("unsigned char *", orig) - chars[0], chars[1], chars[2], chars[3] = chars[3], chars[2], chars[1], chars[0] - return ffi.cast("int *", chars)[0] - - def get_pixel(self, x, y): - return self.reverse(self.pixels[y][x]) - - def set_pixel(self, x, y, color): - self.pixels[y][x] = self.reverse(color) - - -class _PyAccessF(PyAccess): - """32 bit float access""" - - def _post_init(self, *args, **kwargs): - self.pixels = ffi.cast("float **", self.image32) - - def get_pixel(self, x, y): - return self.pixels[y][x] - - def set_pixel(self, x, y, color): - try: - # not a tuple - self.pixels[y][x] = color - except TypeError: - # tuple - self.pixels[y][x] = color[0] - - -mode_map = { - "1": _PyAccess8, - "L": _PyAccess8, - "P": _PyAccess8, - "I;16N": _PyAccessI16_N, - "LA": _PyAccess32_2, - "La": _PyAccess32_2, - "PA": _PyAccess32_2, - "RGB": _PyAccess32_3, - "LAB": _PyAccess32_3, - "HSV": _PyAccess32_3, - "YCbCr": _PyAccess32_3, - "RGBA": _PyAccess32_4, - "RGBa": _PyAccess32_4, - "RGBX": _PyAccess32_4, - "CMYK": _PyAccess32_4, - "F": _PyAccessF, - "I": _PyAccessI32_N, -} - -if sys.byteorder == "little": - mode_map["I;16"] = _PyAccessI16_N - mode_map["I;16L"] = _PyAccessI16_N - mode_map["I;16B"] = _PyAccessI16_B - - mode_map["I;32L"] = _PyAccessI32_N - mode_map["I;32B"] = _PyAccessI32_Swap -else: - mode_map["I;16"] = _PyAccessI16_L - mode_map["I;16L"] = _PyAccessI16_L - mode_map["I;16B"] = _PyAccessI16_N - - mode_map["I;32L"] = _PyAccessI32_Swap - mode_map["I;32B"] = _PyAccessI32_N - - -def new(img, readonly=False): - access_type = mode_map.get(img.mode, None) - if not access_type: - logger.debug("PyAccess Not Implemented: %s", img.mode) - return None - return access_type(img, readonly) diff --git a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/altair/utils/mimebundle.py b/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/altair/utils/mimebundle.py deleted file mode 100644 index 1e00542fb4617e01a6bece351494e512835779c8..0000000000000000000000000000000000000000 --- a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/altair/utils/mimebundle.py +++ /dev/null @@ -1,196 +0,0 @@ -from .html import spec_to_html - - -def spec_to_mimebundle( - spec, - format, - mode=None, - vega_version=None, - vegaembed_version=None, - vegalite_version=None, - engine=None, - **kwargs, -): - """Convert a vega-lite specification to a mimebundle - - The mimebundle type is controlled by the ``format`` argument, which can be - one of the following ['html', 'json', 'png', 'svg', 'pdf', 'vega', 'vega-lite'] - - Parameters - ---------- - spec : dict - a dictionary representing a vega-lite plot spec - format : string {'html', 'json', 'png', 'svg', 'pdf', 'vega', 'vega-lite'} - the file format to be saved. - mode : string {'vega-lite'} - The rendering mode. - vega_version : string - The version of vega.js to use - vegaembed_version : string - The version of vegaembed.js to use - vegalite_version : string - The version of vegalite.js to use. Only required if mode=='vega-lite' - engine: string {'vl-convert', 'altair_saver'} - the conversion engine to use for 'png', 'svg', 'pdf', and 'vega' formats - **kwargs : - Additional arguments will be passed to the generating function - - Returns - ------- - output : dict - a mime-bundle representing the image - - Note - ---- - The png, svg, pdf, and vega outputs require the altair_saver package - """ - if mode != "vega-lite": - raise ValueError("mode must be 'vega-lite'") - - if format in ["png", "svg", "pdf", "vega"]: - return _spec_to_mimebundle_with_engine( - spec, format, mode, engine=engine, **kwargs - ) - if format == "html": - html = spec_to_html( - spec, - mode=mode, - vega_version=vega_version, - vegaembed_version=vegaembed_version, - vegalite_version=vegalite_version, - **kwargs, - ) - return {"text/html": html} - if format == "vega-lite": - if vegalite_version is None: - raise ValueError("Must specify vegalite_version") - return {"application/vnd.vegalite.v{}+json".format(vegalite_version[0]): spec} - if format == "json": - return {"application/json": spec} - raise ValueError( - "format must be one of " - "['html', 'json', 'png', 'svg', 'pdf', 'vega', 'vega-lite']" - ) - - -def _spec_to_mimebundle_with_engine(spec, format, mode, **kwargs): - """Helper for Vega-Lite to mimebundle conversions that require an engine - - Parameters - ---------- - spec : dict - a dictionary representing a vega-lite plot spec - format : string {'png', 'svg', 'pdf', 'vega'} - the format of the mimebundle to be returned - mode : string {'vega-lite'} - The rendering mode. - engine: string {'vl-convert', 'altair_saver'} - the conversion engine to use - **kwargs : - Additional arguments will be passed to the conversion function - """ - # Normalize the engine string (if any) by lower casing - # and removing underscores and hyphens - engine = kwargs.pop("engine", None) - normalized_engine = _validate_normalize_engine(engine, format) - - if normalized_engine == "vlconvert": - import vl_convert as vlc - from ..vegalite import SCHEMA_VERSION - - # Compute VlConvert's vl_version string (of the form 'v5_2') - # from SCHEMA_VERSION (of the form 'v5.2.0') - vl_version = "_".join(SCHEMA_VERSION.split(".")[:2]) - if format == "vega": - vg = vlc.vegalite_to_vega(spec, vl_version=vl_version) - return {"application/vnd.vega.v5+json": vg} - elif format == "svg": - svg = vlc.vegalite_to_svg(spec, vl_version=vl_version) - return {"image/svg+xml": svg} - elif format == "png": - png = vlc.vegalite_to_png( - spec, - vl_version=vl_version, - scale=kwargs.get("scale_factor", 1.0), - ) - return {"image/png": png} - else: - # This should be validated above - # but raise exception for the sake of future development - raise ValueError("Unexpected format {fmt!r}".format(fmt=format)) - elif normalized_engine == "altairsaver": - import altair_saver - - return altair_saver.render(spec, format, mode=mode, **kwargs) - else: - # This should be validated above - # but raise exception for the sake of future development - raise ValueError( - "Unexpected normalized_engine {eng!r}".format(eng=normalized_engine) - ) - - -def _validate_normalize_engine(engine, format): - """Helper to validate and normalize the user-provided engine - - engine : {None, 'vl-convert', 'altair_saver'} - the user-provided engine string - format : string {'png', 'svg', 'pdf', 'vega'} - the format of the mimebundle to be returned - """ - # Try to import vl_convert - try: - import vl_convert as vlc - except ImportError: - vlc = None - - # Try to import altair_saver - try: - import altair_saver - except ImportError: - altair_saver = None - - # Normalize engine string by lower casing and removing underscores and hyphens - normalized_engine = ( - None if engine is None else engine.lower().replace("-", "").replace("_", "") - ) - - # Validate or infer default value of normalized_engine - if normalized_engine == "vlconvert": - if vlc is None: - raise ValueError( - "The 'vl-convert' conversion engine requires the vl-convert-python package" - ) - if format == "pdf": - raise ValueError( - "The 'vl-convert' conversion engine does not support the {fmt!r} format.\n" - "Use the 'altair_saver' engine instead".format(fmt=format) - ) - elif normalized_engine == "altairsaver": - if altair_saver is None: - raise ValueError( - "The 'altair_saver' conversion engine requires the altair_saver package" - ) - elif normalized_engine is None: - if vlc is not None and format != "pdf": - normalized_engine = "vlconvert" - elif altair_saver is not None: - normalized_engine = "altairsaver" - else: - if format == "pdf": - raise ValueError( - "Saving charts in {fmt!r} format requires the altair_saver package: " - "see http://github.com/altair-viz/altair_saver/".format(fmt=format) - ) - else: - raise ValueError( - "Saving charts in {fmt!r} format requires the vl-convert-python or altair_saver package: " - "see http://github.com/altair-viz/altair_saver/".format(fmt=format) - ) - else: - raise ValueError( - "Invalid conversion engine {engine!r}. Expected one of {valid!r}".format( - engine=engine, valid=("vl-convert", "altair_saver") - ) - ) - return normalized_engine diff --git a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/fontTools/ttLib/tables/T_S_I_S_.py b/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/fontTools/ttLib/tables/T_S_I_S_.py deleted file mode 100644 index 667eb0e53473c1566d4b45e5621d8897ebd7b9fe..0000000000000000000000000000000000000000 --- a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/fontTools/ttLib/tables/T_S_I_S_.py +++ /dev/null @@ -1,5 +0,0 @@ -from .T_S_I_V_ import table_T_S_I_V_ - - -class table_T_S_I_S_(table_T_S_I_V_): - pass diff --git a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/h11/_writers.py b/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/h11/_writers.py deleted file mode 100644 index 939cdb912a9debaea07fbf3a9ac04549c44d077c..0000000000000000000000000000000000000000 --- a/spaces/ky2k/Toxicity_Classifier_POC/.venv/lib/python3.9/site-packages/h11/_writers.py +++ /dev/null @@ -1,145 +0,0 @@ -# Code to read HTTP data -# -# Strategy: each writer takes an event + a write-some-bytes function, which is -# calls. -# -# WRITERS is a dict describing how to pick a reader. It maps states to either: -# - a writer -# - or, for body writers, a dict of framin-dependent writer factories - -from typing import Any, Callable, Dict, List, Tuple, Type, Union - -from ._events import Data, EndOfMessage, Event, InformationalResponse, Request, Response -from ._headers import Headers -from ._state import CLIENT, IDLE, SEND_BODY, SEND_RESPONSE, SERVER -from ._util import LocalProtocolError, Sentinel - -__all__ = ["WRITERS"] - -Writer = Callable[[bytes], Any] - - -def write_headers(headers: Headers, write: Writer) -> None: - # "Since the Host field-value is critical information for handling a - # request, a user agent SHOULD generate Host as the first header field - # following the request-line." - RFC 7230 - raw_items = headers._full_items - for raw_name, name, value in raw_items: - if name == b"host": - write(b"%s: %s\r\n" % (raw_name, value)) - for raw_name, name, value in raw_items: - if name != b"host": - write(b"%s: %s\r\n" % (raw_name, value)) - write(b"\r\n") - - -def write_request(request: Request, write: Writer) -> None: - if request.http_version != b"1.1": - raise LocalProtocolError("I only send HTTP/1.1") - write(b"%s %s HTTP/1.1\r\n" % (request.method, request.target)) - write_headers(request.headers, write) - - -# Shared between InformationalResponse and Response -def write_any_response( - response: Union[InformationalResponse, Response], write: Writer -) -> None: - if response.http_version != b"1.1": - raise LocalProtocolError("I only send HTTP/1.1") - status_bytes = str(response.status_code).encode("ascii") - # We don't bother sending ascii status messages like "OK"; they're - # optional and ignored by the protocol. (But the space after the numeric - # status code is mandatory.) - # - # XX FIXME: could at least make an effort to pull out the status message - # from stdlib's http.HTTPStatus table. Or maybe just steal their enums - # (either by import or copy/paste). We already accept them as status codes - # since they're of type IntEnum < int. - write(b"HTTP/1.1 %s %s\r\n" % (status_bytes, response.reason)) - write_headers(response.headers, write) - - -class BodyWriter: - def __call__(self, event: Event, write: Writer) -> None: - if type(event) is Data: - self.send_data(event.data, write) - elif type(event) is EndOfMessage: - self.send_eom(event.headers, write) - else: # pragma: no cover - assert False - - def send_data(self, data: bytes, write: Writer) -> None: - pass - - def send_eom(self, headers: Headers, write: Writer) -> None: - pass - - -# -# These are all careful not to do anything to 'data' except call len(data) and -# write(data). This allows us to transparently pass-through funny objects, -# like placeholder objects referring to files on disk that will be sent via -# sendfile(2). -# -class ContentLengthWriter(BodyWriter): - def __init__(self, length: int) -> None: - self._length = length - - def send_data(self, data: bytes, write: Writer) -> None: - self._length -= len(data) - if self._length < 0: - raise LocalProtocolError("Too much data for declared Content-Length") - write(data) - - def send_eom(self, headers: Headers, write: Writer) -> None: - if self._length != 0: - raise LocalProtocolError("Too little data for declared Content-Length") - if headers: - raise LocalProtocolError("Content-Length and trailers don't mix") - - -class ChunkedWriter(BodyWriter): - def send_data(self, data: bytes, write: Writer) -> None: - # if we encoded 0-length data in the naive way, it would look like an - # end-of-message. - if not data: - return - write(b"%x\r\n" % len(data)) - write(data) - write(b"\r\n") - - def send_eom(self, headers: Headers, write: Writer) -> None: - write(b"0\r\n") - write_headers(headers, write) - - -class Http10Writer(BodyWriter): - def send_data(self, data: bytes, write: Writer) -> None: - write(data) - - def send_eom(self, headers: Headers, write: Writer) -> None: - if headers: - raise LocalProtocolError("can't send trailers to HTTP/1.0 client") - # no need to close the socket ourselves, that will be taken care of by - # Connection: close machinery - - -WritersType = Dict[ - Union[Tuple[Type[Sentinel], Type[Sentinel]], Type[Sentinel]], - Union[ - Dict[str, Type[BodyWriter]], - Callable[[Union[InformationalResponse, Response], Writer], None], - Callable[[Request, Writer], None], - ], -] - -WRITERS: WritersType = { - (CLIENT, IDLE): write_request, - (SERVER, IDLE): write_any_response, - (SERVER, SEND_RESPONSE): write_any_response, - SEND_BODY: { - "chunked": ChunkedWriter, - "content-length": ContentLengthWriter, - "http/1.0": Http10Writer, - }, -} diff --git a/spaces/lcw777789564/panzuowenji/README.md b/spaces/lcw777789564/panzuowenji/README.md deleted file mode 100644 index 6c8a3e3d2f305762c8a8735232c38a19a0731bb5..0000000000000000000000000000000000000000 --- a/spaces/lcw777789564/panzuowenji/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Panzuowenji -emoji: 📊 -colorFrom: indigo -colorTo: red -sdk: docker -pinned: false -license: mit -app_port: 8080 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/leogabraneth/text-generation-webui-main/modules/grammar.py b/spaces/leogabraneth/text-generation-webui-main/modules/grammar.py deleted file mode 100644 index 5f6ad3a637d85bc31eecb141c149d562e53a90c2..0000000000000000000000000000000000000000 --- a/spaces/leogabraneth/text-generation-webui-main/modules/grammar.py +++ /dev/null @@ -1,33 +0,0 @@ -from torch_grammar import GrammarSampler -from transformers.generation.logits_process import LogitsProcessor - -from modules import shared - -sampler = None -grammar = None -grammar_string = '' - - -class GrammarLogitsProcessor(LogitsProcessor): - def __init__(self, string): - - global sampler, grammar, grammar_string - - if string != grammar_string: - grammar_string = string - if string.strip() != '': - string = string.strip() + '\n' - sampler = GrammarSampler(string, 'root', shared.tokenizer) - else: - sampler = None - - if sampler is not None: - grammar = sampler.logits_processor() - else: - grammar = None - - def __call__(self, input_ids, scores): - if grammar is not None: - scores = grammar(input_ids, scores) - - return scores diff --git a/spaces/lgabrielb/fruit_classifier/app.py b/spaces/lgabrielb/fruit_classifier/app.py deleted file mode 100644 index 3dcac7e96a46199b0dd185d7340289de0e8f07b4..0000000000000000000000000000000000000000 --- a/spaces/lgabrielb/fruit_classifier/app.py +++ /dev/null @@ -1,21 +0,0 @@ -import gradio as gr -from fastai.vision.all import * - -learn = load_learner('export.pkl') -labels = learn.dls.vocab - -def classify_image(img): - pred,idx,probs = learn.predict(img) - return {labels[i]: float(probs[i]) for i in range(len(labels))} - -title = "Fruit Classifier" -examples = ['banana.jpg', 'jabuticaba.jpeg', 'laranja.jpg', 'maca.jpg', 'melancia.jpeg'] - -iface = gr.Interface( - fn=classify_image, - inputs=gr.inputs.Image(shape=(512, 512)), - outputs=gr.outputs.Label(num_top_classes=3), - title=title, - examples=examples, - ) -iface.launch(inline=False) \ No newline at end of file diff --git a/spaces/lincquiQcaudo/Top-20-Diffusion/Hydrus 2d 3d Crack In 14 !EXCLUSIVE!.md b/spaces/lincquiQcaudo/Top-20-Diffusion/Hydrus 2d 3d Crack In 14 !EXCLUSIVE!.md deleted file mode 100644 index aa73177e0437edbf15d709d5ef8b0e01e42a5cd5..0000000000000000000000000000000000000000 --- a/spaces/lincquiQcaudo/Top-20-Diffusion/Hydrus 2d 3d Crack In 14 !EXCLUSIVE!.md +++ /dev/null @@ -1,9 +0,0 @@ - -

                hydrus 2d / 3d pro crack is the fantastic software that helps to analyze the flow and transport of water and solute in the saturated media. this software can be used for the geological and hydrological analysis. it is fully compatible with all the important operating systems such as windows, linux and mac osx. this software is based on the richards equation and convection-dispersion equation. this software is used to analyze the flow and transport of water and solute in the saturated media. you can also try hydrus crack.

                -

                Hydrus 2d 3d Crack In 14


                Download Zip >>> https://bytlly.com/2uGxfP



                -

                hydrus 2d / 3d crack is an easy to use and user-friendly software which can be used for geological and hydrological analysis. it is developed based on the richards equation and convection-dispersion equation. it provides an interactive user interface to design the flow domains, manage the nodes, and to analyze the sensitivity of the model parameters. you can also try hydrus crack.

                -

                hydrus 2d / 3d crack is the software which is used to analyze the flow and heat transfer. it is developed based on the richards equation and convection-dispersion equation. this software provides an interactive user interface to design the flow domains, manage the nodes, and to analyze the sensitivity of the model parameters.

                -

                hydrus-2d allows the simulation of two-dimensional flow systems using a mesh-based model, and many of the features of hydrus 2d are the same as those of hydrus 3d.. in hydrus-2d, hydrus-2d combines two- and three-dimensional hydrological modeling in a single model. the hydrus-2d model includes more than 90 pre-defined surface water bodies and more than 70 pre-defined subsurface. hydrus-2d can solve a wide range of two-dimensional flow processes, including such systems as well as hydrogeological, hydrologic,. 3d hydrus, hydrus 3d, 3d hydrus, hydrus 3d, hydrus-2d, hydrus-2d, hydrus model, model hydrus, model hydrus-2d, model hydrus-2d, hydrus model, model hydrus, model hydrus-2d, model hydrus-2d,. for further information, go to hydrus-2d, hydrus 3d, hydrus model, hydrus model hydrus-2d, model hydrus-2d, model hydrus-2d. hydrus 2d 3d crack in 14 hydrus 2d 3d crack in 14. hydrus 2d 3d crack in 14 hydrus 2d 3d crack in 14 hydrus 2d 3d crack in 14

                this is a game demo of hydrus, available for pc (windows 10/8/7/vista/xp) and mac os x. hydrus-3d, hydrus 3d, hydrus-3d, hydrus model, model hydrus, model hydrus-2d, model hydrus-2d, hydrus model, model hydrus, model hydrus-2d, model hydrus-2d. this demo shows a simple two-dimensional layout of a complex subsurface-flow wetland system, such as a constructed wetland. modeling of subsurface flow and transport of liquid and solid materials within the wetlands is provided by hydrus. the hydrus model combines two- and three-dimensional hydrological modeling in a single model. the hydrus-3d model includes more than 90 pre-defined surface water bodies and more than 70 pre-defined subsurface.

                -

                899543212b
                -
                -
                \ No newline at end of file diff --git a/spaces/lincquiQcaudo/Top-20-Diffusion/Little Big Planet 3 Pc Download Free Full.md b/spaces/lincquiQcaudo/Top-20-Diffusion/Little Big Planet 3 Pc Download Free Full.md deleted file mode 100644 index 0304f75da1ea35db2e5d246d980e6096c36c3f1c..0000000000000000000000000000000000000000 --- a/spaces/lincquiQcaudo/Top-20-Diffusion/Little Big Planet 3 Pc Download Free Full.md +++ /dev/null @@ -1,96 +0,0 @@ -
                -

                Little Big Planet 3 PC Download Free Full

                - -

                If you are a fan of creative and colorful platform games, you might be interested in Little Big Planet 3, the third installment of the popular series that features Sackboy and his new friends. This game was originally released for PlayStation 3 and PlayStation 4 in 2014, but did you know that you can also play it on your PC? In this article, we will show you how to download and play Little Big Planet 3 on your PC for free, using an emulator called RPCS3. You will also learn more about the game and its features, as well as some tips and tricks to enjoy it better.

                - -

                What is Little Big Planet 3?

                - -

                Little Big Planet 3 is a puzzle-platformer game that combines elements of a sandbox game. It is developed by Sumo Digital, with the help of XDev and Media Molecule, the original creators of the series. The game follows the adventures of Sackboy, a cute and customizable character made of fabric, who travels to a planet called Bunkum to stop an evil force called the Titans from destroying creativity.

                -

                little big planet 3 pc download free full


                Download - https://bytlly.com/2uGych



                - -

                The game has two main modes: Adventure and Create. In Adventure mode, you can play through the story levels, which are divided into four themes: Prologue, Manglewood, The Ziggurat, and Bunkum Lagoon. Each theme has its own hub world, where you can explore and find secrets, collectibles, and side missions. You can also play online with other players or join community levels created by other users.

                - -

                In Create mode, you can unleash your imagination and create your own levels, characters, objects, power-ups, stickers, vehicles, and more. You can use a variety of tools and materials to design your own world and share it with other players online. You can also play levels created by other users and rate them.

                - -

                The game introduces three new playable characters besides Sackboy: OddSock, Toggle, and Swoop. Each character has its own unique abilities and personality. OddSock is a dog-like character who can run fast and wall-jump. Toggle is a big and heavy character who can switch to a small and light version. Swoop is a bird-like character who can fly and carry objects or other characters. You can switch between these characters during gameplay or play as them in co-op mode with up to four players.

                - -

                How to Download Little Big Planet 3 for PC

                - -

                To download Little Big Planet 3 for PC, you will need an emulator called RPCS3. This is a software that allows you to run PlayStation 3 games on your PC. It is still in development, so it may not work perfectly for all games, but it has made great progress in recent years and it can run Little Big Planet 3 with good performance and graphics.

                - -

                Here are the steps to download and play Little Big Planet 3 on your PC:

                - -
                  -
                1. Download RPCS3 from its official website: https://rpcs3.net/. You will need a 64-bit Windows system with at least 4 GB of RAM and a compatible graphics card.
                2. -
                3. Extract the RPCS3 folder to a location of your choice on your PC.
                4. -
                5. Download the PlayStation 3 firmware from this link: https://www.playstation.com/en-us/support/hardware/ps3/system-software/. You will need this to run RPCS3.
                6. -
                7. Copy the firmware file (PS3UPDAT.PUP) to the \dev_hdd0\ folder inside the RPCS3 folder.
                8. -
                9. Run rpcs3.exe as administrator. You will see a window asking you to install the firmware. Click on "Yes" and wait for it to finish.
                10. -
                11. Download Little Big Planet 3 from this link: https://www.gamesknit.com/littlebigplanet-3-version-for-pc/. You will need a torrent client such as uTorrent or BitTorrent to download it.
                12. -
                13. Open the torrent file with your torrent client and wait for the download to finish. It may take some time depending on your internet speed and the number of seeders.
                14. -
                15. Once the download is complete, go to the folder where you saved the game files. You will see a folder called "LittleBigPlanet 3". Open it and run setup.exe.
                16. -
                17. Follow the installation instructions. Choose a destination folder for the game and agree to the terms and conditions.
                18. -
                19. When the installation is done, do not launch the game yet. You need to apply a crack to make it work on RPCS3.
                20. -
                21. Go back to the folder where you downloaded the game files. You will see another folder called "Crack". Open it and copy all the files inside.
                22. -
                23. Paste them into the folder where you installed the game. Replace any existing files if prompted.
                24. -
                25. Launch RPCS3 again. Click on "File" and then "Add Games". Browse to the folder where you installed the game and select it.
                26. -
                27. You will see Little Big Planet 3 appear on your game list on RPCS3. Right-click on it and select "Configure".
                28. -
                29. You will see a window with various settings for the game. You can tweak them according to your preferences and system specifications, but here are some recommended settings:
                30. -
                    -
                  • CPU: Enable SPU loop detection, SPU cache, Accurate xfloat, SPU block size = Safe.
                  • -
                  • GPU: Renderer = Vulkan, Resolution scale = Native (or higher if your PC can handle it), Anisotropic filter = Auto.
                  • -
                  • Audio: Audio backend = XAudio2 (or OpenAL if you have problems), Enable buffering, Buffering duration = 100ms.
                  • -
                  • I/O: Keyboard handler = Basic (or Null if you use a controller), Mouse handler = Basic (or Null if you use a controller), Camera input = Null (or Basic if you use PlayStation Eye), Move handler = Null (or Basic if you use PlayStation Move).
                  • -
                  -
                31. Click on "Save" to apply the settings.
                32. -
                33. You are now ready to play Little Big Planet 3 on your PC. Double-click on the game icon on RPCS3 and enjoy!
                34. -
                - -

                Tips and Tricks for Little Big Planet 3

                - -

                Little Big Planet 3 is a game that requires creativity, exploration, cooperation, and skill. Here are some tips and tricks that can help you have more fun and success in this game:

                - -
                  -
                • In Adventure mode, try to collect as many items as possible. They will help you customize your character, create your own levels, or unlock new features.
                • -
                • In Adventure mode, look for hidden areas and secrets. They may contain bonus items or challenges that can reward you with more items or trophies.
                • -
                • In Adventure mode, experiment with different characters and their abilities. They may help you solve puzzles or access new areas that Sackboy alone cannot reach.
                • -
                • In Create mode, use tutorials and guides to learn how to use the tools and materials effectively. You can also watch videos or play levels created by other users to get inspiration or tips.
                • -
                • In Create mode, test your levels before publishing them online. Make sure they are fun, balanced, original, and bug-free.
                • -
                • In Create mode, share your levels online and get feedback from other users. You can also play levels created by other users and rate them or leave comments.
                • -
                • In Online mode, communicate with other players using voice chat or text chat. You can also use gestures or stickers to express yourself or interact with others.
                • -
                • In Online mode, cooperate with other players or compete against them in various modes and challenges. You can also join or create communities based on your interests or preferences.
                • -
                - -

                Conclusion

                - -

                Little Big Planet 3 is a wonderful game that offers endless possibilities for creativity and fun. You can play it on your PC for free using an emulator called RPCS3. We hope this article helped you download and play this game on your PC without any problems. If you have any questions or suggestions, feel free to leave them in the comments section below. Happy gaming!

                -

                What are the Benefits of Playing Little Big Planet 3 on PC?

                - -

                Playing Little Big Planet 3 on PC has some advantages over playing it on PlayStation 3 or PlayStation 4. Here are some of them:

                -

                - -
                  -
                • You can play it for free. You don't need to buy the game or pay for a subscription to play online. You just need to download the emulator and the game files and follow the instructions in this article.
                • -
                • You can play it with better graphics and performance. You can adjust the settings of the emulator and the game to suit your PC specifications and preferences. You can also use higher resolution, anti-aliasing, anisotropic filtering, and other enhancements to improve the visual quality of the game.
                • -
                • You can play it with more options and features. You can use a keyboard and mouse, a controller, or any other input device that is compatible with your PC. You can also use mods, cheats, trainers, or other tools to customize or modify the game to your liking.
                • -
                • You can play it with a larger and more active community. You can join or create online games with other players who use RPCS3 or other emulators. You can also access more levels, characters, objects, and other creations made by other users online.
                • -
                - -

                What are the Drawbacks of Playing Little Big Planet 3 on PC?

                - -

                Playing Little Big Planet 3 on PC also has some disadvantages that you should be aware of. Here are some of them:

                - -
                  -
                • You may encounter some bugs or glitches. The game and the emulator are not perfect and may have some errors or issues that can affect your gameplay experience. For example, you may experience crashes, freezes, slowdowns, audio problems, graphical glitches, or missing features.
                • -
                • You may need a powerful PC. The game and the emulator require a lot of resources to run smoothly and without problems. You may need a high-end CPU, GPU, RAM, and SSD to play the game at its best quality and performance.
                • -
                • You may face some legal or ethical issues. The game and the emulator are not officially supported or endorsed by Sony or Sumo Digital. You may be violating some copyrights or terms of service by downloading and playing the game on your PC. You may also be depriving the developers of their deserved income by not buying their product.
                • -
                - -

                Conclusion

                - -

                Little Big Planet 3 is a wonderful game that offers endless possibilities for creativity and fun. You can play it on your PC for free using an emulator called RPCS3. We hope this article helped you download and play this game on your PC without any problems. If you have any questions or suggestions, feel free to leave them in the comments section below. Happy gaming!

                -

                Conclusion

                - -

                Little Big Planet 3 is a wonderful game that offers endless possibilities for creativity and fun. You can play it on your PC for free using an emulator called RPCS3. We hope this article helped you download and play this game on your PC without any problems. If you have any questions or suggestions, feel free to leave them in the comments section below. Happy gaming!

                3cee63e6c2
                -
                -
                \ No newline at end of file diff --git a/spaces/lj1995/vocal2guitar/uvr5_pack/lib_v5/nets_537238KB.py b/spaces/lj1995/vocal2guitar/uvr5_pack/lib_v5/nets_537238KB.py deleted file mode 100644 index 1ceac4a470ca311d594818d52e5f96919cfddb26..0000000000000000000000000000000000000000 --- a/spaces/lj1995/vocal2guitar/uvr5_pack/lib_v5/nets_537238KB.py +++ /dev/null @@ -1,123 +0,0 @@ -import torch -import numpy as np -from torch import nn -import torch.nn.functional as F - -from uvr5_pack.lib_v5 import layers_537238KB as layers - - -class BaseASPPNet(nn.Module): - def __init__(self, nin, ch, dilations=(4, 8, 16)): - super(BaseASPPNet, self).__init__() - self.enc1 = layers.Encoder(nin, ch, 3, 2, 1) - self.enc2 = layers.Encoder(ch, ch * 2, 3, 2, 1) - self.enc3 = layers.Encoder(ch * 2, ch * 4, 3, 2, 1) - self.enc4 = layers.Encoder(ch * 4, ch * 8, 3, 2, 1) - - self.aspp = layers.ASPPModule(ch * 8, ch * 16, dilations) - - self.dec4 = layers.Decoder(ch * (8 + 16), ch * 8, 3, 1, 1) - self.dec3 = layers.Decoder(ch * (4 + 8), ch * 4, 3, 1, 1) - self.dec2 = layers.Decoder(ch * (2 + 4), ch * 2, 3, 1, 1) - self.dec1 = layers.Decoder(ch * (1 + 2), ch, 3, 1, 1) - - def __call__(self, x): - h, e1 = self.enc1(x) - h, e2 = self.enc2(h) - h, e3 = self.enc3(h) - h, e4 = self.enc4(h) - - h = self.aspp(h) - - h = self.dec4(h, e4) - h = self.dec3(h, e3) - h = self.dec2(h, e2) - h = self.dec1(h, e1) - - return h - - -class CascadedASPPNet(nn.Module): - def __init__(self, n_fft): - super(CascadedASPPNet, self).__init__() - self.stg1_low_band_net = BaseASPPNet(2, 64) - self.stg1_high_band_net = BaseASPPNet(2, 64) - - self.stg2_bridge = layers.Conv2DBNActiv(66, 32, 1, 1, 0) - self.stg2_full_band_net = BaseASPPNet(32, 64) - - self.stg3_bridge = layers.Conv2DBNActiv(130, 64, 1, 1, 0) - self.stg3_full_band_net = BaseASPPNet(64, 128) - - self.out = nn.Conv2d(128, 2, 1, bias=False) - self.aux1_out = nn.Conv2d(64, 2, 1, bias=False) - self.aux2_out = nn.Conv2d(64, 2, 1, bias=False) - - self.max_bin = n_fft // 2 - self.output_bin = n_fft // 2 + 1 - - self.offset = 128 - - def forward(self, x, aggressiveness=None): - mix = x.detach() - x = x.clone() - - x = x[:, :, : self.max_bin] - - bandw = x.size()[2] // 2 - aux1 = torch.cat( - [ - self.stg1_low_band_net(x[:, :, :bandw]), - self.stg1_high_band_net(x[:, :, bandw:]), - ], - dim=2, - ) - - h = torch.cat([x, aux1], dim=1) - aux2 = self.stg2_full_band_net(self.stg2_bridge(h)) - - h = torch.cat([x, aux1, aux2], dim=1) - h = self.stg3_full_band_net(self.stg3_bridge(h)) - - mask = torch.sigmoid(self.out(h)) - mask = F.pad( - input=mask, - pad=(0, 0, 0, self.output_bin - mask.size()[2]), - mode="replicate", - ) - - if self.training: - aux1 = torch.sigmoid(self.aux1_out(aux1)) - aux1 = F.pad( - input=aux1, - pad=(0, 0, 0, self.output_bin - aux1.size()[2]), - mode="replicate", - ) - aux2 = torch.sigmoid(self.aux2_out(aux2)) - aux2 = F.pad( - input=aux2, - pad=(0, 0, 0, self.output_bin - aux2.size()[2]), - mode="replicate", - ) - return mask * mix, aux1 * mix, aux2 * mix - else: - if aggressiveness: - mask[:, :, : aggressiveness["split_bin"]] = torch.pow( - mask[:, :, : aggressiveness["split_bin"]], - 1 + aggressiveness["value"] / 3, - ) - mask[:, :, aggressiveness["split_bin"] :] = torch.pow( - mask[:, :, aggressiveness["split_bin"] :], - 1 + aggressiveness["value"], - ) - - return mask * mix - - def predict(self, x_mag, aggressiveness=None): - h = self.forward(x_mag, aggressiveness) - - if self.offset > 0: - h = h[:, :, :, self.offset : -self.offset] - assert h.size()[3] > 0 - - return h diff --git a/spaces/lllqqq/so-vits-svc-models-pcr/modules/F0Predictor/crepe.py b/spaces/lllqqq/so-vits-svc-models-pcr/modules/F0Predictor/crepe.py deleted file mode 100644 index c6fb45c79bcd306202a2c0282b3d73a8074ced5d..0000000000000000000000000000000000000000 --- a/spaces/lllqqq/so-vits-svc-models-pcr/modules/F0Predictor/crepe.py +++ /dev/null @@ -1,340 +0,0 @@ -from typing import Optional,Union -try: - from typing import Literal -except Exception as e: - from typing_extensions import Literal -import numpy as np -import torch -import torchcrepe -from torch import nn -from torch.nn import functional as F -import scipy - -#from:https://github.com/fishaudio/fish-diffusion - -def repeat_expand( - content: Union[torch.Tensor, np.ndarray], target_len: int, mode: str = "nearest" -): - """Repeat content to target length. - This is a wrapper of torch.nn.functional.interpolate. - - Args: - content (torch.Tensor): tensor - target_len (int): target length - mode (str, optional): interpolation mode. Defaults to "nearest". - - Returns: - torch.Tensor: tensor - """ - - ndim = content.ndim - - if content.ndim == 1: - content = content[None, None] - elif content.ndim == 2: - content = content[None] - - assert content.ndim == 3 - - is_np = isinstance(content, np.ndarray) - if is_np: - content = torch.from_numpy(content) - - results = torch.nn.functional.interpolate(content, size=target_len, mode=mode) - - if is_np: - results = results.numpy() - - if ndim == 1: - return results[0, 0] - elif ndim == 2: - return results[0] - - -class BasePitchExtractor: - def __init__( - self, - hop_length: int = 512, - f0_min: float = 50.0, - f0_max: float = 1100.0, - keep_zeros: bool = True, - ): - """Base pitch extractor. - - Args: - hop_length (int, optional): Hop length. Defaults to 512. - f0_min (float, optional): Minimum f0. Defaults to 50.0. - f0_max (float, optional): Maximum f0. Defaults to 1100.0. - keep_zeros (bool, optional): Whether keep zeros in pitch. Defaults to True. - """ - - self.hop_length = hop_length - self.f0_min = f0_min - self.f0_max = f0_max - self.keep_zeros = keep_zeros - - def __call__(self, x, sampling_rate=44100, pad_to=None): - raise NotImplementedError("BasePitchExtractor is not callable.") - - def post_process(self, x, sampling_rate, f0, pad_to): - if isinstance(f0, np.ndarray): - f0 = torch.from_numpy(f0).float().to(x.device) - - if pad_to is None: - return f0 - - f0 = repeat_expand(f0, pad_to) - - if self.keep_zeros: - return f0 - - vuv_vector = torch.zeros_like(f0) - vuv_vector[f0 > 0.0] = 1.0 - vuv_vector[f0 <= 0.0] = 0.0 - - # 去掉0频率, 并线性插值 - nzindex = torch.nonzero(f0).squeeze() - f0 = torch.index_select(f0, dim=0, index=nzindex).cpu().numpy() - time_org = self.hop_length / sampling_rate * nzindex.cpu().numpy() - time_frame = np.arange(pad_to) * self.hop_length / sampling_rate - - if f0.shape[0] <= 0: - return torch.zeros(pad_to, dtype=torch.float, device=x.device),torch.zeros(pad_to, dtype=torch.float, device=x.device) - - if f0.shape[0] == 1: - return torch.ones(pad_to, dtype=torch.float, device=x.device) * f0[0],torch.ones(pad_to, dtype=torch.float, device=x.device) - - # 大概可以用 torch 重写? - f0 = np.interp(time_frame, time_org, f0, left=f0[0], right=f0[-1]) - vuv_vector = vuv_vector.cpu().numpy() - vuv_vector = np.ceil(scipy.ndimage.zoom(vuv_vector,pad_to/len(vuv_vector),order = 0)) - - return f0,vuv_vector - - -class MaskedAvgPool1d(nn.Module): - def __init__( - self, kernel_size: int, stride: Optional[int] = None, padding: Optional[int] = 0 - ): - """An implementation of mean pooling that supports masked values. - - Args: - kernel_size (int): The size of the median pooling window. - stride (int, optional): The stride of the median pooling window. Defaults to None. - padding (int, optional): The padding of the median pooling window. Defaults to 0. - """ - - super(MaskedAvgPool1d, self).__init__() - self.kernel_size = kernel_size - self.stride = stride or kernel_size - self.padding = padding - - def forward(self, x, mask=None): - ndim = x.dim() - if ndim == 2: - x = x.unsqueeze(1) - - assert ( - x.dim() == 3 - ), "Input tensor must have 2 or 3 dimensions (batch_size, channels, width)" - - # Apply the mask by setting masked elements to zero, or make NaNs zero - if mask is None: - mask = ~torch.isnan(x) - - # Ensure mask has the same shape as the input tensor - assert x.shape == mask.shape, "Input tensor and mask must have the same shape" - - masked_x = torch.where(mask, x, torch.zeros_like(x)) - # Create a ones kernel with the same number of channels as the input tensor - ones_kernel = torch.ones(x.size(1), 1, self.kernel_size, device=x.device) - - # Perform sum pooling - sum_pooled = nn.functional.conv1d( - masked_x, - ones_kernel, - stride=self.stride, - padding=self.padding, - groups=x.size(1), - ) - - # Count the non-masked (valid) elements in each pooling window - valid_count = nn.functional.conv1d( - mask.float(), - ones_kernel, - stride=self.stride, - padding=self.padding, - groups=x.size(1), - ) - valid_count = valid_count.clamp(min=1) # Avoid division by zero - - # Perform masked average pooling - avg_pooled = sum_pooled / valid_count - - # Fill zero values with NaNs - avg_pooled[avg_pooled == 0] = float("nan") - - if ndim == 2: - return avg_pooled.squeeze(1) - - return avg_pooled - - -class MaskedMedianPool1d(nn.Module): - def __init__( - self, kernel_size: int, stride: Optional[int] = None, padding: Optional[int] = 0 - ): - """An implementation of median pooling that supports masked values. - - This implementation is inspired by the median pooling implementation in - https://gist.github.com/rwightman/f2d3849281624be7c0f11c85c87c1598 - - Args: - kernel_size (int): The size of the median pooling window. - stride (int, optional): The stride of the median pooling window. Defaults to None. - padding (int, optional): The padding of the median pooling window. Defaults to 0. - """ - - super(MaskedMedianPool1d, self).__init__() - self.kernel_size = kernel_size - self.stride = stride or kernel_size - self.padding = padding - - def forward(self, x, mask=None): - ndim = x.dim() - if ndim == 2: - x = x.unsqueeze(1) - - assert ( - x.dim() == 3 - ), "Input tensor must have 2 or 3 dimensions (batch_size, channels, width)" - - if mask is None: - mask = ~torch.isnan(x) - - assert x.shape == mask.shape, "Input tensor and mask must have the same shape" - - masked_x = torch.where(mask, x, torch.zeros_like(x)) - - x = F.pad(masked_x, (self.padding, self.padding), mode="reflect") - mask = F.pad( - mask.float(), (self.padding, self.padding), mode="constant", value=0 - ) - - x = x.unfold(2, self.kernel_size, self.stride) - mask = mask.unfold(2, self.kernel_size, self.stride) - - x = x.contiguous().view(x.size()[:3] + (-1,)) - mask = mask.contiguous().view(mask.size()[:3] + (-1,)).to(x.device) - - # Combine the mask with the input tensor - #x_masked = torch.where(mask.bool(), x, torch.fill_(torch.zeros_like(x),float("inf"))) - x_masked = torch.where(mask.bool(), x, torch.FloatTensor([float("inf")]).to(x.device)) - - # Sort the masked tensor along the last dimension - x_sorted, _ = torch.sort(x_masked, dim=-1) - - # Compute the count of non-masked (valid) values - valid_count = mask.sum(dim=-1) - - # Calculate the index of the median value for each pooling window - median_idx = (torch.div((valid_count - 1), 2, rounding_mode='trunc')).clamp(min=0) - - # Gather the median values using the calculated indices - median_pooled = x_sorted.gather(-1, median_idx.unsqueeze(-1).long()).squeeze(-1) - - # Fill infinite values with NaNs - median_pooled[torch.isinf(median_pooled)] = float("nan") - - if ndim == 2: - return median_pooled.squeeze(1) - - return median_pooled - - -class CrepePitchExtractor(BasePitchExtractor): - def __init__( - self, - hop_length: int = 512, - f0_min: float = 50.0, - f0_max: float = 1100.0, - threshold: float = 0.05, - keep_zeros: bool = False, - device = None, - model: Literal["full", "tiny"] = "full", - use_fast_filters: bool = True, - decoder="viterbi" - ): - super().__init__(hop_length, f0_min, f0_max, keep_zeros) - if decoder == "viterbi": - self.decoder = torchcrepe.decode.viterbi - elif decoder == "argmax": - self.decoder = torchcrepe.decode.argmax - elif decoder == "weighted_argmax": - self.decoder = torchcrepe.decode.weighted_argmax - else: - raise "Unknown decoder" - self.threshold = threshold - self.model = model - self.use_fast_filters = use_fast_filters - self.hop_length = hop_length - if device is None: - self.dev = torch.device("cuda" if torch.cuda.is_available() else "cpu") - else: - self.dev = torch.device(device) - if self.use_fast_filters: - self.median_filter = MaskedMedianPool1d(3, 1, 1).to(device) - self.mean_filter = MaskedAvgPool1d(3, 1, 1).to(device) - - def __call__(self, x, sampling_rate=44100, pad_to=None): - """Extract pitch using crepe. - - - Args: - x (torch.Tensor): Audio signal, shape (1, T). - sampling_rate (int, optional): Sampling rate. Defaults to 44100. - pad_to (int, optional): Pad to length. Defaults to None. - - Returns: - torch.Tensor: Pitch, shape (T // hop_length,). - """ - - assert x.ndim == 2, f"Expected 2D tensor, got {x.ndim}D tensor." - assert x.shape[0] == 1, f"Expected 1 channel, got {x.shape[0]} channels." - - x = x.to(self.dev) - f0, pd = torchcrepe.predict( - x, - sampling_rate, - self.hop_length, - self.f0_min, - self.f0_max, - pad=True, - model=self.model, - batch_size=1024, - device=x.device, - return_periodicity=True, - decoder=self.decoder - ) - - # Filter, remove silence, set uv threshold, refer to the original warehouse readme - if self.use_fast_filters: - pd = self.median_filter(pd) - else: - pd = torchcrepe.filter.median(pd, 3) - - pd = torchcrepe.threshold.Silence(-60.0)(pd, x, sampling_rate, 512) - f0 = torchcrepe.threshold.At(self.threshold)(f0, pd) - - if self.use_fast_filters: - f0 = self.mean_filter(f0) - else: - f0 = torchcrepe.filter.mean(f0, 3) - - f0 = torch.where(torch.isnan(f0), torch.full_like(f0, 0), f0)[0] - - if torch.all(f0 == 0): - rtn = f0.cpu().numpy() if pad_to==None else np.zeros(pad_to) - return rtn,rtn - - return self.post_process(x, sampling_rate, f0, pad_to) diff --git a/spaces/luisoala/raw2logit/figures/figure2.sh b/spaces/luisoala/raw2logit/figures/figure2.sh deleted file mode 100644 index beefc0b306de0f3a3cf3d0bcc7fc59f03183e002..0000000000000000000000000000000000000000 --- a/spaces/luisoala/raw2logit/figures/figure2.sh +++ /dev/null @@ -1,4 +0,0 @@ -python figures.py \ ---experiment_name track-test \ ---run_name track-all \ ---output train_vs_val_loss \ diff --git a/spaces/magicr/BuboGPT/imagebind/models/multimodal_formers.py b/spaces/magicr/BuboGPT/imagebind/models/multimodal_formers.py deleted file mode 100644 index f571fac4f6b2d4b351086eb70352bbc473bad4fa..0000000000000000000000000000000000000000 --- a/spaces/magicr/BuboGPT/imagebind/models/multimodal_formers.py +++ /dev/null @@ -1,110 +0,0 @@ -import logging -import os - -import torch -from torch import nn, Tensor - -from bubogpt.common.dist_utils import download_cached_file -from bubogpt.common.utils import is_url -from bubogpt.models.Qformer import BertConfig, BertLMHeadModel - - -def disabled_train(self, mode=True): - """Overwrite model.train with this function to make sure train/eval mode - does not change anymore.""" - return self - - -class BaseQFormer(nn.Module): - def __init__(self, freeze_qformer=False): - super().__init__() - self.freeze_qformer = freeze_qformer - self.Qformer = None - - def check_and_freeze(self): - assert self.Qformer is not None - if self.freeze_qformer: - for name, param in self.Qformer.named_parameters(): - param.requires_grad = False - self.Qformer = self.Qformer.eval() - self.Qformer.train = disabled_train - self.query_tokens.requires_grad = False - logging.info("Freeze This QFormer") - - def load_from_pretrained(self, url_or_filename): - if is_url(url_or_filename): - cached_file = download_cached_file( - url_or_filename, check_hash=False, progress=True - ) - checkpoint = torch.load(cached_file, map_location="cpu") - elif os.path.isfile(url_or_filename): - checkpoint = torch.load(url_or_filename, map_location="cpu") - else: - raise RuntimeError("checkpoint url or path is invalid") - - state_dict = checkpoint["model"] - - msg = self.load_state_dict(state_dict, strict=False) - - logging.info("Missing keys {}".format(msg.missing_keys)) - logging.info("load checkpoint from %s" % url_or_filename) - - return msg - - -class SequenceGenericQFormer(BaseQFormer): - def __init__(self, - num_query_token: int, - encoder_width: int = 768, - freeze_qformer: bool = False, - q_former_model: str = "", - cross_attention_freq: int = 2 - ): - super().__init__(freeze_qformer) - self.Qformer, self.query_tokens = self.init_Qformer(num_query_token, encoder_width, cross_attention_freq) - if q_former_model != "": - self.load_Qformer(q_former_model) - self.check_and_freeze() - - def set_Qformer(self): - self.Qformer.cls = None - self.Qformer.bert.embeddings.word_embeddings = None - self.Qformer.bert.embeddings.position_embeddings = None - for layer in self.Qformer.bert.encoder.layer: - layer.output = None - layer.intermediate = None - - def load_Qformer(self, q_former_model): - self.Qformer.cls = None - self.Qformer.bert.embeddings.word_embeddings = None - self.Qformer.bert.embeddings.position_embeddings = None - for layer in self.Qformer.bert.encoder.layer: - layer.output = None - layer.intermediate = None - self.load_from_pretrained(url_or_filename=q_former_model) - - @classmethod - def init_Qformer(cls, num_query_token, encoder_width, cross_attention_freq=2): - encoder_config = BertConfig.from_pretrained("bert-base-uncased") - encoder_config.encoder_width = encoder_width - # insert cross-attention layer every other block - encoder_config.add_cross_attention = True - encoder_config.cross_attention_freq = cross_attention_freq - encoder_config.query_length = num_query_token - Qformer = BertLMHeadModel(config=encoder_config) - query_tokens = nn.Parameter( - torch.zeros(1, num_query_token, encoder_config.hidden_size) - ) - query_tokens.data.normal_(mean=0.0, std=encoder_config.initializer_range) - return Qformer, query_tokens - - def forward(self, input_embeds: Tensor) -> Tensor: - input_atts = torch.ones(input_embeds.size()[:-1], dtype=torch.long).to(input_embeds.device) - query_tokens = self.query_tokens.expand(input_embeds.shape[0], -1, -1) - query_output = self.Qformer.bert( - query_embeds=query_tokens, - encoder_hidden_states=input_embeds, - encoder_attention_mask=input_atts, - return_dict=True, - ) - return query_output.last_hidden_state diff --git a/spaces/manhkhanhUIT/BOPBTL/Global/options/train_options.py b/spaces/manhkhanhUIT/BOPBTL/Global/options/train_options.py deleted file mode 100644 index 6cc3296657043568a3a961d793f2c69f568bab1a..0000000000000000000000000000000000000000 --- a/spaces/manhkhanhUIT/BOPBTL/Global/options/train_options.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -from .base_options import BaseOptions - -class TrainOptions(BaseOptions): - def initialize(self): - BaseOptions.initialize(self) - # for displays - self.parser.add_argument('--display_freq', type=int, default=100, help='frequency of showing training results on screen') - self.parser.add_argument('--print_freq', type=int, default=100, help='frequency of showing training results on console') - self.parser.add_argument('--save_latest_freq', type=int, default=10000, help='frequency of saving the latest results') - self.parser.add_argument('--save_epoch_freq', type=int, default=1, help='frequency of saving checkpoints at the end of epochs') - self.parser.add_argument('--no_html', action='store_true', help='do not save intermediate training results to [opt.checkpoints_dir]/[opt.name]/web/') - self.parser.add_argument('--debug', action='store_true', help='only do one epoch and displays at each iteration') - - # for training - self.parser.add_argument('--continue_train', action='store_true', help='continue training: load the latest model') - # self.parser.add_argument('--load_pretrain', type=str, default='', help='load the pretrained model from the specified location') - self.parser.add_argument('--which_epoch', type=str, default='latest', help='which epoch to load? set to latest to use latest cached model') - self.parser.add_argument('--phase', type=str, default='train', help='train, val, test, etc') - self.parser.add_argument('--niter', type=int, default=100, help='# of iter at starting learning rate') - self.parser.add_argument('--niter_decay', type=int, default=100, help='# of iter to linearly decay learning rate to zero') - self.parser.add_argument('--beta1', type=float, default=0.5, help='momentum term of adam') - self.parser.add_argument('--lr', type=float, default=0.0002, help='initial learning rate for adam') - self.parser.add_argument('--training_dataset',type=str,default='',help='training use which dataset') - - # for discriminators - self.parser.add_argument('--num_D', type=int, default=2, help='number of discriminators to use') - self.parser.add_argument('--n_layers_D', type=int, default=3, help='only used if which_model_netD==n_layers') - self.parser.add_argument('--ndf', type=int, default=64, help='# of discrim filters in first conv layer') - self.parser.add_argument('--lambda_feat', type=float, default=10.0, help='weight for feature matching loss') - self.parser.add_argument('--l2_feat', type=float, help='weight for feature mapping loss') - self.parser.add_argument('--use_l1_feat', action='store_true', help='use l1 for feat mapping') - self.parser.add_argument('--no_ganFeat_loss', action='store_true', help='if specified, do *not* use discriminator feature matching loss') - self.parser.add_argument('--no_vgg_loss', action='store_true', help='if specified, do *not* use VGG feature matching loss') - self.parser.add_argument('--no_lsgan', action='store_true', help='do *not* use least square GAN, if false, use vanilla GAN') - self.parser.add_argument('--gan_type', type=str, default='lsgan', help='Choose the loss type of GAN') - self.parser.add_argument('--pool_size', type=int, default=0, help='the size of image buffer that stores previously generated images') - self.parser.add_argument('--norm_D',type=str, default='spectralinstance', help='instance normalization or batch normalization') - self.parser.add_argument('--init_D',type=str,default='xavier',help='normal|xavier|xavier_uniform|kaiming|orthogonal|none') - - self.parser.add_argument('--no_TTUR',action='store_true',help='No TTUR') - - self.parser.add_argument('--start_epoch',type=int,default=-1,help='write the start_epoch of iter.txt into this parameter') - self.parser.add_argument('--no_degradation',action='store_true',help='when train the mapping, enable this parameter --> no degradation will be added into clean image') - self.parser.add_argument('--no_load_VAE',action='store_true',help='when train the mapping, enable this parameter --> random initialize the encoder an decoder') - self.parser.add_argument('--use_v2_degradation',action='store_true',help='enable this parameter --> 4 kinds of degradations will be used to synthesize corruption') - self.parser.add_argument('--use_vae_which_epoch',type=str,default='200') - - - self.parser.add_argument('--use_focal_loss',action='store_true') - - self.parser.add_argument('--mask_need_scale',action='store_true',help='enable this param means that the pixel range of mask is 0-255') - self.parser.add_argument('--positive_weight',type=float,default=1.0,help='(For scratch detection) Since the scratch number is less, and we use a weight strategy. This parameter means that we want to decrease the weight.') - - self.parser.add_argument('--no_update_lr',action='store_true',help='use this means we do not update the LR while training') - - - self.isTrain = True diff --git a/spaces/marmg/zshot/streamlit_apps_config.py b/spaces/marmg/zshot/streamlit_apps_config.py deleted file mode 100644 index 91722e4d43eedd20ae5617c70fac321a6101cfdc..0000000000000000000000000000000000000000 --- a/spaces/marmg/zshot/streamlit_apps_config.py +++ /dev/null @@ -1,63 +0,0 @@ -#APP STYLE -MAX_WIDTH = 1600 -PADDING_TOP = 0.25 -PADDING_BOTTOM = 0.25 -PADDING_RIGHT = 4 -PADDING_LEFT = 4 -COLOR = 'black' -BACKGROUND_COLOR = 'white' - -HTML_WRAPPER = """
                {}
                """ -HTML_INDEX_WRAPPER = """
                {}
                """ - -STYLE_CONFIG_OLD = f""" - -""" - -with open('./style.css') as f: - STYLE_CONFIG_NEW = f.read() -STYLE_CONFIG = STYLE_CONFIG_OLD + ''.format(STYLE_CONFIG_NEW) diff --git a/spaces/matthoffner/open-codetree/components/Playground/index.tsx b/spaces/matthoffner/open-codetree/components/Playground/index.tsx deleted file mode 100644 index 7e1b541e39173b257f71174c6a421723d31821a7..0000000000000000000000000000000000000000 --- a/spaces/matthoffner/open-codetree/components/Playground/index.tsx +++ /dev/null @@ -1,259 +0,0 @@ -import React, { useRef, useEffect, useState, ChangeEvent, FormEvent } from "react"; -import { Message, useChat } from "ai/react"; -import { useAppDispatch, useAppSelector } from "../../store/hook"; -import { - compiler_state, - initEsbuild, -} from "../../store/features/compilerSlice"; -import { editor_state, set_monaco_input_value, update_editor_code } from "../../store/features/editorSlice"; -import { theme_state } from "../../store/features/themeSlice"; -import { ModalEnum, open_modal } from "../../store/features/modalSlice"; - -import ConsoleLog from "./ConsoleLog"; -import Iframe from "./Iframe"; -import InputCodeTab from "./InputCodeTab"; -import Footer from "./Footer"; -import Pane from "./Pane"; -import { SendIcon } from "../../constants/icon"; -import ReactMarkdown from "react-markdown"; -import { ChatRequestOptions } from "ai"; - -const DEFAULT_PROMPT = `You are assisting in a WASM-powered live editor, Codetree, where React code is instantly reflected in the browser. Generate React code with the following constraints: -1. Always import both React and ReactDOM. -2. All logic should be encapsulated within a single app component file. -3. External dependencies or imports outside of the React core are not permitted. -4. Always use inline styles for styling. -5. Code snippets should conclude with rendering to the DOM's root element: ReactDOM.render(, document.getElementById('root')); -6. Ensure the code is optimized for a live browser environment and adheres strictly to React best practices. - -Write the code with the above guidelines in mind.`; - -const Playground = () => { - const dispatch = useAppDispatch(); - const formRef = useRef(null); - const inputRef = useRef(null); - const { theme } = useAppSelector(theme_state); - const { esbuildStatus, isCompiling, output } = useAppSelector(compiler_state); - const { logs, editorValue, isLogTabOpen } = useAppSelector(editor_state); - const [markdownCode, setMarkdownCode] = useState(''); - const [prevMarkdownCode, setPrevMarkdownCode] = useState(markdownCode); - const [isSystemInputVisible, setSystemInputVisible] = useState(false); - const [isModelInputVisible, setModelInputVisible] = useState(false); - const [aiProvider, setAIProvider] = useState("openai"); - const [urlOption, setUrlOption] = useState(null); - const [isChatVisible, setIsChatVisible] = useState(true); - - const [systemMessage, setSystemMessage] = useState( - DEFAULT_PROMPT - ); - - const isValidCodeBlock = (markdownCode: string) => { - return markdownCode && markdownCode.length > 10 && markdownCode.includes('\n'); - } - - const modifiedHandleSubmit = async (e: FormEvent, chatRequestOptions?: ChatRequestOptions) => { - e.preventDefault(); - await handleSubmit(e, { - ...chatRequestOptions, - aiProvider, - } as any); - }; - - useEffect(() => { - const timer = setInterval(() => { - if (isValidCodeBlock(markdownCode) && markdownCode !== prevMarkdownCode) { - dispatch(update_editor_code({ type: 'javascript', content: markdownCode })); - setPrevMarkdownCode(markdownCode); - } - }, 2000); - - return () => { - clearInterval(timer); - }; - }, [markdownCode, prevMarkdownCode, dispatch]); - - const { append, messages, input, setInput, handleSubmit, ...rest } = useChat({ - body: { - systemMessage: systemMessage, - aiProvider: aiProvider, - url: urlOption - }, - onError: (error) => { - console.error(error); - }, - }); - - useEffect(() => { - if (!esbuildStatus.isReady) { - dispatch(initEsbuild()); - } - }, [dispatch, esbuildStatus]); - - useEffect(() => { - dispatch(open_modal(ModalEnum.TEMPLATE)); - }, [dispatch]); - - useEffect(() => { - if(isValidCodeBlock(markdownCode)) { - const newEditorValue = { - name: "React", - description: "By codetree", - public: true, - iconSrc: "/icons/reactjs.svg", - tabs: { - javascript: { - title: "JS/JSX", - entryPoints: "index.js", - monacoLanguage: "javascript", - data: markdownCode - }, - html: { - title: "index.html", - entryPoints: "index.html", - monacoLanguage: "html", - data: "" - }, - css: { - title: "main.css", - entryPoints: "main.css", - monacoLanguage: "css", - data: "" - } - } - }; - - dispatch(set_monaco_input_value(newEditorValue as any)); - } - }, [markdownCode, dispatch]); - - return ( -
                -
                -
                - System Prompt - - Model - - Chat - - - {isSystemInputVisible && ( -