diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..f6b1f326ca4ab7cf0c8798856f8fe0020ff82d58 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gradio/certificate.pem b/.gradio/certificate.pem new file mode 100644 index 0000000000000000000000000000000000000000..b85c8037f6b60976b2546fdbae88312c5246d9a3 --- /dev/null +++ b/.gradio/certificate.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- diff --git a/background.png b/background.png index d9832daa3e57ecd9dda672e4e358d3b567dcdcff..4d0953f767772492b832572182871df68d75360d 100644 Binary files a/background.png and b/background.png differ diff --git a/src/.github/workflows/python-publish.yml b/src/.github/workflows/python-publish.yml new file mode 100644 index 0000000000000000000000000000000000000000..bdaab28a48d6b2941815b3490922e36514ff4cd0 --- /dev/null +++ b/src/.github/workflows/python-publish.yml @@ -0,0 +1,39 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..70417323828bbf01b38aac89ace20bee0209f382 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,9 @@ +.eggs/ +dist/ +*.pyc +__pycache__/ +*.py[cod] +*$py.class +__tmp/* +*.pyi +node_modules \ No newline at end of file diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6bf7e8e898c4a3ac24894cdc4ecbfb0b6765bf1b --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,12 @@ +# FROM nikolaik/python-nodejs:python3.10-nodejs20-alpine +FROM node:20.5.0 + +WORKDIR /app + + +RUN apt-get update && \ + apt-get install -y python3-pip + +RUN rm /usr/lib/python3.11/EXTERNALLY-MANAGED + +RUN python3 -m pip install --no-cache-dir gradio==4.27 numpy \ No newline at end of file diff --git a/src/LICENSE b/src/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4e99bb556aeadeb02eee677a0e1fd685ec273d95 --- /dev/null +++ b/src/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Edgar Gracia + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2e9e12795c82802a341545284afd241a578d135b --- /dev/null +++ b/src/README.md @@ -0,0 +1,558 @@ + +# `gradio_image_annotation` +PyPI - Version + +A Gradio component that can be used to annotate images with bounding boxes. + +## Installation + +```bash +pip install gradio_image_annotation +``` + +## Usage + +```python +import gradio as gr +from gradio_image_annotation import image_annotator + + +example_annotation = { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "label": "Vehicle", + "color": (255, 0, 0) + }, + { + "xmin": 360, + "ymin": 615, + "xmax": 386, + "ymax": 702, + "label": "Person", + "color": (0, 255, 0) + } + ] +} + +examples_crop = [ + { + "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png", + "boxes": [ + { + "xmin": 30, + "ymin": 70, + "xmax": 530, + "ymax": 500, + "color": (100, 200, 255), + } + ], + }, + { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "color": (255, 0, 0), + }, + ], + }, +] + + +def crop(annotations): + if annotations["boxes"]: + box = annotations["boxes"][0] + return annotations["image"][ + box["ymin"]:box["ymax"], + box["xmin"]:box["xmax"] + ] + return None + + +def get_boxes_json(annotations): + return annotations["boxes"] + + +with gr.Blocks() as demo: + with gr.Tab("Object annotation", id="tab_object_annotation"): + annotator = image_annotator( + example_annotation, + label_list=["Person", "Vehicle"], + label_colors=[(0, 255, 0), (255, 0, 0)], + ) + button_get = gr.Button("Get bounding boxes") + json_boxes = gr.JSON() + button_get.click(get_boxes_json, annotator, json_boxes) + + with gr.Tab("Crop", id="tab_crop"): + with gr.Row(): + annotator_crop = image_annotator( + examples_crop[0], + image_type="numpy", + disable_edit_boxes=True, + single_box=True, + ) + image_crop = gr.Image() + button_crop = gr.Button("Crop") + button_crop.click(crop, annotator_crop, image_crop) + + gr.Examples(examples_crop, annotator_crop) + +if __name__ == "__main__": + demo.launch() + +``` + +## `image_annotator` + +### Initialization + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypedefaultdescription
value + +```python +dict | None +``` + +NoneA dict or None. The dictionary must contain a key 'image' with either an URL to an image, a numpy image or a PIL image. Optionally it may contain a key 'boxes' with a list of boxes. Each box must be a dict wit the keys: 'xmin', 'ymin', 'xmax' and 'ymax' with the absolute image coordinates of the box. Optionally can also include the keys 'label' and 'color' describing the label and color of the box. Color must be a tuple of RGB values (e.g. `(255,255,255)`).
boxes_alpha + +```python +float | None +``` + +NoneOpacity of the bounding boxes 0 and 1.
label_list + +```python +list[str] | None +``` + +NoneList of valid labels.
label_colors + +```python +list[str] | None +``` + +NoneOptional list of colors for each label when `label_list` is used. Colors must be a tuple of RGB values (e.g. `(255,255,255)`).
box_min_size + +```python +int | None +``` + +NoneMinimum valid bounding box size.
handle_size + +```python +int | None +``` + +NoneSize of the bounding box resize handles.
box_thickness + +```python +int | None +``` + +NoneThickness of the bounding box outline.
box_selected_thickness + +```python +int | None +``` + +NoneThickness of the bounding box outline when it is selected.
disable_edit_boxes + +```python +bool | None +``` + +NoneDisables the ability to set and edit the label and color of the boxes.
single_box + +```python +bool +``` + +FalseIf True, at most one box can be drawn.
height + +```python +int | str | None +``` + +NoneThe height of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.
width + +```python +int | str | None +``` + +NoneThe width of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.
image_mode + +```python +"1" + | "L" + | "P" + | "RGB" + | "RGBA" + | "CMYK" + | "YCbCr" + | "LAB" + | "HSV" + | "I" + | "F" +``` + +"RGB""RGB" if color, or "L" if black and white. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html for other supported image modes and their meaning.
sources + +```python +list["upload" | "webcam" | "clipboard"] | None +``` + +["upload", "webcam", "clipboard"]List of sources for the image. "upload" creates a box where user can drop an image file, "webcam" allows user to take snapshot from their webcam, "clipboard" allows users to paste an image from the clipboard. If None, defaults to ["upload", "webcam", "clipboard"].
image_type + +```python +"numpy" | "pil" | "filepath" +``` + +"numpy"The format the image is converted before being passed into the prediction function. "numpy" converts the image to a numpy array with shape (height, width, 3) and values from 0 to 255, "pil" converts the image to a PIL image object, "filepath" passes a str path to a temporary file containing the image. If the image is SVG, the `type` is ignored and the filepath of the SVG is returned.
label + +```python +str | None +``` + +NoneThe label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
container + +```python +bool +``` + +TrueIf True, will place the component in a container - providing some extra padding around the border.
scale + +```python +int | None +``` + +Nonerelative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
min_width + +```python +int +``` + +160minimum 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.
interactive + +```python +bool | None +``` + +Trueif True, will allow users to upload and annotate an image; if False, can only be used to display annotated images.
visible + +```python +bool +``` + +TrueIf False, component will be hidden.
elem_id + +```python +str | None +``` + +NoneAn optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
elem_classes + +```python +list[str] | str | None +``` + +NoneAn optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
render + +```python +bool +``` + +TrueIf False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
show_label + +```python +bool | None +``` + +Noneif True, will display label.
show_download_button + +```python +bool +``` + +TrueIf True, will show a button to download the image.
show_share_button + +```python +bool | None +``` + +NoneIf True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.
show_clear_button + +```python +bool | None +``` + +TrueIf True, will show a button to clear the current image.
show_remove_button + +```python +bool | None +``` + +NoneIf True, will show a button to remove the selected bounding box.
handles_cursor + +```python +bool | None +``` + +TrueIf True, the cursor will change when hovering over box handles in drag mode. Can be CPU-intensive.
+ + +### Events + +| name | description | +|:-----|:------------| +| `clear` | This listener is triggered when the user clears the image_annotator using the clear button for the component. | +| `change` | Triggered when the value of the image_annotator changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. | +| `upload` | This listener is triggered when the user uploads a file into the image_annotator. | + + + +### User function + +The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both). + +- When used as an Input, the component only impacts the input signature of the user function. +- When used as an output, the component only impacts the return signature of the user function. + +The code snippet below is accurate in cases where the component is used as both an input and an output. + +- **As output:** Is passed, a dict with the image and boxes or None. +- **As input:** Should return, a dict with an image and an optional list of boxes or None. + + ```python + def predict( + value: dict | None + ) -> dict | None: + return value + ``` + diff --git a/src/backend/gradio_image_annotation/__init__.py b/src/backend/gradio_image_annotation/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3cbcd45196953e7c96203b4eef1c2560e2525115 --- /dev/null +++ b/src/backend/gradio_image_annotation/__init__.py @@ -0,0 +1,4 @@ + +from .image_annotator import image_annotator + +__all__ = ['image_annotator'] diff --git a/src/backend/gradio_image_annotation/image_annotator.py b/src/backend/gradio_image_annotation/image_annotator.py new file mode 100644 index 0000000000000000000000000000000000000000..1002ac09460a041a70f49ad323e13fbcc7461158 --- /dev/null +++ b/src/backend/gradio_image_annotation/image_annotator.py @@ -0,0 +1,340 @@ +from __future__ import annotations + +import re +import warnings +from pathlib import Path +from typing import Any, List, Literal, cast + +import numpy as np +import PIL.Image +from PIL import ImageOps + +from gradio import image_utils, utils +from gradio.components.base import Component +from gradio.data_classes import FileData, GradioModel +from gradio.events import Events + +PIL.Image.init() # fixes https://github.com/gradio-app/gradio/issues/2843 + + +class AnnotatedImageData(GradioModel): + image: FileData + boxes: List[dict] = [] + + +def rgb2hex(r,g,b): + def clip(x): + return max(min(x, 255), 0) + return "#{:02x}{:02x}{:02x}".format(clip(r),clip(g),clip(b)) + + +class image_annotator(Component): + """ + Creates a component to annotate images with bounding boxes. The bounding boxes can be created and edited by the user or be passed by code. + It is also possible to predefine a set of valid classes and colors. + """ + + EVENTS = [ + Events.clear, + Events.change, + Events.upload, + ] + + data_model = AnnotatedImageData + + def __init__( + self, + value: dict | None = None, + *, + boxes_alpha: float | None = None, + label_list: list[str] | None = None, + label_colors: list[str] | None = None, + box_min_size: int | None = None, + handle_size: int | None = None, + box_thickness: int | None = None, + box_selected_thickness: int | None = None, + disable_edit_boxes: bool | None = None, + single_box: bool = False, + height: int | str | None = None, + width: int | str | None = None, + image_mode: Literal[ + "1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F" + ] = "RGB", + sources: list[Literal["upload", "webcam", "clipboard"]] | None = [ + "upload", + "webcam", + "clipboard", + ], + image_type: Literal["numpy", "pil", "filepath"] = "numpy", + label: str | None = None, + container: bool = True, + scale: int | None = None, + min_width: int = 160, + interactive: bool | None = True, + visible: bool = True, + elem_id: str | None = None, + elem_classes: list[str] | str | None = None, + render: bool = True, + show_label: bool | None = None, + show_download_button: bool = True, + show_share_button: bool | None = None, + show_clear_button: bool | None = True, + show_remove_button: bool | None = None, + handles_cursor: bool | None = True, + ): + """ + Parameters: + value: A dict or None. The dictionary must contain a key 'image' with either an URL to an image, a numpy image or a PIL image. Optionally it may contain a key 'boxes' with a list of boxes. Each box must be a dict wit the keys: 'xmin', 'ymin', 'xmax' and 'ymax' with the absolute image coordinates of the box. Optionally can also include the keys 'label' and 'color' describing the label and color of the box. Color must be a tuple of RGB values (e.g. `(255,255,255)`). + boxes_alpha: Opacity of the bounding boxes 0 and 1. + label_list: List of valid labels. + label_colors: Optional list of colors for each label when `label_list` is used. Colors must be a tuple of RGB values (e.g. `(255,255,255)`). + box_min_size: Minimum valid bounding box size. + handle_size: Size of the bounding box resize handles. + box_thickness: Thickness of the bounding box outline. + box_selected_thickness: Thickness of the bounding box outline when it is selected. + disable_edit_boxes: Disables the ability to set and edit the label and color of the boxes. + single_box: If True, at most one box can be drawn. + height: The height of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed. + width: The width of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed. + image_mode: "RGB" if color, or "L" if black and white. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html for other supported image modes and their meaning. + sources: List of sources for the image. "upload" creates a box where user can drop an image file, "webcam" allows user to take snapshot from their webcam, "clipboard" allows users to paste an image from the clipboard. If None, defaults to ["upload", "webcam", "clipboard"]. + image_type: The format the image is converted before being passed into the prediction function. "numpy" converts the image to a numpy array with shape (height, width, 3) and values from 0 to 255, "pil" converts the image to a PIL image object, "filepath" passes a str path to a temporary file containing the image. If the image is SVG, the `type` is ignored and the filepath of the SVG is returned. + label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to. + container: If True, will place the component in a container - providing some extra padding around the border. + scale: relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True. + 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. + interactive: if True, will allow users to upload and annotate an image; if False, can only be used to display annotated images. + visible: If False, component will be hidden. + 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. + render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later. + show_label: if True, will display label. + show_download_button: If True, will show a button to download the image. + show_share_button: If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise. + show_clear_button: If True, will show a button to clear the current image. + show_remove_button: If True, will show a button to remove the selected bounding box. + handles_cursor: If True, the cursor will change when hovering over box handles in drag mode. Can be CPU-intensive. + """ + + valid_types = ["numpy", "pil", "filepath"] + if image_type not in valid_types: + raise ValueError( + f"Invalid value for parameter `type`: {type}. Please choose from one of: {valid_types}" + ) + self.image_type = image_type + self.height = height + self.width = width + self.image_mode = image_mode + + self.sources = sources + valid_sources = ["upload", "clipboard", "webcam", None] + if isinstance(sources, str): + self.sources = [sources] + if self.sources is None: + self.sources = [] + if self.sources is not None: + for source in self.sources: + if source not in valid_sources: + raise ValueError( + f"`sources` must a list consisting of elements in {valid_sources}" + ) + + self.show_download_button = show_download_button + self.show_share_button = ( + (utils.get_space() is not None) + if show_share_button is None + else show_share_button + ) + self.show_clear_button = show_clear_button + self.show_remove_button = show_remove_button + self.handles_cursor = handles_cursor + + self.boxes_alpha = boxes_alpha + self.box_min_size = box_min_size + self.handle_size = handle_size + self.box_thickness = box_thickness + self.box_selected_thickness = box_selected_thickness + self.disable_edit_boxes = disable_edit_boxes + self.single_box = single_box + if label_list: + self.label_list = [(l, i) for i, l in enumerate(label_list)] + else: + self.label_list = None + + # Parse colors + self.label_colors = label_colors + if self.label_colors: + if (not isinstance(self.label_colors, list) + or self.label_list is None + or len(self.label_colors) != len(self.label_list)): + raise ValueError("``label_colors`` must be a list with the " + "same length as ``label_list``") + for i, color in enumerate(self.label_colors): + if isinstance(color, str): + if len(color) != 7 or color[0] != "#": + raise ValueError(f"Invalid color value {color}") + elif isinstance(color, (list, tuple)): + self.label_colors[i] = rgb2hex(*color) + + super().__init__( + label=label, + every=None, + show_label=show_label, + container=container, + scale=scale, + min_width=min_width, + interactive=interactive, + visible=visible, + elem_id=elem_id, + elem_classes=elem_classes, + render=render, + value=value, + ) + + def preprocess_image(self, image: FileData | None) -> str | None: + if image is None: + return None + file_path = Path(image.path) + if image.orig_name: + p = Path(image.orig_name) + name = p.stem + suffix = p.suffix.replace(".", "") + if suffix in ["jpg", "jpeg"]: + suffix = "jpeg" + else: + name = "image" + suffix = "png" + + if suffix.lower() == "svg": + return str(file_path) + + im = PIL.Image.open(file_path) + exif = im.getexif() + # 274 is the code for image rotation and 1 means "correct orientation" + if exif.get(274, 1) != 1 and hasattr(ImageOps, "exif_transpose"): + try: + im = ImageOps.exif_transpose(im) + except Exception: + warnings.warn( + f"Failed to transpose image {file_path} based on EXIF data." + ) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + im = im.convert(self.image_mode) + return image_utils.format_image( + im, + cast(Literal["numpy", "pil", "filepath"], self.image_type), + self.GRADIO_CACHE, + name=name, + format=suffix, + ) + + def preprocess_boxes(self, boxes: List[dict] | None) -> list: + parsed_boxes = [] + for box in boxes: + new_box = {} + new_box["label"] = box.get("label", "") + new_box["color"] = (0,0,0) + if "color" in box: + match = re.match(r'rgb\((\d+), (\d+), (\d+)\)', box["color"]) + if match: + new_box["color"] = tuple(int(match.group(i)) for i in range(1, 4)) + scale_factor = box.get("scaleFactor", 1) + new_box["xmin"] = round(box["xmin"] / scale_factor) + new_box["ymin"] = round(box["ymin"] / scale_factor) + new_box["xmax"] = round(box["xmax"] / scale_factor) + new_box["ymax"] = round(box["ymax"] / scale_factor) + parsed_boxes.append(new_box) + return parsed_boxes + + def preprocess(self, payload: AnnotatedImageData | None) -> dict | None: + """ + Parameters: + payload: an AnnotatedImageData object. + Returns: + A dict with the image and boxes or None. + """ + if payload is None: + return None + + ret_value = { + "image": self.preprocess_image(payload.image), + "boxes": self.preprocess_boxes(payload.boxes) + } + return ret_value + + def postprocess(self, value: dict | None) -> AnnotatedImageData | None: + """ + Parameters: + value: A dict with an image and an optional list of boxes or None. + Returns: + Returns an AnnotatedImageData object. + """ + # Check value + if value is None: + return None + if not isinstance(value, dict): + raise ValueError(f"``value`` must be a dict. Got {type(value)}") + + # Check and get boxes + boxes = value.setdefault("boxes", []) + if boxes: + if not isinstance(value["boxes"], (list, tuple)): + raise ValueError(f"'boxes' must be a list of dicts. Got " + f"{type(value['boxes'])}") + for box in value["boxes"]: + if (not isinstance(box, dict) + or not set(box.keys()).issubset({"label", "xmin", "ymin", "xmax", "ymax", "color"}) + or not set(box.keys()).issuperset({"xmin", "ymin", "xmax", "ymax"}) + ): + raise ValueError("Box must be a dict with the following " + "keys: 'xmin', 'ymin', 'xmax', 'ymax', " + f"['label', 'color']'. Got {box}") + + # Check and parse image + image = value.setdefault("image", None) + if image is not None: + if isinstance(image, str) and image.lower().endswith(".svg"): + image = FileData(path=image, orig_name=Path(image).name) + else: + saved = image_utils.save_image(image, self.GRADIO_CACHE) + orig_name = Path(saved).name if Path(saved).exists() else None + image = FileData(path=saved, orig_name=orig_name) + else: + raise ValueError(f"An image must be provided. Got {value}") + + return AnnotatedImageData(image=image, boxes=boxes) + + def process_example(self, value: dict | None) -> FileData | None: + if value is None: + return None + if not isinstance(value, dict): + raise ValueError(f"``value`` must be a dict. Got {type(value)}") + + image = value.setdefault("image", None) + if image is not None: + if isinstance(image, str) and image.lower().endswith(".svg"): + image = FileData(path=image, orig_name=Path(image).name) + else: + saved = image_utils.save_image(image, self.GRADIO_CACHE) + orig_name = Path(saved).name if Path(saved).exists() else None + image = FileData(path=saved, orig_name=orig_name) + else: + raise ValueError(f"An image must be provided. Got {value}") + + return image + + def example_inputs(self) -> Any: + return { + "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png", + "boxes": [ + { + "xmin": 30, + "ymin": 70, + "xmax": 530, + "ymax": 500, + "label": "Gradio", + "color": (250,185,0), + } + ] + } diff --git a/src/backend/gradio_image_annotation/templates/component/__vite-browser-external-2447137e.js b/src/backend/gradio_image_annotation/templates/component/__vite-browser-external-2447137e.js new file mode 100644 index 0000000000000000000000000000000000000000..a935c1d40fdca65888380f1b1716fc086957bbe9 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/__vite-browser-external-2447137e.js @@ -0,0 +1,4 @@ +const e = {}; +export { + e as default +}; diff --git a/src/backend/gradio_image_annotation/templates/component/__vite-browser-external-DYxpcVy9.js b/src/backend/gradio_image_annotation/templates/component/__vite-browser-external-DYxpcVy9.js new file mode 100644 index 0000000000000000000000000000000000000000..a935c1d40fdca65888380f1b1716fc086957bbe9 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/__vite-browser-external-DYxpcVy9.js @@ -0,0 +1,4 @@ +const e = {}; +export { + e as default +}; diff --git a/src/backend/gradio_image_annotation/templates/component/index.js b/src/backend/gradio_image_annotation/templates/component/index.js new file mode 100644 index 0000000000000000000000000000000000000000..58affa0bf5477a60e3fa7f60df38f2a1b65add71 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/index.js @@ -0,0 +1,10342 @@ +const { + SvelteComponent: mr, + assign: gr, + create_slot: br, + detach: wr, + element: pr, + get_all_dirty_from_scope: vr, + get_slot_changes: kr, + get_spread_update: yr, + init: Cr, + insert: Sr, + safe_not_equal: zr, + set_dynamic_element_data: go, + set_style: Ae, + toggle_class: xe, + transition_in: oa, + transition_out: sa, + update_slot_base: Br +} = window.__gradio__svelte__internal; +function qr(l) { + let e, t, n; + const i = ( + /*#slots*/ + l[18].default + ), o = br( + i, + l, + /*$$scope*/ + l[17], + null + ); + let s = [ + { "data-testid": ( + /*test_id*/ + l[7] + ) }, + { id: ( + /*elem_id*/ + l[2] + ) }, + { + class: t = "block " + /*elem_classes*/ + l[3].join(" ") + " svelte-nl1om8" + } + ], r = {}; + for (let a = 0; a < s.length; a += 1) + r = gr(r, s[a]); + return { + c() { + e = pr( + /*tag*/ + l[14] + ), o && o.c(), go( + /*tag*/ + l[14] + )(e, r), xe( + e, + "hidden", + /*visible*/ + l[10] === !1 + ), xe( + e, + "padded", + /*padding*/ + l[6] + ), xe( + e, + "border_focus", + /*border_mode*/ + l[5] === "focus" + ), xe( + e, + "border_contrast", + /*border_mode*/ + l[5] === "contrast" + ), xe(e, "hide-container", !/*explicit_call*/ + l[8] && !/*container*/ + l[9]), Ae( + e, + "height", + /*get_dimension*/ + l[15]( + /*height*/ + l[0] + ) + ), Ae(e, "width", typeof /*width*/ + l[1] == "number" ? `calc(min(${/*width*/ + l[1]}px, 100%))` : ( + /*get_dimension*/ + l[15]( + /*width*/ + l[1] + ) + )), Ae( + e, + "border-style", + /*variant*/ + l[4] + ), Ae( + e, + "overflow", + /*allow_overflow*/ + l[11] ? "visible" : "hidden" + ), Ae( + e, + "flex-grow", + /*scale*/ + l[12] + ), Ae(e, "min-width", `calc(min(${/*min_width*/ + l[13]}px, 100%))`), Ae(e, "border-width", "var(--block-border-width)"); + }, + m(a, f) { + Sr(a, e, f), o && o.m(e, null), n = !0; + }, + p(a, f) { + o && o.p && (!n || f & /*$$scope*/ + 131072) && Br( + o, + i, + a, + /*$$scope*/ + a[17], + n ? kr( + i, + /*$$scope*/ + a[17], + f, + null + ) : vr( + /*$$scope*/ + a[17] + ), + null + ), go( + /*tag*/ + a[14] + )(e, r = yr(s, [ + (!n || f & /*test_id*/ + 128) && { "data-testid": ( + /*test_id*/ + a[7] + ) }, + (!n || f & /*elem_id*/ + 4) && { id: ( + /*elem_id*/ + a[2] + ) }, + (!n || f & /*elem_classes*/ + 8 && t !== (t = "block " + /*elem_classes*/ + a[3].join(" ") + " svelte-nl1om8")) && { class: t } + ])), xe( + e, + "hidden", + /*visible*/ + a[10] === !1 + ), xe( + e, + "padded", + /*padding*/ + a[6] + ), xe( + e, + "border_focus", + /*border_mode*/ + a[5] === "focus" + ), xe( + e, + "border_contrast", + /*border_mode*/ + a[5] === "contrast" + ), xe(e, "hide-container", !/*explicit_call*/ + a[8] && !/*container*/ + a[9]), f & /*height*/ + 1 && Ae( + e, + "height", + /*get_dimension*/ + a[15]( + /*height*/ + a[0] + ) + ), f & /*width*/ + 2 && Ae(e, "width", typeof /*width*/ + a[1] == "number" ? `calc(min(${/*width*/ + a[1]}px, 100%))` : ( + /*get_dimension*/ + a[15]( + /*width*/ + a[1] + ) + )), f & /*variant*/ + 16 && Ae( + e, + "border-style", + /*variant*/ + a[4] + ), f & /*allow_overflow*/ + 2048 && Ae( + e, + "overflow", + /*allow_overflow*/ + a[11] ? "visible" : "hidden" + ), f & /*scale*/ + 4096 && Ae( + e, + "flex-grow", + /*scale*/ + a[12] + ), f & /*min_width*/ + 8192 && Ae(e, "min-width", `calc(min(${/*min_width*/ + a[13]}px, 100%))`); + }, + i(a) { + n || (oa(o, a), n = !0); + }, + o(a) { + sa(o, a), n = !1; + }, + d(a) { + a && wr(e), o && o.d(a); + } + }; +} +function Er(l) { + let e, t = ( + /*tag*/ + l[14] && qr(l) + ); + return { + c() { + t && t.c(); + }, + m(n, i) { + t && t.m(n, i), e = !0; + }, + p(n, [i]) { + /*tag*/ + n[14] && t.p(n, i); + }, + i(n) { + e || (oa(t, n), e = !0); + }, + o(n) { + sa(t, n), e = !1; + }, + d(n) { + t && t.d(n); + } + }; +} +function Mr(l, e, t) { + let { $$slots: n = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: s = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: a = [] } = e, { variant: f = "solid" } = e, { border_mode: u = "base" } = e, { padding: c = !0 } = e, { type: _ = "normal" } = e, { test_id: d = void 0 } = e, { explicit_call: h = !1 } = e, { container: m = !0 } = e, { visible: w = !0 } = e, { allow_overflow: b = !0 } = e, { scale: p = null } = e, { min_width: g = 0 } = e, v = _ === "fieldset" ? "fieldset" : "div"; + const E = (y) => { + if (y !== void 0) { + if (typeof y == "number") + return y + "px"; + if (typeof y == "string") + return y; + } + }; + return l.$$set = (y) => { + "height" in y && t(0, o = y.height), "width" in y && t(1, s = y.width), "elem_id" in y && t(2, r = y.elem_id), "elem_classes" in y && t(3, a = y.elem_classes), "variant" in y && t(4, f = y.variant), "border_mode" in y && t(5, u = y.border_mode), "padding" in y && t(6, c = y.padding), "type" in y && t(16, _ = y.type), "test_id" in y && t(7, d = y.test_id), "explicit_call" in y && t(8, h = y.explicit_call), "container" in y && t(9, m = y.container), "visible" in y && t(10, w = y.visible), "allow_overflow" in y && t(11, b = y.allow_overflow), "scale" in y && t(12, p = y.scale), "min_width" in y && t(13, g = y.min_width), "$$scope" in y && t(17, i = y.$$scope); + }, [ + o, + s, + r, + a, + f, + u, + c, + d, + h, + m, + w, + b, + p, + g, + v, + E, + _, + i, + n + ]; +} +class Ar extends mr { + constructor(e) { + super(), Cr(this, e, Mr, Er, zr, { + height: 0, + width: 1, + elem_id: 2, + elem_classes: 3, + variant: 4, + border_mode: 5, + padding: 6, + type: 16, + test_id: 7, + explicit_call: 8, + container: 9, + visible: 10, + allow_overflow: 11, + scale: 12, + min_width: 13 + }); + } +} +const { + SvelteComponent: Lr, + attr: Dr, + create_slot: Rr, + detach: Tr, + element: Ir, + get_all_dirty_from_scope: jr, + get_slot_changes: Hr, + init: Fr, + insert: Xr, + safe_not_equal: Yr, + transition_in: Nr, + transition_out: Ur, + update_slot_base: Or +} = window.__gradio__svelte__internal; +function Wr(l) { + let e, t; + const n = ( + /*#slots*/ + l[1].default + ), i = Rr( + n, + l, + /*$$scope*/ + l[0], + null + ); + return { + c() { + e = Ir("div"), i && i.c(), Dr(e, "class", "svelte-1hnfib2"); + }, + m(o, s) { + Xr(o, e, s), i && i.m(e, null), t = !0; + }, + p(o, [s]) { + i && i.p && (!t || s & /*$$scope*/ + 1) && Or( + i, + n, + o, + /*$$scope*/ + o[0], + t ? Hr( + n, + /*$$scope*/ + o[0], + s, + null + ) : jr( + /*$$scope*/ + o[0] + ), + null + ); + }, + i(o) { + t || (Nr(i, o), t = !0); + }, + o(o) { + Ur(i, o), t = !1; + }, + d(o) { + o && Tr(e), i && i.d(o); + } + }; +} +function Vr(l, e, t) { + let { $$slots: n = {}, $$scope: i } = e; + return l.$$set = (o) => { + "$$scope" in o && t(0, i = o.$$scope); + }, [i, n]; +} +class Pr extends Lr { + constructor(e) { + super(), Fr(this, e, Vr, Wr, Yr, {}); + } +} +const { + SvelteComponent: Zr, + attr: bo, + check_outros: Kr, + create_component: Gr, + create_slot: Jr, + destroy_component: Qr, + detach: yl, + element: xr, + empty: $r, + get_all_dirty_from_scope: ef, + get_slot_changes: tf, + group_outros: nf, + init: lf, + insert: Cl, + mount_component: of, + safe_not_equal: sf, + set_data: af, + space: rf, + text: ff, + toggle_class: nn, + transition_in: An, + transition_out: Sl, + update_slot_base: uf +} = window.__gradio__svelte__internal; +function wo(l) { + let e, t; + return e = new Pr({ + props: { + $$slots: { default: [cf] }, + $$scope: { ctx: l } + } + }), { + c() { + Gr(e.$$.fragment); + }, + m(n, i) { + of(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i & /*$$scope, info*/ + 10 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + }, + i(n) { + t || (An(e.$$.fragment, n), t = !0); + }, + o(n) { + Sl(e.$$.fragment, n), t = !1; + }, + d(n) { + Qr(e, n); + } + }; +} +function cf(l) { + let e; + return { + c() { + e = ff( + /*info*/ + l[1] + ); + }, + m(t, n) { + Cl(t, e, n); + }, + p(t, n) { + n & /*info*/ + 2 && af( + e, + /*info*/ + t[1] + ); + }, + d(t) { + t && yl(e); + } + }; +} +function _f(l) { + let e, t, n, i; + const o = ( + /*#slots*/ + l[2].default + ), s = Jr( + o, + l, + /*$$scope*/ + l[3], + null + ); + let r = ( + /*info*/ + l[1] && wo(l) + ); + return { + c() { + e = xr("span"), s && s.c(), t = rf(), r && r.c(), n = $r(), bo(e, "data-testid", "block-info"), bo(e, "class", "svelte-22c38v"), nn(e, "sr-only", !/*show_label*/ + l[0]), nn(e, "hide", !/*show_label*/ + l[0]), nn( + e, + "has-info", + /*info*/ + l[1] != null + ); + }, + m(a, f) { + Cl(a, e, f), s && s.m(e, null), Cl(a, t, f), r && r.m(a, f), Cl(a, n, f), i = !0; + }, + p(a, [f]) { + s && s.p && (!i || f & /*$$scope*/ + 8) && uf( + s, + o, + a, + /*$$scope*/ + a[3], + i ? tf( + o, + /*$$scope*/ + a[3], + f, + null + ) : ef( + /*$$scope*/ + a[3] + ), + null + ), (!i || f & /*show_label*/ + 1) && nn(e, "sr-only", !/*show_label*/ + a[0]), (!i || f & /*show_label*/ + 1) && nn(e, "hide", !/*show_label*/ + a[0]), (!i || f & /*info*/ + 2) && nn( + e, + "has-info", + /*info*/ + a[1] != null + ), /*info*/ + a[1] ? r ? (r.p(a, f), f & /*info*/ + 2 && An(r, 1)) : (r = wo(a), r.c(), An(r, 1), r.m(n.parentNode, n)) : r && (nf(), Sl(r, 1, 1, () => { + r = null; + }), Kr()); + }, + i(a) { + i || (An(s, a), An(r), i = !0); + }, + o(a) { + Sl(s, a), Sl(r), i = !1; + }, + d(a) { + a && (yl(e), yl(t), yl(n)), s && s.d(a), r && r.d(a); + } + }; +} +function df(l, e, t) { + let { $$slots: n = {}, $$scope: i } = e, { show_label: o = !0 } = e, { info: s = void 0 } = e; + return l.$$set = (r) => { + "show_label" in r && t(0, o = r.show_label), "info" in r && t(1, s = r.info), "$$scope" in r && t(3, i = r.$$scope); + }, [o, s, n, i]; +} +class aa extends Zr { + constructor(e) { + super(), lf(this, e, df, _f, sf, { show_label: 0, info: 1 }); + } +} +const { + SvelteComponent: hf, + append: ii, + attr: ol, + create_component: mf, + destroy_component: gf, + detach: bf, + element: po, + init: wf, + insert: pf, + mount_component: vf, + safe_not_equal: kf, + set_data: yf, + space: Cf, + text: Sf, + toggle_class: pt, + transition_in: zf, + transition_out: Bf +} = window.__gradio__svelte__internal; +function qf(l) { + let e, t, n, i, o, s; + return n = new /*Icon*/ + l[1]({}), { + c() { + e = po("label"), t = po("span"), mf(n.$$.fragment), i = Cf(), o = Sf( + /*label*/ + l[0] + ), ol(t, "class", "svelte-9gxdi0"), ol(e, "for", ""), ol(e, "data-testid", "block-label"), ol(e, "class", "svelte-9gxdi0"), pt(e, "hide", !/*show_label*/ + l[2]), pt(e, "sr-only", !/*show_label*/ + l[2]), pt( + e, + "float", + /*float*/ + l[4] + ), pt( + e, + "hide-label", + /*disable*/ + l[3] + ); + }, + m(r, a) { + pf(r, e, a), ii(e, t), vf(n, t, null), ii(e, i), ii(e, o), s = !0; + }, + p(r, [a]) { + (!s || a & /*label*/ + 1) && yf( + o, + /*label*/ + r[0] + ), (!s || a & /*show_label*/ + 4) && pt(e, "hide", !/*show_label*/ + r[2]), (!s || a & /*show_label*/ + 4) && pt(e, "sr-only", !/*show_label*/ + r[2]), (!s || a & /*float*/ + 16) && pt( + e, + "float", + /*float*/ + r[4] + ), (!s || a & /*disable*/ + 8) && pt( + e, + "hide-label", + /*disable*/ + r[3] + ); + }, + i(r) { + s || (zf(n.$$.fragment, r), s = !0); + }, + o(r) { + Bf(n.$$.fragment, r), s = !1; + }, + d(r) { + r && bf(e), gf(n); + } + }; +} +function Ef(l, e, t) { + let { label: n = null } = e, { Icon: i } = e, { show_label: o = !0 } = e, { disable: s = !1 } = e, { float: r = !0 } = e; + return l.$$set = (a) => { + "label" in a && t(0, n = a.label), "Icon" in a && t(1, i = a.Icon), "show_label" in a && t(2, o = a.show_label), "disable" in a && t(3, s = a.disable), "float" in a && t(4, r = a.float); + }, [n, i, o, s, r]; +} +class Mf extends hf { + constructor(e) { + super(), wf(this, e, Ef, qf, kf, { + label: 0, + Icon: 1, + show_label: 2, + disable: 3, + float: 4 + }); + } +} +const { + SvelteComponent: Af, + append: Xi, + attr: ft, + bubble: Lf, + create_component: Df, + destroy_component: Rf, + detach: ra, + element: Yi, + init: Tf, + insert: fa, + listen: If, + mount_component: jf, + safe_not_equal: Hf, + set_data: Ff, + set_style: ln, + space: Xf, + text: Yf, + toggle_class: ye, + transition_in: Nf, + transition_out: Uf +} = window.__gradio__svelte__internal; +function vo(l) { + let e, t; + return { + c() { + e = Yi("span"), t = Yf( + /*label*/ + l[1] + ), ft(e, "class", "svelte-1lrphxw"); + }, + m(n, i) { + fa(n, e, i), Xi(e, t); + }, + p(n, i) { + i & /*label*/ + 2 && Ff( + t, + /*label*/ + n[1] + ); + }, + d(n) { + n && ra(e); + } + }; +} +function Of(l) { + let e, t, n, i, o, s, r, a = ( + /*show_label*/ + l[2] && vo(l) + ); + return i = new /*Icon*/ + l[0]({}), { + c() { + e = Yi("button"), a && a.c(), t = Xf(), n = Yi("div"), Df(i.$$.fragment), ft(n, "class", "svelte-1lrphxw"), ye( + n, + "small", + /*size*/ + l[4] === "small" + ), ye( + n, + "large", + /*size*/ + l[4] === "large" + ), ye( + n, + "medium", + /*size*/ + l[4] === "medium" + ), e.disabled = /*disabled*/ + l[7], ft( + e, + "aria-label", + /*label*/ + l[1] + ), ft( + e, + "aria-haspopup", + /*hasPopup*/ + l[8] + ), ft( + e, + "title", + /*label*/ + l[1] + ), ft(e, "class", "svelte-1lrphxw"), ye( + e, + "pending", + /*pending*/ + l[3] + ), ye( + e, + "padded", + /*padded*/ + l[5] + ), ye( + e, + "highlight", + /*highlight*/ + l[6] + ), ye( + e, + "transparent", + /*transparent*/ + l[9] + ), ln(e, "color", !/*disabled*/ + l[7] && /*_color*/ + l[12] ? ( + /*_color*/ + l[12] + ) : "var(--block-label-text-color)"), ln(e, "--bg-color", /*disabled*/ + l[7] ? "auto" : ( + /*background*/ + l[10] + )), ln( + e, + "margin-left", + /*offset*/ + l[11] + "px" + ); + }, + m(f, u) { + fa(f, e, u), a && a.m(e, null), Xi(e, t), Xi(e, n), jf(i, n, null), o = !0, s || (r = If( + e, + "click", + /*click_handler*/ + l[14] + ), s = !0); + }, + p(f, [u]) { + /*show_label*/ + f[2] ? a ? a.p(f, u) : (a = vo(f), a.c(), a.m(e, t)) : a && (a.d(1), a = null), (!o || u & /*size*/ + 16) && ye( + n, + "small", + /*size*/ + f[4] === "small" + ), (!o || u & /*size*/ + 16) && ye( + n, + "large", + /*size*/ + f[4] === "large" + ), (!o || u & /*size*/ + 16) && ye( + n, + "medium", + /*size*/ + f[4] === "medium" + ), (!o || u & /*disabled*/ + 128) && (e.disabled = /*disabled*/ + f[7]), (!o || u & /*label*/ + 2) && ft( + e, + "aria-label", + /*label*/ + f[1] + ), (!o || u & /*hasPopup*/ + 256) && ft( + e, + "aria-haspopup", + /*hasPopup*/ + f[8] + ), (!o || u & /*label*/ + 2) && ft( + e, + "title", + /*label*/ + f[1] + ), (!o || u & /*pending*/ + 8) && ye( + e, + "pending", + /*pending*/ + f[3] + ), (!o || u & /*padded*/ + 32) && ye( + e, + "padded", + /*padded*/ + f[5] + ), (!o || u & /*highlight*/ + 64) && ye( + e, + "highlight", + /*highlight*/ + f[6] + ), (!o || u & /*transparent*/ + 512) && ye( + e, + "transparent", + /*transparent*/ + f[9] + ), u & /*disabled, _color*/ + 4224 && ln(e, "color", !/*disabled*/ + f[7] && /*_color*/ + f[12] ? ( + /*_color*/ + f[12] + ) : "var(--block-label-text-color)"), u & /*disabled, background*/ + 1152 && ln(e, "--bg-color", /*disabled*/ + f[7] ? "auto" : ( + /*background*/ + f[10] + )), u & /*offset*/ + 2048 && ln( + e, + "margin-left", + /*offset*/ + f[11] + "px" + ); + }, + i(f) { + o || (Nf(i.$$.fragment, f), o = !0); + }, + o(f) { + Uf(i.$$.fragment, f), o = !1; + }, + d(f) { + f && ra(e), a && a.d(), Rf(i), s = !1, r(); + } + }; +} +function Wf(l, e, t) { + let n, { Icon: i } = e, { label: o = "" } = e, { show_label: s = !1 } = e, { pending: r = !1 } = e, { size: a = "small" } = e, { padded: f = !0 } = e, { highlight: u = !1 } = e, { disabled: c = !1 } = e, { hasPopup: _ = !1 } = e, { color: d = "var(--block-label-text-color)" } = e, { transparent: h = !1 } = e, { background: m = "var(--background-fill-primary)" } = e, { offset: w = 0 } = e; + function b(p) { + Lf.call(this, l, p); + } + return l.$$set = (p) => { + "Icon" in p && t(0, i = p.Icon), "label" in p && t(1, o = p.label), "show_label" in p && t(2, s = p.show_label), "pending" in p && t(3, r = p.pending), "size" in p && t(4, a = p.size), "padded" in p && t(5, f = p.padded), "highlight" in p && t(6, u = p.highlight), "disabled" in p && t(7, c = p.disabled), "hasPopup" in p && t(8, _ = p.hasPopup), "color" in p && t(13, d = p.color), "transparent" in p && t(9, h = p.transparent), "background" in p && t(10, m = p.background), "offset" in p && t(11, w = p.offset); + }, l.$$.update = () => { + l.$$.dirty & /*highlight, color*/ + 8256 && t(12, n = u ? "var(--color-accent)" : d); + }, [ + i, + o, + s, + r, + a, + f, + u, + c, + _, + h, + m, + w, + n, + d, + b + ]; +} +class Vl extends Af { + constructor(e) { + super(), Tf(this, e, Wf, Of, Hf, { + Icon: 0, + label: 1, + show_label: 2, + pending: 3, + size: 4, + padded: 5, + highlight: 6, + disabled: 7, + hasPopup: 8, + color: 13, + transparent: 9, + background: 10, + offset: 11 + }); + } +} +const { + SvelteComponent: Vf, + append: Pf, + attr: oi, + binding_callbacks: Zf, + create_slot: Kf, + detach: Gf, + element: ko, + get_all_dirty_from_scope: Jf, + get_slot_changes: Qf, + init: xf, + insert: $f, + safe_not_equal: eu, + toggle_class: vt, + transition_in: tu, + transition_out: nu, + update_slot_base: lu +} = window.__gradio__svelte__internal; +function iu(l) { + let e, t, n; + const i = ( + /*#slots*/ + l[5].default + ), o = Kf( + i, + l, + /*$$scope*/ + l[4], + null + ); + return { + c() { + e = ko("div"), t = ko("div"), o && o.c(), oi(t, "class", "icon svelte-3w3rth"), oi(e, "class", "empty svelte-3w3rth"), oi(e, "aria-label", "Empty value"), vt( + e, + "small", + /*size*/ + l[0] === "small" + ), vt( + e, + "large", + /*size*/ + l[0] === "large" + ), vt( + e, + "unpadded_box", + /*unpadded_box*/ + l[1] + ), vt( + e, + "small_parent", + /*parent_height*/ + l[3] + ); + }, + m(s, r) { + $f(s, e, r), Pf(e, t), o && o.m(t, null), l[6](e), n = !0; + }, + p(s, [r]) { + o && o.p && (!n || r & /*$$scope*/ + 16) && lu( + o, + i, + s, + /*$$scope*/ + s[4], + n ? Qf( + i, + /*$$scope*/ + s[4], + r, + null + ) : Jf( + /*$$scope*/ + s[4] + ), + null + ), (!n || r & /*size*/ + 1) && vt( + e, + "small", + /*size*/ + s[0] === "small" + ), (!n || r & /*size*/ + 1) && vt( + e, + "large", + /*size*/ + s[0] === "large" + ), (!n || r & /*unpadded_box*/ + 2) && vt( + e, + "unpadded_box", + /*unpadded_box*/ + s[1] + ), (!n || r & /*parent_height*/ + 8) && vt( + e, + "small_parent", + /*parent_height*/ + s[3] + ); + }, + i(s) { + n || (tu(o, s), n = !0); + }, + o(s) { + nu(o, s), n = !1; + }, + d(s) { + s && Gf(e), o && o.d(s), l[6](null); + } + }; +} +function ou(l, e, t) { + let n, { $$slots: i = {}, $$scope: o } = e, { size: s = "small" } = e, { unpadded_box: r = !1 } = e, a; + function f(c) { + var _; + if (!c) return !1; + const { height: d } = c.getBoundingClientRect(), { height: h } = ((_ = c.parentElement) === null || _ === void 0 ? void 0 : _.getBoundingClientRect()) || { height: d }; + return d > h + 2; + } + function u(c) { + Zf[c ? "unshift" : "push"](() => { + a = c, t(2, a); + }); + } + return l.$$set = (c) => { + "size" in c && t(0, s = c.size), "unpadded_box" in c && t(1, r = c.unpadded_box), "$$scope" in c && t(4, o = c.$$scope); + }, l.$$.update = () => { + l.$$.dirty & /*el*/ + 4 && t(3, n = f(a)); + }, [s, r, a, n, o, i, u]; +} +class su extends Vf { + constructor(e) { + super(), xf(this, e, ou, iu, eu, { size: 0, unpadded_box: 1 }); + } +} +const { + SvelteComponent: au, + append: yo, + attr: Ce, + detach: ru, + init: fu, + insert: uu, + noop: si, + safe_not_equal: cu, + svg_element: ai +} = window.__gradio__svelte__internal; +function _u(l) { + let e, t, n; + return { + c() { + e = ai("svg"), t = ai("path"), n = ai("circle"), Ce(t, "d", "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"), Ce(n, "cx", "12"), Ce(n, "cy", "13"), Ce(n, "r", "4"), Ce(e, "xmlns", "http://www.w3.org/2000/svg"), Ce(e, "width", "100%"), Ce(e, "height", "100%"), Ce(e, "viewBox", "0 0 24 24"), Ce(e, "fill", "none"), Ce(e, "stroke", "currentColor"), Ce(e, "stroke-width", "1.5"), Ce(e, "stroke-linecap", "round"), Ce(e, "stroke-linejoin", "round"), Ce(e, "class", "feather feather-camera"); + }, + m(i, o) { + uu(i, e, o), yo(e, t), yo(e, n); + }, + p: si, + i: si, + o: si, + d(i) { + i && ru(e); + } + }; +} +class du extends au { + constructor(e) { + super(), fu(this, e, null, _u, cu, {}); + } +} +const { + SvelteComponent: hu, + append: mu, + attr: Oe, + detach: gu, + init: bu, + insert: wu, + noop: ri, + safe_not_equal: pu, + svg_element: Co +} = window.__gradio__svelte__internal; +function vu(l) { + let e, t; + return { + c() { + e = Co("svg"), t = Co("circle"), Oe(t, "cx", "12"), Oe(t, "cy", "12"), Oe(t, "r", "10"), Oe(e, "xmlns", "http://www.w3.org/2000/svg"), Oe(e, "width", "100%"), Oe(e, "height", "100%"), Oe(e, "viewBox", "0 0 24 24"), Oe(e, "stroke-width", "1.5"), Oe(e, "stroke-linecap", "round"), Oe(e, "stroke-linejoin", "round"), Oe(e, "class", "feather feather-circle"); + }, + m(n, i) { + wu(n, e, i), mu(e, t); + }, + p: ri, + i: ri, + o: ri, + d(n) { + n && gu(e); + } + }; +} +class ku extends hu { + constructor(e) { + super(), bu(this, e, null, vu, pu, {}); + } +} +const { + SvelteComponent: yu, + append: fi, + attr: We, + detach: Cu, + init: Su, + insert: zu, + noop: ui, + safe_not_equal: Bu, + set_style: $e, + svg_element: sl +} = window.__gradio__svelte__internal; +function qu(l) { + let e, t, n, i; + return { + c() { + e = sl("svg"), t = sl("g"), n = sl("path"), i = sl("path"), We(n, "d", "M18,6L6.087,17.913"), $e(n, "fill", "none"), $e(n, "fill-rule", "nonzero"), $e(n, "stroke-width", "2px"), We(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), We(i, "d", "M4.364,4.364L19.636,19.636"), $e(i, "fill", "none"), $e(i, "fill-rule", "nonzero"), $e(i, "stroke-width", "2px"), We(e, "width", "100%"), We(e, "height", "100%"), We(e, "viewBox", "0 0 24 24"), We(e, "version", "1.1"), We(e, "xmlns", "http://www.w3.org/2000/svg"), We(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), We(e, "xml:space", "preserve"), We(e, "stroke", "currentColor"), $e(e, "fill-rule", "evenodd"), $e(e, "clip-rule", "evenodd"), $e(e, "stroke-linecap", "round"), $e(e, "stroke-linejoin", "round"); + }, + m(o, s) { + zu(o, e, s), fi(e, t), fi(t, n), fi(e, i); + }, + p: ui, + i: ui, + o: ui, + d(o) { + o && Cu(e); + } + }; +} +class ua extends yu { + constructor(e) { + super(), Su(this, e, null, qu, Bu, {}); + } +} +const { + SvelteComponent: Eu, + append: Mu, + attr: zn, + detach: Au, + init: Lu, + insert: Du, + noop: ci, + safe_not_equal: Ru, + svg_element: So +} = window.__gradio__svelte__internal; +function Tu(l) { + let e, t; + return { + c() { + e = So("svg"), t = So("path"), zn(t, "d", "M23,20a5,5,0,0,0-3.89,1.89L11.8,17.32a4.46,4.46,0,0,0,0-2.64l7.31-4.57A5,5,0,1,0,18,7a4.79,4.79,0,0,0,.2,1.32l-7.31,4.57a5,5,0,1,0,0,6.22l7.31,4.57A4.79,4.79,0,0,0,18,25a5,5,0,1,0,5-5ZM23,4a3,3,0,1,1-3,3A3,3,0,0,1,23,4ZM7,19a3,3,0,1,1,3-3A3,3,0,0,1,7,19Zm16,9a3,3,0,1,1,3-3A3,3,0,0,1,23,28Z"), zn(t, "fill", "currentColor"), zn(e, "id", "icon"), zn(e, "xmlns", "http://www.w3.org/2000/svg"), zn(e, "viewBox", "0 0 32 32"); + }, + m(n, i) { + Du(n, e, i), Mu(e, t); + }, + p: ci, + i: ci, + o: ci, + d(n) { + n && Au(e); + } + }; +} +class Iu extends Eu { + constructor(e) { + super(), Lu(this, e, null, Tu, Ru, {}); + } +} +const { + SvelteComponent: ju, + append: Hu, + attr: on, + detach: Fu, + init: Xu, + insert: Yu, + noop: _i, + safe_not_equal: Nu, + svg_element: zo +} = window.__gradio__svelte__internal; +function Uu(l) { + let e, t; + return { + c() { + e = zo("svg"), t = zo("path"), on(t, "fill", "currentColor"), on(t, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), on(e, "xmlns", "http://www.w3.org/2000/svg"), on(e, "width", "100%"), on(e, "height", "100%"), on(e, "viewBox", "0 0 32 32"); + }, + m(n, i) { + Yu(n, e, i), Hu(e, t); + }, + p: _i, + i: _i, + o: _i, + d(n) { + n && Fu(e); + } + }; +} +class Ou extends ju { + constructor(e) { + super(), Xu(this, e, null, Uu, Nu, {}); + } +} +const { + SvelteComponent: Wu, + append: Vu, + attr: sn, + detach: Pu, + init: Zu, + insert: Ku, + noop: di, + safe_not_equal: Gu, + svg_element: Bo +} = window.__gradio__svelte__internal; +function Ju(l) { + let e, t; + return { + c() { + e = Bo("svg"), t = Bo("path"), sn(t, "d", "M5 8l4 4 4-4z"), sn(e, "class", "dropdown-arrow svelte-145leq6"), sn(e, "xmlns", "http://www.w3.org/2000/svg"), sn(e, "width", "100%"), sn(e, "height", "100%"), sn(e, "viewBox", "0 0 18 18"); + }, + m(n, i) { + Ku(n, e, i), Vu(e, t); + }, + p: di, + i: di, + o: di, + d(n) { + n && Pu(e); + } + }; +} +class io extends Wu { + constructor(e) { + super(), Zu(this, e, null, Ju, Gu, {}); + } +} +const { + SvelteComponent: Qu, + append: hi, + attr: se, + detach: xu, + init: $u, + insert: ec, + noop: mi, + safe_not_equal: tc, + svg_element: al +} = window.__gradio__svelte__internal; +function nc(l) { + let e, t, n, i; + return { + c() { + e = al("svg"), t = al("rect"), n = al("circle"), i = al("polyline"), se(t, "x", "3"), se(t, "y", "3"), se(t, "width", "18"), se(t, "height", "18"), se(t, "rx", "2"), se(t, "ry", "2"), se(n, "cx", "8.5"), se(n, "cy", "8.5"), se(n, "r", "1.5"), se(i, "points", "21 15 16 10 5 21"), se(e, "xmlns", "http://www.w3.org/2000/svg"), se(e, "width", "100%"), se(e, "height", "100%"), se(e, "viewBox", "0 0 24 24"), se(e, "fill", "none"), se(e, "stroke", "currentColor"), se(e, "stroke-width", "1.5"), se(e, "stroke-linecap", "round"), se(e, "stroke-linejoin", "round"), se(e, "class", "feather feather-image"); + }, + m(o, s) { + ec(o, e, s), hi(e, t), hi(e, n), hi(e, i); + }, + p: mi, + i: mi, + o: mi, + d(o) { + o && xu(e); + } + }; +} +let ca = class extends Qu { + constructor(e) { + super(), $u(this, e, null, nc, tc, {}); + } +}; +const { + SvelteComponent: lc, + append: ic, + attr: rl, + detach: oc, + init: sc, + insert: ac, + noop: gi, + safe_not_equal: rc, + svg_element: qo +} = window.__gradio__svelte__internal; +function fc(l) { + let e, t; + return { + c() { + e = qo("svg"), t = qo("path"), rl(t, "fill", "currentColor"), rl(t, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a4 4 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2zm2.245 2.096L16 4.25q0-.078-.005-.154M13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5M15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3zm0 11a3 3 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A3 3 0 0 1 20 23zm5-7a1 1 0 1 1 0-2 1 1 0 0 1 0 2"), rl(e, "xmlns", "http://www.w3.org/2000/svg"), rl(e, "viewBox", "0 0 24 24"); + }, + m(n, i) { + ac(n, e, i), ic(e, t); + }, + p: gi, + i: gi, + o: gi, + d(n) { + n && oc(e); + } + }; +} +class _a extends lc { + constructor(e) { + super(), sc(this, e, null, fc, rc, {}); + } +} +const { + SvelteComponent: uc, + append: fl, + attr: ae, + detach: cc, + init: _c, + insert: dc, + noop: bi, + safe_not_equal: hc, + svg_element: Bn +} = window.__gradio__svelte__internal; +function mc(l) { + let e, t, n, i, o; + return { + c() { + e = Bn("svg"), t = Bn("path"), n = Bn("path"), i = Bn("line"), o = Bn("line"), ae(t, "d", "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"), ae(n, "d", "M19 10v2a7 7 0 0 1-14 0v-2"), ae(i, "x1", "12"), ae(i, "y1", "19"), ae(i, "x2", "12"), ae(i, "y2", "23"), ae(o, "x1", "8"), ae(o, "y1", "23"), ae(o, "x2", "16"), ae(o, "y2", "23"), ae(e, "xmlns", "http://www.w3.org/2000/svg"), ae(e, "width", "100%"), ae(e, "height", "100%"), ae(e, "viewBox", "0 0 24 24"), ae(e, "fill", "none"), ae(e, "stroke", "currentColor"), ae(e, "stroke-width", "2"), ae(e, "stroke-linecap", "round"), ae(e, "stroke-linejoin", "round"), ae(e, "class", "feather feather-mic"); + }, + m(s, r) { + dc(s, e, r), fl(e, t), fl(e, n), fl(e, i), fl(e, o); + }, + p: bi, + i: bi, + o: bi, + d(s) { + s && cc(e); + } + }; +} +class gc extends uc { + constructor(e) { + super(), _c(this, e, null, mc, hc, {}); + } +} +const { + SvelteComponent: bc, + append: wc, + attr: Se, + detach: pc, + init: vc, + insert: kc, + noop: wi, + safe_not_equal: yc, + svg_element: Eo +} = window.__gradio__svelte__internal; +function Cc(l) { + let e, t; + return { + c() { + e = Eo("svg"), t = Eo("rect"), Se(t, "x", "3"), Se(t, "y", "3"), Se(t, "width", "18"), Se(t, "height", "18"), Se(t, "rx", "2"), Se(t, "ry", "2"), Se(e, "xmlns", "http://www.w3.org/2000/svg"), Se(e, "width", "100%"), Se(e, "height", "100%"), Se(e, "viewBox", "0 0 24 24"), Se(e, "stroke-width", "1.5"), Se(e, "stroke-linecap", "round"), Se(e, "stroke-linejoin", "round"), Se(e, "class", "feather feather-square"); + }, + m(n, i) { + kc(n, e, i), wc(e, t); + }, + p: wi, + i: wi, + o: wi, + d(n) { + n && pc(e); + } + }; +} +class Sc extends bc { + constructor(e) { + super(), vc(this, e, null, Cc, yc, {}); + } +} +const { + SvelteComponent: zc, + append: pi, + attr: we, + detach: Bc, + init: qc, + insert: Ec, + noop: vi, + safe_not_equal: Mc, + svg_element: ul +} = window.__gradio__svelte__internal; +function Ac(l) { + let e, t, n, i; + return { + c() { + e = ul("svg"), t = ul("path"), n = ul("polyline"), i = ul("line"), we(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), we(n, "points", "17 8 12 3 7 8"), we(i, "x1", "12"), we(i, "y1", "3"), we(i, "x2", "12"), we(i, "y2", "15"), we(e, "xmlns", "http://www.w3.org/2000/svg"), we(e, "width", "90%"), we(e, "height", "90%"), we(e, "viewBox", "0 0 24 24"), we(e, "fill", "none"), we(e, "stroke", "currentColor"), we(e, "stroke-width", "2"), we(e, "stroke-linecap", "round"), we(e, "stroke-linejoin", "round"), we(e, "class", "feather feather-upload"); + }, + m(o, s) { + Ec(o, e, s), pi(e, t), pi(e, n), pi(e, i); + }, + p: vi, + i: vi, + o: vi, + d(o) { + o && Bc(e); + } + }; +} +let da = class extends zc { + constructor(e) { + super(), qc(this, e, null, Ac, Mc, {}); + } +}; +const { + SvelteComponent: Lc, + append: Mo, + attr: kt, + detach: Dc, + init: Rc, + insert: Tc, + noop: ki, + safe_not_equal: Ic, + svg_element: yi +} = window.__gradio__svelte__internal; +function jc(l) { + let e, t, n; + return { + c() { + e = yi("svg"), t = yi("path"), n = yi("path"), kt(t, "fill", "currentColor"), kt(t, "d", "M12 2c-4.963 0-9 4.038-9 9c0 3.328 1.82 6.232 4.513 7.79l-2.067 1.378A1 1 0 0 0 6 22h12a1 1 0 0 0 .555-1.832l-2.067-1.378C19.18 17.232 21 14.328 21 11c0-4.962-4.037-9-9-9zm0 16c-3.859 0-7-3.141-7-7c0-3.86 3.141-7 7-7s7 3.14 7 7c0 3.859-3.141 7-7 7z"), kt(n, "fill", "currentColor"), kt(n, "d", "M12 6c-2.757 0-5 2.243-5 5s2.243 5 5 5s5-2.243 5-5s-2.243-5-5-5zm0 8c-1.654 0-3-1.346-3-3s1.346-3 3-3s3 1.346 3 3s-1.346 3-3 3z"), kt(e, "xmlns", "http://www.w3.org/2000/svg"), kt(e, "width", "100%"), kt(e, "height", "100%"), kt(e, "viewBox", "0 0 24 24"); + }, + m(i, o) { + Tc(i, e, o), Mo(e, t), Mo(e, n); + }, + p: ki, + i: ki, + o: ki, + d(i) { + i && Dc(e); + } + }; +} +let ha = class extends Lc { + constructor(e) { + super(), Rc(this, e, null, jc, Ic, {}); + } +}; +const Hc = [ + { color: "red", primary: 600, secondary: 100 }, + { color: "green", primary: 600, secondary: 100 }, + { color: "blue", primary: 600, secondary: 100 }, + { color: "yellow", primary: 500, secondary: 100 }, + { color: "purple", primary: 600, secondary: 100 }, + { color: "teal", primary: 600, secondary: 100 }, + { color: "orange", primary: 600, secondary: 100 }, + { color: "cyan", primary: 600, secondary: 100 }, + { color: "lime", primary: 500, secondary: 100 }, + { color: "pink", primary: 600, secondary: 100 } +], Ao = { + inherit: "inherit", + current: "currentColor", + transparent: "transparent", + black: "#000", + white: "#fff", + slate: { + 50: "#f8fafc", + 100: "#f1f5f9", + 200: "#e2e8f0", + 300: "#cbd5e1", + 400: "#94a3b8", + 500: "#64748b", + 600: "#475569", + 700: "#334155", + 800: "#1e293b", + 900: "#0f172a", + 950: "#020617" + }, + gray: { + 50: "#f9fafb", + 100: "#f3f4f6", + 200: "#e5e7eb", + 300: "#d1d5db", + 400: "#9ca3af", + 500: "#6b7280", + 600: "#4b5563", + 700: "#374151", + 800: "#1f2937", + 900: "#111827", + 950: "#030712" + }, + zinc: { + 50: "#fafafa", + 100: "#f4f4f5", + 200: "#e4e4e7", + 300: "#d4d4d8", + 400: "#a1a1aa", + 500: "#71717a", + 600: "#52525b", + 700: "#3f3f46", + 800: "#27272a", + 900: "#18181b", + 950: "#09090b" + }, + neutral: { + 50: "#fafafa", + 100: "#f5f5f5", + 200: "#e5e5e5", + 300: "#d4d4d4", + 400: "#a3a3a3", + 500: "#737373", + 600: "#525252", + 700: "#404040", + 800: "#262626", + 900: "#171717", + 950: "#0a0a0a" + }, + stone: { + 50: "#fafaf9", + 100: "#f5f5f4", + 200: "#e7e5e4", + 300: "#d6d3d1", + 400: "#a8a29e", + 500: "#78716c", + 600: "#57534e", + 700: "#44403c", + 800: "#292524", + 900: "#1c1917", + 950: "#0c0a09" + }, + red: { + 50: "#fef2f2", + 100: "#fee2e2", + 200: "#fecaca", + 300: "#fca5a5", + 400: "#f87171", + 500: "#ef4444", + 600: "#dc2626", + 700: "#b91c1c", + 800: "#991b1b", + 900: "#7f1d1d", + 950: "#450a0a" + }, + orange: { + 50: "#fff7ed", + 100: "#ffedd5", + 200: "#fed7aa", + 300: "#fdba74", + 400: "#fb923c", + 500: "#f97316", + 600: "#ea580c", + 700: "#c2410c", + 800: "#9a3412", + 900: "#7c2d12", + 950: "#431407" + }, + amber: { + 50: "#fffbeb", + 100: "#fef3c7", + 200: "#fde68a", + 300: "#fcd34d", + 400: "#fbbf24", + 500: "#f59e0b", + 600: "#d97706", + 700: "#b45309", + 800: "#92400e", + 900: "#78350f", + 950: "#451a03" + }, + yellow: { + 50: "#fefce8", + 100: "#fef9c3", + 200: "#fef08a", + 300: "#fde047", + 400: "#facc15", + 500: "#eab308", + 600: "#ca8a04", + 700: "#a16207", + 800: "#854d0e", + 900: "#713f12", + 950: "#422006" + }, + lime: { + 50: "#f7fee7", + 100: "#ecfccb", + 200: "#d9f99d", + 300: "#bef264", + 400: "#a3e635", + 500: "#84cc16", + 600: "#65a30d", + 700: "#4d7c0f", + 800: "#3f6212", + 900: "#365314", + 950: "#1a2e05" + }, + green: { + 50: "#f0fdf4", + 100: "#dcfce7", + 200: "#bbf7d0", + 300: "#86efac", + 400: "#4ade80", + 500: "#22c55e", + 600: "#16a34a", + 700: "#15803d", + 800: "#166534", + 900: "#14532d", + 950: "#052e16" + }, + emerald: { + 50: "#ecfdf5", + 100: "#d1fae5", + 200: "#a7f3d0", + 300: "#6ee7b7", + 400: "#34d399", + 500: "#10b981", + 600: "#059669", + 700: "#047857", + 800: "#065f46", + 900: "#064e3b", + 950: "#022c22" + }, + teal: { + 50: "#f0fdfa", + 100: "#ccfbf1", + 200: "#99f6e4", + 300: "#5eead4", + 400: "#2dd4bf", + 500: "#14b8a6", + 600: "#0d9488", + 700: "#0f766e", + 800: "#115e59", + 900: "#134e4a", + 950: "#042f2e" + }, + cyan: { + 50: "#ecfeff", + 100: "#cffafe", + 200: "#a5f3fc", + 300: "#67e8f9", + 400: "#22d3ee", + 500: "#06b6d4", + 600: "#0891b2", + 700: "#0e7490", + 800: "#155e75", + 900: "#164e63", + 950: "#083344" + }, + sky: { + 50: "#f0f9ff", + 100: "#e0f2fe", + 200: "#bae6fd", + 300: "#7dd3fc", + 400: "#38bdf8", + 500: "#0ea5e9", + 600: "#0284c7", + 700: "#0369a1", + 800: "#075985", + 900: "#0c4a6e", + 950: "#082f49" + }, + blue: { + 50: "#eff6ff", + 100: "#dbeafe", + 200: "#bfdbfe", + 300: "#93c5fd", + 400: "#60a5fa", + 500: "#3b82f6", + 600: "#2563eb", + 700: "#1d4ed8", + 800: "#1e40af", + 900: "#1e3a8a", + 950: "#172554" + }, + indigo: { + 50: "#eef2ff", + 100: "#e0e7ff", + 200: "#c7d2fe", + 300: "#a5b4fc", + 400: "#818cf8", + 500: "#6366f1", + 600: "#4f46e5", + 700: "#4338ca", + 800: "#3730a3", + 900: "#312e81", + 950: "#1e1b4b" + }, + violet: { + 50: "#f5f3ff", + 100: "#ede9fe", + 200: "#ddd6fe", + 300: "#c4b5fd", + 400: "#a78bfa", + 500: "#8b5cf6", + 600: "#7c3aed", + 700: "#6d28d9", + 800: "#5b21b6", + 900: "#4c1d95", + 950: "#2e1065" + }, + purple: { + 50: "#faf5ff", + 100: "#f3e8ff", + 200: "#e9d5ff", + 300: "#d8b4fe", + 400: "#c084fc", + 500: "#a855f7", + 600: "#9333ea", + 700: "#7e22ce", + 800: "#6b21a8", + 900: "#581c87", + 950: "#3b0764" + }, + fuchsia: { + 50: "#fdf4ff", + 100: "#fae8ff", + 200: "#f5d0fe", + 300: "#f0abfc", + 400: "#e879f9", + 500: "#d946ef", + 600: "#c026d3", + 700: "#a21caf", + 800: "#86198f", + 900: "#701a75", + 950: "#4a044e" + }, + pink: { + 50: "#fdf2f8", + 100: "#fce7f3", + 200: "#fbcfe8", + 300: "#f9a8d4", + 400: "#f472b6", + 500: "#ec4899", + 600: "#db2777", + 700: "#be185d", + 800: "#9d174d", + 900: "#831843", + 950: "#500724" + }, + rose: { + 50: "#fff1f2", + 100: "#ffe4e6", + 200: "#fecdd3", + 300: "#fda4af", + 400: "#fb7185", + 500: "#f43f5e", + 600: "#e11d48", + 700: "#be123c", + 800: "#9f1239", + 900: "#881337", + 950: "#4c0519" + } +}; +Hc.reduce( + (l, { color: e, primary: t, secondary: n }) => ({ + ...l, + [e]: { + primary: Ao[e][t], + secondary: Ao[e][n] + } + }), + {} +); +class zl extends Error { + constructor(e) { + super(e), this.name = "ShareError"; + } +} +async function Fc(l, e) { + var a; + if (window.__gradio_space__ == null) + throw new zl("Must be on Spaces to share."); + let t, n, i; + t = Xc(l), n = l.split(";")[0].split(":")[1], i = "file" + n.split("/")[1]; + const o = new File([t], i, { type: n }), s = await fetch("https://huggingface.co/uploads", { + method: "POST", + body: o, + headers: { + "Content-Type": o.type, + "X-Requested-With": "XMLHttpRequest" + } + }); + if (!s.ok) { + if ((a = s.headers.get("content-type")) != null && a.includes("application/json")) { + const f = await s.json(); + throw new zl(`Upload failed: ${f.error}`); + } + throw new zl("Upload failed."); + } + return await s.text(); +} +function Xc(l) { + for (var e = l.split(","), t = e[0].match(/:(.*?);/)[1], n = atob(e[1]), i = n.length, o = new Uint8Array(i); i--; ) + o[i] = n.charCodeAt(i); + return new Blob([o], { type: t }); +} +const { + SvelteComponent: Yc, + create_component: Nc, + destroy_component: Uc, + init: Oc, + mount_component: Wc, + safe_not_equal: Vc, + transition_in: Pc, + transition_out: Zc +} = window.__gradio__svelte__internal, { createEventDispatcher: Kc } = window.__gradio__svelte__internal; +function Gc(l) { + let e, t; + return e = new Vl({ + props: { + Icon: Iu, + label: ( + /*i18n*/ + l[2]("common.share") + ), + pending: ( + /*pending*/ + l[3] + ) + } + }), e.$on( + "click", + /*click_handler*/ + l[5] + ), { + c() { + Nc(e.$$.fragment); + }, + m(n, i) { + Wc(e, n, i), t = !0; + }, + p(n, [i]) { + const o = {}; + i & /*i18n*/ + 4 && (o.label = /*i18n*/ + n[2]("common.share")), i & /*pending*/ + 8 && (o.pending = /*pending*/ + n[3]), e.$set(o); + }, + i(n) { + t || (Pc(e.$$.fragment, n), t = !0); + }, + o(n) { + Zc(e.$$.fragment, n), t = !1; + }, + d(n) { + Uc(e, n); + } + }; +} +function Jc(l, e, t) { + const n = Kc(); + let { formatter: i } = e, { value: o } = e, { i18n: s } = e, r = !1; + const a = async () => { + try { + t(3, r = !0); + const f = await i(o); + n("share", { description: f }); + } catch (f) { + console.error(f); + let u = f instanceof zl ? f.message : "Share failed."; + n("error", u); + } finally { + t(3, r = !1); + } + }; + return l.$$set = (f) => { + "formatter" in f && t(0, i = f.formatter), "value" in f && t(1, o = f.value), "i18n" in f && t(2, s = f.i18n); + }, [i, o, s, r, n, a]; +} +class Qc extends Yc { + constructor(e) { + super(), Oc(this, e, Jc, Gc, Vc, { formatter: 0, value: 1, i18n: 2 }); + } +} +const { + SvelteComponent: xc, + append: Vt, + attr: Ni, + check_outros: $c, + create_component: ma, + destroy_component: ga, + detach: Bl, + element: Ui, + group_outros: e_, + init: t_, + insert: ql, + mount_component: ba, + safe_not_equal: n_, + set_data: Oi, + space: Wi, + text: Ln, + toggle_class: Lo, + transition_in: Dl, + transition_out: Rl +} = window.__gradio__svelte__internal; +function l_(l) { + let e, t; + return e = new da({}), { + c() { + ma(e.$$.fragment); + }, + m(n, i) { + ba(e, n, i), t = !0; + }, + i(n) { + t || (Dl(e.$$.fragment, n), t = !0); + }, + o(n) { + Rl(e.$$.fragment, n), t = !1; + }, + d(n) { + ga(e, n); + } + }; +} +function i_(l) { + let e, t; + return e = new _a({}), { + c() { + ma(e.$$.fragment); + }, + m(n, i) { + ba(e, n, i), t = !0; + }, + i(n) { + t || (Dl(e.$$.fragment, n), t = !0); + }, + o(n) { + Rl(e.$$.fragment, n), t = !1; + }, + d(n) { + ga(e, n); + } + }; +} +function Do(l) { + let e, t, n = ( + /*i18n*/ + l[1]("common.or") + "" + ), i, o, s, r = ( + /*message*/ + (l[2] || /*i18n*/ + l[1]("upload_text.click_to_upload")) + "" + ), a; + return { + c() { + e = Ui("span"), t = Ln("- "), i = Ln(n), o = Ln(" -"), s = Wi(), a = Ln(r), Ni(e, "class", "or svelte-kzcjhc"); + }, + m(f, u) { + ql(f, e, u), Vt(e, t), Vt(e, i), Vt(e, o), ql(f, s, u), ql(f, a, u); + }, + p(f, u) { + u & /*i18n*/ + 2 && n !== (n = /*i18n*/ + f[1]("common.or") + "") && Oi(i, n), u & /*message, i18n*/ + 6 && r !== (r = /*message*/ + (f[2] || /*i18n*/ + f[1]("upload_text.click_to_upload")) + "") && Oi(a, r); + }, + d(f) { + f && (Bl(e), Bl(s), Bl(a)); + } + }; +} +function o_(l) { + let e, t, n, i, o, s = ( + /*i18n*/ + l[1]( + /*defs*/ + l[5][ + /*type*/ + l[0] + ] || /*defs*/ + l[5].file + ) + "" + ), r, a, f; + const u = [i_, l_], c = []; + function _(h, m) { + return ( + /*type*/ + h[0] === "clipboard" ? 0 : 1 + ); + } + n = _(l), i = c[n] = u[n](l); + let d = ( + /*mode*/ + l[3] !== "short" && Do(l) + ); + return { + c() { + e = Ui("div"), t = Ui("span"), i.c(), o = Wi(), r = Ln(s), a = Wi(), d && d.c(), Ni(t, "class", "icon-wrap svelte-kzcjhc"), Lo( + t, + "hovered", + /*hovered*/ + l[4] + ), Ni(e, "class", "wrap svelte-kzcjhc"); + }, + m(h, m) { + ql(h, e, m), Vt(e, t), c[n].m(t, null), Vt(e, o), Vt(e, r), Vt(e, a), d && d.m(e, null), f = !0; + }, + p(h, [m]) { + let w = n; + n = _(h), n !== w && (e_(), Rl(c[w], 1, 1, () => { + c[w] = null; + }), $c(), i = c[n], i || (i = c[n] = u[n](h), i.c()), Dl(i, 1), i.m(t, null)), (!f || m & /*hovered*/ + 16) && Lo( + t, + "hovered", + /*hovered*/ + h[4] + ), (!f || m & /*i18n, type*/ + 3) && s !== (s = /*i18n*/ + h[1]( + /*defs*/ + h[5][ + /*type*/ + h[0] + ] || /*defs*/ + h[5].file + ) + "") && Oi(r, s), /*mode*/ + h[3] !== "short" ? d ? d.p(h, m) : (d = Do(h), d.c(), d.m(e, null)) : d && (d.d(1), d = null); + }, + i(h) { + f || (Dl(i), f = !0); + }, + o(h) { + Rl(i), f = !1; + }, + d(h) { + h && Bl(e), c[n].d(), d && d.d(); + } + }; +} +function s_(l, e, t) { + let { type: n = "file" } = e, { i18n: i } = e, { message: o = void 0 } = e, { mode: s = "full" } = e, { hovered: r = !1 } = e; + const a = { + image: "upload_text.drop_image", + video: "upload_text.drop_video", + audio: "upload_text.drop_audio", + file: "upload_text.drop_file", + csv: "upload_text.drop_csv", + gallery: "upload_text.drop_gallery", + clipboard: "upload_text.paste_clipboard" + }; + return l.$$set = (f) => { + "type" in f && t(0, n = f.type), "i18n" in f && t(1, i = f.i18n), "message" in f && t(2, o = f.message), "mode" in f && t(3, s = f.mode), "hovered" in f && t(4, r = f.hovered); + }, [n, i, o, s, r, a]; +} +class wa extends xc { + constructor(e) { + super(), t_(this, e, s_, o_, n_, { + type: 0, + i18n: 1, + message: 2, + mode: 3, + hovered: 4 + }); + } +} +const { + SvelteComponent: a_, + append: Ci, + attr: ot, + check_outros: Dn, + create_component: Pl, + destroy_component: Zl, + detach: wn, + element: el, + empty: r_, + group_outros: Rn, + init: f_, + insert: pn, + listen: Kl, + mount_component: Gl, + safe_not_equal: u_, + space: Si, + toggle_class: At, + transition_in: fe, + transition_out: ze +} = window.__gradio__svelte__internal; +function Ro(l) { + let e, t = ( + /*sources*/ + l[1].includes("upload") + ), n, i = ( + /*sources*/ + l[1].includes("microphone") + ), o, s = ( + /*sources*/ + l[1].includes("webcam") + ), r, a = ( + /*sources*/ + l[1].includes("clipboard") + ), f, u = t && To(l), c = i && Io(l), _ = s && jo(l), d = a && Ho(l); + return { + c() { + e = el("span"), u && u.c(), n = Si(), c && c.c(), o = Si(), _ && _.c(), r = Si(), d && d.c(), ot(e, "class", "source-selection svelte-1jp3vgd"), ot(e, "data-testid", "source-select"); + }, + m(h, m) { + pn(h, e, m), u && u.m(e, null), Ci(e, n), c && c.m(e, null), Ci(e, o), _ && _.m(e, null), Ci(e, r), d && d.m(e, null), f = !0; + }, + p(h, m) { + m & /*sources*/ + 2 && (t = /*sources*/ + h[1].includes("upload")), t ? u ? (u.p(h, m), m & /*sources*/ + 2 && fe(u, 1)) : (u = To(h), u.c(), fe(u, 1), u.m(e, n)) : u && (Rn(), ze(u, 1, 1, () => { + u = null; + }), Dn()), m & /*sources*/ + 2 && (i = /*sources*/ + h[1].includes("microphone")), i ? c ? (c.p(h, m), m & /*sources*/ + 2 && fe(c, 1)) : (c = Io(h), c.c(), fe(c, 1), c.m(e, o)) : c && (Rn(), ze(c, 1, 1, () => { + c = null; + }), Dn()), m & /*sources*/ + 2 && (s = /*sources*/ + h[1].includes("webcam")), s ? _ ? (_.p(h, m), m & /*sources*/ + 2 && fe(_, 1)) : (_ = jo(h), _.c(), fe(_, 1), _.m(e, r)) : _ && (Rn(), ze(_, 1, 1, () => { + _ = null; + }), Dn()), m & /*sources*/ + 2 && (a = /*sources*/ + h[1].includes("clipboard")), a ? d ? (d.p(h, m), m & /*sources*/ + 2 && fe(d, 1)) : (d = Ho(h), d.c(), fe(d, 1), d.m(e, null)) : d && (Rn(), ze(d, 1, 1, () => { + d = null; + }), Dn()); + }, + i(h) { + f || (fe(u), fe(c), fe(_), fe(d), f = !0); + }, + o(h) { + ze(u), ze(c), ze(_), ze(d), f = !1; + }, + d(h) { + h && wn(e), u && u.d(), c && c.d(), _ && _.d(), d && d.d(); + } + }; +} +function To(l) { + let e, t, n, i, o; + return t = new da({}), { + c() { + e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Upload file"), At( + e, + "selected", + /*active_source*/ + l[0] === "upload" || !/*active_source*/ + l[0] + ); + }, + m(s, r) { + pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( + e, + "click", + /*click_handler*/ + l[6] + ), i = !0); + }, + p(s, r) { + (!n || r & /*active_source*/ + 1) && At( + e, + "selected", + /*active_source*/ + s[0] === "upload" || !/*active_source*/ + s[0] + ); + }, + i(s) { + n || (fe(t.$$.fragment, s), n = !0); + }, + o(s) { + ze(t.$$.fragment, s), n = !1; + }, + d(s) { + s && wn(e), Zl(t), i = !1, o(); + } + }; +} +function Io(l) { + let e, t, n, i, o; + return t = new gc({}), { + c() { + e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Record audio"), At( + e, + "selected", + /*active_source*/ + l[0] === "microphone" + ); + }, + m(s, r) { + pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( + e, + "click", + /*click_handler_1*/ + l[7] + ), i = !0); + }, + p(s, r) { + (!n || r & /*active_source*/ + 1) && At( + e, + "selected", + /*active_source*/ + s[0] === "microphone" + ); + }, + i(s) { + n || (fe(t.$$.fragment, s), n = !0); + }, + o(s) { + ze(t.$$.fragment, s), n = !1; + }, + d(s) { + s && wn(e), Zl(t), i = !1, o(); + } + }; +} +function jo(l) { + let e, t, n, i, o; + return t = new ha({}), { + c() { + e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Capture from camera"), At( + e, + "selected", + /*active_source*/ + l[0] === "webcam" + ); + }, + m(s, r) { + pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( + e, + "click", + /*click_handler_2*/ + l[8] + ), i = !0); + }, + p(s, r) { + (!n || r & /*active_source*/ + 1) && At( + e, + "selected", + /*active_source*/ + s[0] === "webcam" + ); + }, + i(s) { + n || (fe(t.$$.fragment, s), n = !0); + }, + o(s) { + ze(t.$$.fragment, s), n = !1; + }, + d(s) { + s && wn(e), Zl(t), i = !1, o(); + } + }; +} +function Ho(l) { + let e, t, n, i, o; + return t = new _a({}), { + c() { + e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Paste from clipboard"), At( + e, + "selected", + /*active_source*/ + l[0] === "clipboard" + ); + }, + m(s, r) { + pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( + e, + "click", + /*click_handler_3*/ + l[9] + ), i = !0); + }, + p(s, r) { + (!n || r & /*active_source*/ + 1) && At( + e, + "selected", + /*active_source*/ + s[0] === "clipboard" + ); + }, + i(s) { + n || (fe(t.$$.fragment, s), n = !0); + }, + o(s) { + ze(t.$$.fragment, s), n = !1; + }, + d(s) { + s && wn(e), Zl(t), i = !1, o(); + } + }; +} +function c_(l) { + let e, t, n = ( + /*unique_sources*/ + l[2].length > 1 && Ro(l) + ); + return { + c() { + n && n.c(), e = r_(); + }, + m(i, o) { + n && n.m(i, o), pn(i, e, o), t = !0; + }, + p(i, [o]) { + /*unique_sources*/ + i[2].length > 1 ? n ? (n.p(i, o), o & /*unique_sources*/ + 4 && fe(n, 1)) : (n = Ro(i), n.c(), fe(n, 1), n.m(e.parentNode, e)) : n && (Rn(), ze(n, 1, 1, () => { + n = null; + }), Dn()); + }, + i(i) { + t || (fe(n), t = !0); + }, + o(i) { + ze(n), t = !1; + }, + d(i) { + i && wn(e), n && n.d(i); + } + }; +} +function __(l, e, t) { + let n; + var i = this && this.__awaiter || function(h, m, w, b) { + function p(g) { + return g instanceof w ? g : new w(function(v) { + v(g); + }); + } + return new (w || (w = Promise))(function(g, v) { + function E(k) { + try { + C(b.next(k)); + } catch (A) { + v(A); + } + } + function y(k) { + try { + C(b.throw(k)); + } catch (A) { + v(A); + } + } + function C(k) { + k.done ? g(k.value) : p(k.value).then(E, y); + } + C((b = b.apply(h, m || [])).next()); + }); + }; + let { sources: o } = e, { active_source: s } = e, { handle_clear: r = () => { + } } = e, { handle_select: a = () => { + } } = e; + function f(h) { + return i(this, void 0, void 0, function* () { + r(), t(0, s = h), a(h); + }); + } + const u = () => f("upload"), c = () => f("microphone"), _ = () => f("webcam"), d = () => f("clipboard"); + return l.$$set = (h) => { + "sources" in h && t(1, o = h.sources), "active_source" in h && t(0, s = h.active_source), "handle_clear" in h && t(4, r = h.handle_clear), "handle_select" in h && t(5, a = h.handle_select); + }, l.$$.update = () => { + l.$$.dirty & /*sources*/ + 2 && t(2, n = [...new Set(o)]); + }, [ + s, + o, + n, + f, + r, + a, + u, + c, + _, + d + ]; +} +class d_ extends a_ { + constructor(e) { + super(), f_(this, e, __, c_, u_, { + sources: 1, + active_source: 0, + handle_clear: 4, + handle_select: 5 + }); + } +} +function dn(l) { + let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0; + for (; l > 1e3 && t < e.length - 1; ) + l /= 1e3, t++; + let n = e[t]; + return (Number.isInteger(l) ? l : l.toFixed(1)) + n; +} +function El() { +} +const h_ = (l) => l; +function m_(l, e) { + return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function"; +} +function Fo(l) { + const e = typeof l == "string" && l.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); + return e ? [parseFloat(e[1]), e[2] || "px"] : [ + /** @type {number} */ + l, + "px" + ]; +} +const pa = typeof window < "u"; +let Xo = pa ? () => window.performance.now() : () => Date.now(), va = pa ? (l) => requestAnimationFrame(l) : El; +const gn = /* @__PURE__ */ new Set(); +function ka(l) { + gn.forEach((e) => { + e.c(l) || (gn.delete(e), e.f()); + }), gn.size !== 0 && va(ka); +} +function g_(l) { + let e; + return gn.size === 0 && va(ka), { + promise: new Promise((t) => { + gn.add(e = { c: l, f: t }); + }), + abort() { + gn.delete(e); + } + }; +} +function b_(l) { + const e = l - 1; + return e * e * e + 1; +} +function w_(l, { delay: e = 0, duration: t = 400, easing: n = h_ } = {}) { + const i = +getComputedStyle(l).opacity; + return { + delay: e, + duration: t, + easing: n, + css: (o) => `opacity: ${o * i}` + }; +} +function Yo(l, { delay: e = 0, duration: t = 400, easing: n = b_, x: i = 0, y: o = 0, opacity: s = 0 } = {}) { + const r = getComputedStyle(l), a = +r.opacity, f = r.transform === "none" ? "" : r.transform, u = a * (1 - s), [c, _] = Fo(i), [d, h] = Fo(o); + return { + delay: e, + duration: t, + easing: n, + css: (m, w) => ` + transform: ${f} translate(${(1 - m) * c}${_}, ${(1 - m) * d}${h}); + opacity: ${a - u * w}` + }; +} +const an = []; +function p_(l, e = El) { + let t; + const n = /* @__PURE__ */ new Set(); + function i(r) { + if (m_(l, r) && (l = r, t)) { + const a = !an.length; + for (const f of n) + f[1](), an.push(f, l); + if (a) { + for (let f = 0; f < an.length; f += 2) + an[f][0](an[f + 1]); + an.length = 0; + } + } + } + function o(r) { + i(r(l)); + } + function s(r, a = El) { + const f = [r, a]; + return n.add(f), n.size === 1 && (t = e(i, o) || El), r(l), () => { + n.delete(f), n.size === 0 && t && (t(), t = null); + }; + } + return { set: i, update: o, subscribe: s }; +} +function No(l) { + return Object.prototype.toString.call(l) === "[object Date]"; +} +function Vi(l, e, t, n) { + if (typeof t == "number" || No(t)) { + const i = n - t, o = (t - e) / (l.dt || 1 / 60), s = l.opts.stiffness * i, r = l.opts.damping * o, a = (s - r) * l.inv_mass, f = (o + a) * l.dt; + return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, No(t) ? new Date(t.getTime() + f) : t + f); + } else { + if (Array.isArray(t)) + return t.map( + (i, o) => Vi(l, e[o], t[o], n[o]) + ); + if (typeof t == "object") { + const i = {}; + for (const o in t) + i[o] = Vi(l, e[o], t[o], n[o]); + return i; + } else + throw new Error(`Cannot spring ${typeof t} values`); + } +} +function Uo(l, e = {}) { + const t = p_(l), { stiffness: n = 0.15, damping: i = 0.8, precision: o = 0.01 } = e; + let s, r, a, f = l, u = l, c = 1, _ = 0, d = !1; + function h(w, b = {}) { + u = w; + const p = a = {}; + return l == null || b.hard || m.stiffness >= 1 && m.damping >= 1 ? (d = !0, s = Xo(), f = w, t.set(l = u), Promise.resolve()) : (b.soft && (_ = 1 / ((b.soft === !0 ? 0.5 : +b.soft) * 60), c = 0), r || (s = Xo(), d = !1, r = g_((g) => { + if (d) + return d = !1, r = null, !1; + c = Math.min(c + _, 1); + const v = { + inv_mass: c, + opts: m, + settled: !0, + dt: (g - s) * 60 / 1e3 + }, E = Vi(v, f, l, u); + return s = g, f = l, t.set(l = E), v.settled && (r = null), !v.settled; + })), new Promise((g) => { + r.promise.then(() => { + p === a && g(); + }); + })); + } + const m = { + set: h, + update: (w, b) => h(w(u, l), b), + subscribe: t.subscribe, + stiffness: n, + damping: i, + precision: o + }; + return m; +} +const { + SvelteComponent: v_, + append: Ve, + attr: O, + component_subscribe: Oo, + detach: k_, + element: y_, + init: C_, + insert: S_, + noop: Wo, + safe_not_equal: z_, + set_style: cl, + svg_element: Pe, + toggle_class: Vo +} = window.__gradio__svelte__internal, { onMount: B_ } = window.__gradio__svelte__internal; +function q_(l) { + let e, t, n, i, o, s, r, a, f, u, c, _; + return { + c() { + e = y_("div"), t = Pe("svg"), n = Pe("g"), i = Pe("path"), o = Pe("path"), s = Pe("path"), r = Pe("path"), a = Pe("g"), f = Pe("path"), u = Pe("path"), c = Pe("path"), _ = Pe("path"), O(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), O(i, "fill", "#FF7C00"), O(i, "fill-opacity", "0.4"), O(i, "class", "svelte-43sxxs"), O(o, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), O(o, "fill", "#FF7C00"), O(o, "class", "svelte-43sxxs"), O(s, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), O(s, "fill", "#FF7C00"), O(s, "fill-opacity", "0.4"), O(s, "class", "svelte-43sxxs"), O(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), O(r, "fill", "#FF7C00"), O(r, "class", "svelte-43sxxs"), cl(n, "transform", "translate(" + /*$top*/ + l[1][0] + "px, " + /*$top*/ + l[1][1] + "px)"), O(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), O(f, "fill", "#FF7C00"), O(f, "fill-opacity", "0.4"), O(f, "class", "svelte-43sxxs"), O(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), O(u, "fill", "#FF7C00"), O(u, "class", "svelte-43sxxs"), O(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), O(c, "fill", "#FF7C00"), O(c, "fill-opacity", "0.4"), O(c, "class", "svelte-43sxxs"), O(_, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), O(_, "fill", "#FF7C00"), O(_, "class", "svelte-43sxxs"), cl(a, "transform", "translate(" + /*$bottom*/ + l[2][0] + "px, " + /*$bottom*/ + l[2][1] + "px)"), O(t, "viewBox", "-1200 -1200 3000 3000"), O(t, "fill", "none"), O(t, "xmlns", "http://www.w3.org/2000/svg"), O(t, "class", "svelte-43sxxs"), O(e, "class", "svelte-43sxxs"), Vo( + e, + "margin", + /*margin*/ + l[0] + ); + }, + m(d, h) { + S_(d, e, h), Ve(e, t), Ve(t, n), Ve(n, i), Ve(n, o), Ve(n, s), Ve(n, r), Ve(t, a), Ve(a, f), Ve(a, u), Ve(a, c), Ve(a, _); + }, + p(d, [h]) { + h & /*$top*/ + 2 && cl(n, "transform", "translate(" + /*$top*/ + d[1][0] + "px, " + /*$top*/ + d[1][1] + "px)"), h & /*$bottom*/ + 4 && cl(a, "transform", "translate(" + /*$bottom*/ + d[2][0] + "px, " + /*$bottom*/ + d[2][1] + "px)"), h & /*margin*/ + 1 && Vo( + e, + "margin", + /*margin*/ + d[0] + ); + }, + i: Wo, + o: Wo, + d(d) { + d && k_(e); + } + }; +} +function E_(l, e, t) { + let n, i; + var o = this && this.__awaiter || function(d, h, m, w) { + function b(p) { + return p instanceof m ? p : new m(function(g) { + g(p); + }); + } + return new (m || (m = Promise))(function(p, g) { + function v(C) { + try { + y(w.next(C)); + } catch (k) { + g(k); + } + } + function E(C) { + try { + y(w.throw(C)); + } catch (k) { + g(k); + } + } + function y(C) { + C.done ? p(C.value) : b(C.value).then(v, E); + } + y((w = w.apply(d, h || [])).next()); + }); + }; + let { margin: s = !0 } = e; + const r = Uo([0, 0]); + Oo(l, r, (d) => t(1, n = d)); + const a = Uo([0, 0]); + Oo(l, a, (d) => t(2, i = d)); + let f; + function u() { + return o(this, void 0, void 0, function* () { + yield Promise.all([r.set([125, 140]), a.set([-125, -140])]), yield Promise.all([r.set([-125, 140]), a.set([125, -140])]), yield Promise.all([r.set([-125, 0]), a.set([125, -0])]), yield Promise.all([r.set([125, 0]), a.set([-125, 0])]); + }); + } + function c() { + return o(this, void 0, void 0, function* () { + yield u(), f || c(); + }); + } + function _() { + return o(this, void 0, void 0, function* () { + yield Promise.all([r.set([125, 0]), a.set([-125, 0])]), c(); + }); + } + return B_(() => (_(), () => f = !0)), l.$$set = (d) => { + "margin" in d && t(0, s = d.margin); + }, [s, n, i, r, a]; +} +class M_ extends v_ { + constructor(e) { + super(), C_(this, e, E_, q_, z_, { margin: 0 }); + } +} +const { + SvelteComponent: A_, + append: Pt, + attr: Je, + binding_callbacks: Po, + check_outros: Pi, + create_component: ya, + create_slot: Ca, + destroy_component: Sa, + destroy_each: za, + detach: X, + element: lt, + empty: vn, + ensure_array_like: Tl, + get_all_dirty_from_scope: Ba, + get_slot_changes: qa, + group_outros: Zi, + init: L_, + insert: Y, + mount_component: Ea, + noop: Ki, + safe_not_equal: D_, + set_data: Fe, + set_style: Et, + space: He, + text: le, + toggle_class: je, + transition_in: Ge, + transition_out: it, + update_slot_base: Ma +} = window.__gradio__svelte__internal, { tick: R_ } = window.__gradio__svelte__internal, { onDestroy: T_ } = window.__gradio__svelte__internal, { createEventDispatcher: I_ } = window.__gradio__svelte__internal, j_ = (l) => ({}), Zo = (l) => ({}), H_ = (l) => ({}), Ko = (l) => ({}); +function Go(l, e, t) { + const n = l.slice(); + return n[41] = e[t], n[43] = t, n; +} +function Jo(l, e, t) { + const n = l.slice(); + return n[41] = e[t], n; +} +function F_(l) { + let e, t, n, i, o = ( + /*i18n*/ + l[1]("common.error") + "" + ), s, r, a; + t = new Vl({ + props: { + Icon: ua, + label: ( + /*i18n*/ + l[1]("common.clear") + ), + disabled: !1 + } + }), t.$on( + "click", + /*click_handler*/ + l[32] + ); + const f = ( + /*#slots*/ + l[30].error + ), u = Ca( + f, + l, + /*$$scope*/ + l[29], + Zo + ); + return { + c() { + e = lt("div"), ya(t.$$.fragment), n = He(), i = lt("span"), s = le(o), r = He(), u && u.c(), Je(e, "class", "clear-status svelte-16nch4a"), Je(i, "class", "error svelte-16nch4a"); + }, + m(c, _) { + Y(c, e, _), Ea(t, e, null), Y(c, n, _), Y(c, i, _), Pt(i, s), Y(c, r, _), u && u.m(c, _), a = !0; + }, + p(c, _) { + const d = {}; + _[0] & /*i18n*/ + 2 && (d.label = /*i18n*/ + c[1]("common.clear")), t.$set(d), (!a || _[0] & /*i18n*/ + 2) && o !== (o = /*i18n*/ + c[1]("common.error") + "") && Fe(s, o), u && u.p && (!a || _[0] & /*$$scope*/ + 536870912) && Ma( + u, + f, + c, + /*$$scope*/ + c[29], + a ? qa( + f, + /*$$scope*/ + c[29], + _, + j_ + ) : Ba( + /*$$scope*/ + c[29] + ), + Zo + ); + }, + i(c) { + a || (Ge(t.$$.fragment, c), Ge(u, c), a = !0); + }, + o(c) { + it(t.$$.fragment, c), it(u, c), a = !1; + }, + d(c) { + c && (X(e), X(n), X(i), X(r)), Sa(t), u && u.d(c); + } + }; +} +function X_(l) { + let e, t, n, i, o, s, r, a, f, u = ( + /*variant*/ + l[8] === "default" && /*show_eta_bar*/ + l[18] && /*show_progress*/ + l[6] === "full" && Qo(l) + ); + function c(g, v) { + if ( + /*progress*/ + g[7] + ) return U_; + if ( + /*queue_position*/ + g[2] !== null && /*queue_size*/ + g[3] !== void 0 && /*queue_position*/ + g[2] >= 0 + ) return N_; + if ( + /*queue_position*/ + g[2] === 0 + ) return Y_; + } + let _ = c(l), d = _ && _(l), h = ( + /*timer*/ + l[5] && es(l) + ); + const m = [P_, V_], w = []; + function b(g, v) { + return ( + /*last_progress_level*/ + g[15] != null ? 0 : ( + /*show_progress*/ + g[6] === "full" ? 1 : -1 + ) + ); + } + ~(o = b(l)) && (s = w[o] = m[o](l)); + let p = !/*timer*/ + l[5] && as(l); + return { + c() { + u && u.c(), e = He(), t = lt("div"), d && d.c(), n = He(), h && h.c(), i = He(), s && s.c(), r = He(), p && p.c(), a = vn(), Je(t, "class", "progress-text svelte-16nch4a"), je( + t, + "meta-text-center", + /*variant*/ + l[8] === "center" + ), je( + t, + "meta-text", + /*variant*/ + l[8] === "default" + ); + }, + m(g, v) { + u && u.m(g, v), Y(g, e, v), Y(g, t, v), d && d.m(t, null), Pt(t, n), h && h.m(t, null), Y(g, i, v), ~o && w[o].m(g, v), Y(g, r, v), p && p.m(g, v), Y(g, a, v), f = !0; + }, + p(g, v) { + /*variant*/ + g[8] === "default" && /*show_eta_bar*/ + g[18] && /*show_progress*/ + g[6] === "full" ? u ? u.p(g, v) : (u = Qo(g), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), _ === (_ = c(g)) && d ? d.p(g, v) : (d && d.d(1), d = _ && _(g), d && (d.c(), d.m(t, n))), /*timer*/ + g[5] ? h ? h.p(g, v) : (h = es(g), h.c(), h.m(t, null)) : h && (h.d(1), h = null), (!f || v[0] & /*variant*/ + 256) && je( + t, + "meta-text-center", + /*variant*/ + g[8] === "center" + ), (!f || v[0] & /*variant*/ + 256) && je( + t, + "meta-text", + /*variant*/ + g[8] === "default" + ); + let E = o; + o = b(g), o === E ? ~o && w[o].p(g, v) : (s && (Zi(), it(w[E], 1, 1, () => { + w[E] = null; + }), Pi()), ~o ? (s = w[o], s ? s.p(g, v) : (s = w[o] = m[o](g), s.c()), Ge(s, 1), s.m(r.parentNode, r)) : s = null), /*timer*/ + g[5] ? p && (Zi(), it(p, 1, 1, () => { + p = null; + }), Pi()) : p ? (p.p(g, v), v[0] & /*timer*/ + 32 && Ge(p, 1)) : (p = as(g), p.c(), Ge(p, 1), p.m(a.parentNode, a)); + }, + i(g) { + f || (Ge(s), Ge(p), f = !0); + }, + o(g) { + it(s), it(p), f = !1; + }, + d(g) { + g && (X(e), X(t), X(i), X(r), X(a)), u && u.d(g), d && d.d(), h && h.d(), ~o && w[o].d(g), p && p.d(g); + } + }; +} +function Qo(l) { + let e, t = `translateX(${/*eta_level*/ + (l[17] || 0) * 100 - 100}%)`; + return { + c() { + e = lt("div"), Je(e, "class", "eta-bar svelte-16nch4a"), Et(e, "transform", t); + }, + m(n, i) { + Y(n, e, i); + }, + p(n, i) { + i[0] & /*eta_level*/ + 131072 && t !== (t = `translateX(${/*eta_level*/ + (n[17] || 0) * 100 - 100}%)`) && Et(e, "transform", t); + }, + d(n) { + n && X(e); + } + }; +} +function Y_(l) { + let e; + return { + c() { + e = le("processing |"); + }, + m(t, n) { + Y(t, e, n); + }, + p: Ki, + d(t) { + t && X(e); + } + }; +} +function N_(l) { + let e, t = ( + /*queue_position*/ + l[2] + 1 + "" + ), n, i, o, s; + return { + c() { + e = le("queue: "), n = le(t), i = le("/"), o = le( + /*queue_size*/ + l[3] + ), s = le(" |"); + }, + m(r, a) { + Y(r, e, a), Y(r, n, a), Y(r, i, a), Y(r, o, a), Y(r, s, a); + }, + p(r, a) { + a[0] & /*queue_position*/ + 4 && t !== (t = /*queue_position*/ + r[2] + 1 + "") && Fe(n, t), a[0] & /*queue_size*/ + 8 && Fe( + o, + /*queue_size*/ + r[3] + ); + }, + d(r) { + r && (X(e), X(n), X(i), X(o), X(s)); + } + }; +} +function U_(l) { + let e, t = Tl( + /*progress*/ + l[7] + ), n = []; + for (let i = 0; i < t.length; i += 1) + n[i] = $o(Jo(l, t, i)); + return { + c() { + for (let i = 0; i < n.length; i += 1) + n[i].c(); + e = vn(); + }, + m(i, o) { + for (let s = 0; s < n.length; s += 1) + n[s] && n[s].m(i, o); + Y(i, e, o); + }, + p(i, o) { + if (o[0] & /*progress*/ + 128) { + t = Tl( + /*progress*/ + i[7] + ); + let s; + for (s = 0; s < t.length; s += 1) { + const r = Jo(i, t, s); + n[s] ? n[s].p(r, o) : (n[s] = $o(r), n[s].c(), n[s].m(e.parentNode, e)); + } + for (; s < n.length; s += 1) + n[s].d(1); + n.length = t.length; + } + }, + d(i) { + i && X(e), za(n, i); + } + }; +} +function xo(l) { + let e, t = ( + /*p*/ + l[41].unit + "" + ), n, i, o = " ", s; + function r(u, c) { + return ( + /*p*/ + u[41].length != null ? W_ : O_ + ); + } + let a = r(l), f = a(l); + return { + c() { + f.c(), e = He(), n = le(t), i = le(" | "), s = le(o); + }, + m(u, c) { + f.m(u, c), Y(u, e, c), Y(u, n, c), Y(u, i, c), Y(u, s, c); + }, + p(u, c) { + a === (a = r(u)) && f ? f.p(u, c) : (f.d(1), f = a(u), f && (f.c(), f.m(e.parentNode, e))), c[0] & /*progress*/ + 128 && t !== (t = /*p*/ + u[41].unit + "") && Fe(n, t); + }, + d(u) { + u && (X(e), X(n), X(i), X(s)), f.d(u); + } + }; +} +function O_(l) { + let e = dn( + /*p*/ + l[41].index || 0 + ) + "", t; + return { + c() { + t = le(e); + }, + m(n, i) { + Y(n, t, i); + }, + p(n, i) { + i[0] & /*progress*/ + 128 && e !== (e = dn( + /*p*/ + n[41].index || 0 + ) + "") && Fe(t, e); + }, + d(n) { + n && X(t); + } + }; +} +function W_(l) { + let e = dn( + /*p*/ + l[41].index || 0 + ) + "", t, n, i = dn( + /*p*/ + l[41].length + ) + "", o; + return { + c() { + t = le(e), n = le("/"), o = le(i); + }, + m(s, r) { + Y(s, t, r), Y(s, n, r), Y(s, o, r); + }, + p(s, r) { + r[0] & /*progress*/ + 128 && e !== (e = dn( + /*p*/ + s[41].index || 0 + ) + "") && Fe(t, e), r[0] & /*progress*/ + 128 && i !== (i = dn( + /*p*/ + s[41].length + ) + "") && Fe(o, i); + }, + d(s) { + s && (X(t), X(n), X(o)); + } + }; +} +function $o(l) { + let e, t = ( + /*p*/ + l[41].index != null && xo(l) + ); + return { + c() { + t && t.c(), e = vn(); + }, + m(n, i) { + t && t.m(n, i), Y(n, e, i); + }, + p(n, i) { + /*p*/ + n[41].index != null ? t ? t.p(n, i) : (t = xo(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); + }, + d(n) { + n && X(e), t && t.d(n); + } + }; +} +function es(l) { + let e, t = ( + /*eta*/ + l[0] ? `/${/*formatted_eta*/ + l[19]}` : "" + ), n, i; + return { + c() { + e = le( + /*formatted_timer*/ + l[20] + ), n = le(t), i = le("s"); + }, + m(o, s) { + Y(o, e, s), Y(o, n, s), Y(o, i, s); + }, + p(o, s) { + s[0] & /*formatted_timer*/ + 1048576 && Fe( + e, + /*formatted_timer*/ + o[20] + ), s[0] & /*eta, formatted_eta*/ + 524289 && t !== (t = /*eta*/ + o[0] ? `/${/*formatted_eta*/ + o[19]}` : "") && Fe(n, t); + }, + d(o) { + o && (X(e), X(n), X(i)); + } + }; +} +function V_(l) { + let e, t; + return e = new M_({ + props: { margin: ( + /*variant*/ + l[8] === "default" + ) } + }), { + c() { + ya(e.$$.fragment); + }, + m(n, i) { + Ea(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*variant*/ + 256 && (o.margin = /*variant*/ + n[8] === "default"), e.$set(o); + }, + i(n) { + t || (Ge(e.$$.fragment, n), t = !0); + }, + o(n) { + it(e.$$.fragment, n), t = !1; + }, + d(n) { + Sa(e, n); + } + }; +} +function P_(l) { + let e, t, n, i, o, s = `${/*last_progress_level*/ + l[15] * 100}%`, r = ( + /*progress*/ + l[7] != null && ts(l) + ); + return { + c() { + e = lt("div"), t = lt("div"), r && r.c(), n = He(), i = lt("div"), o = lt("div"), Je(t, "class", "progress-level-inner svelte-16nch4a"), Je(o, "class", "progress-bar svelte-16nch4a"), Et(o, "width", s), Je(i, "class", "progress-bar-wrap svelte-16nch4a"), Je(e, "class", "progress-level svelte-16nch4a"); + }, + m(a, f) { + Y(a, e, f), Pt(e, t), r && r.m(t, null), Pt(e, n), Pt(e, i), Pt(i, o), l[31](o); + }, + p(a, f) { + /*progress*/ + a[7] != null ? r ? r.p(a, f) : (r = ts(a), r.c(), r.m(t, null)) : r && (r.d(1), r = null), f[0] & /*last_progress_level*/ + 32768 && s !== (s = `${/*last_progress_level*/ + a[15] * 100}%`) && Et(o, "width", s); + }, + i: Ki, + o: Ki, + d(a) { + a && X(e), r && r.d(), l[31](null); + } + }; +} +function ts(l) { + let e, t = Tl( + /*progress*/ + l[7] + ), n = []; + for (let i = 0; i < t.length; i += 1) + n[i] = ss(Go(l, t, i)); + return { + c() { + for (let i = 0; i < n.length; i += 1) + n[i].c(); + e = vn(); + }, + m(i, o) { + for (let s = 0; s < n.length; s += 1) + n[s] && n[s].m(i, o); + Y(i, e, o); + }, + p(i, o) { + if (o[0] & /*progress_level, progress*/ + 16512) { + t = Tl( + /*progress*/ + i[7] + ); + let s; + for (s = 0; s < t.length; s += 1) { + const r = Go(i, t, s); + n[s] ? n[s].p(r, o) : (n[s] = ss(r), n[s].c(), n[s].m(e.parentNode, e)); + } + for (; s < n.length; s += 1) + n[s].d(1); + n.length = t.length; + } + }, + d(i) { + i && X(e), za(n, i); + } + }; +} +function ns(l) { + let e, t, n, i, o = ( + /*i*/ + l[43] !== 0 && Z_() + ), s = ( + /*p*/ + l[41].desc != null && ls(l) + ), r = ( + /*p*/ + l[41].desc != null && /*progress_level*/ + l[14] && /*progress_level*/ + l[14][ + /*i*/ + l[43] + ] != null && is() + ), a = ( + /*progress_level*/ + l[14] != null && os(l) + ); + return { + c() { + o && o.c(), e = He(), s && s.c(), t = He(), r && r.c(), n = He(), a && a.c(), i = vn(); + }, + m(f, u) { + o && o.m(f, u), Y(f, e, u), s && s.m(f, u), Y(f, t, u), r && r.m(f, u), Y(f, n, u), a && a.m(f, u), Y(f, i, u); + }, + p(f, u) { + /*p*/ + f[41].desc != null ? s ? s.p(f, u) : (s = ls(f), s.c(), s.m(t.parentNode, t)) : s && (s.d(1), s = null), /*p*/ + f[41].desc != null && /*progress_level*/ + f[14] && /*progress_level*/ + f[14][ + /*i*/ + f[43] + ] != null ? r || (r = is(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/ + f[14] != null ? a ? a.p(f, u) : (a = os(f), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null); + }, + d(f) { + f && (X(e), X(t), X(n), X(i)), o && o.d(f), s && s.d(f), r && r.d(f), a && a.d(f); + } + }; +} +function Z_(l) { + let e; + return { + c() { + e = le(" /"); + }, + m(t, n) { + Y(t, e, n); + }, + d(t) { + t && X(e); + } + }; +} +function ls(l) { + let e = ( + /*p*/ + l[41].desc + "" + ), t; + return { + c() { + t = le(e); + }, + m(n, i) { + Y(n, t, i); + }, + p(n, i) { + i[0] & /*progress*/ + 128 && e !== (e = /*p*/ + n[41].desc + "") && Fe(t, e); + }, + d(n) { + n && X(t); + } + }; +} +function is(l) { + let e; + return { + c() { + e = le("-"); + }, + m(t, n) { + Y(t, e, n); + }, + d(t) { + t && X(e); + } + }; +} +function os(l) { + let e = (100 * /*progress_level*/ + (l[14][ + /*i*/ + l[43] + ] || 0)).toFixed(1) + "", t, n; + return { + c() { + t = le(e), n = le("%"); + }, + m(i, o) { + Y(i, t, o), Y(i, n, o); + }, + p(i, o) { + o[0] & /*progress_level*/ + 16384 && e !== (e = (100 * /*progress_level*/ + (i[14][ + /*i*/ + i[43] + ] || 0)).toFixed(1) + "") && Fe(t, e); + }, + d(i) { + i && (X(t), X(n)); + } + }; +} +function ss(l) { + let e, t = ( + /*p*/ + (l[41].desc != null || /*progress_level*/ + l[14] && /*progress_level*/ + l[14][ + /*i*/ + l[43] + ] != null) && ns(l) + ); + return { + c() { + t && t.c(), e = vn(); + }, + m(n, i) { + t && t.m(n, i), Y(n, e, i); + }, + p(n, i) { + /*p*/ + n[41].desc != null || /*progress_level*/ + n[14] && /*progress_level*/ + n[14][ + /*i*/ + n[43] + ] != null ? t ? t.p(n, i) : (t = ns(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); + }, + d(n) { + n && X(e), t && t.d(n); + } + }; +} +function as(l) { + let e, t, n, i; + const o = ( + /*#slots*/ + l[30]["additional-loading-text"] + ), s = Ca( + o, + l, + /*$$scope*/ + l[29], + Ko + ); + return { + c() { + e = lt("p"), t = le( + /*loading_text*/ + l[9] + ), n = He(), s && s.c(), Je(e, "class", "loading svelte-16nch4a"); + }, + m(r, a) { + Y(r, e, a), Pt(e, t), Y(r, n, a), s && s.m(r, a), i = !0; + }, + p(r, a) { + (!i || a[0] & /*loading_text*/ + 512) && Fe( + t, + /*loading_text*/ + r[9] + ), s && s.p && (!i || a[0] & /*$$scope*/ + 536870912) && Ma( + s, + o, + r, + /*$$scope*/ + r[29], + i ? qa( + o, + /*$$scope*/ + r[29], + a, + H_ + ) : Ba( + /*$$scope*/ + r[29] + ), + Ko + ); + }, + i(r) { + i || (Ge(s, r), i = !0); + }, + o(r) { + it(s, r), i = !1; + }, + d(r) { + r && (X(e), X(n)), s && s.d(r); + } + }; +} +function K_(l) { + let e, t, n, i, o; + const s = [X_, F_], r = []; + function a(f, u) { + return ( + /*status*/ + f[4] === "pending" ? 0 : ( + /*status*/ + f[4] === "error" ? 1 : -1 + ) + ); + } + return ~(t = a(l)) && (n = r[t] = s[t](l)), { + c() { + e = lt("div"), n && n.c(), Je(e, "class", i = "wrap " + /*variant*/ + l[8] + " " + /*show_progress*/ + l[6] + " svelte-16nch4a"), je(e, "hide", !/*status*/ + l[4] || /*status*/ + l[4] === "complete" || /*show_progress*/ + l[6] === "hidden"), je( + e, + "translucent", + /*variant*/ + l[8] === "center" && /*status*/ + (l[4] === "pending" || /*status*/ + l[4] === "error") || /*translucent*/ + l[11] || /*show_progress*/ + l[6] === "minimal" + ), je( + e, + "generating", + /*status*/ + l[4] === "generating" + ), je( + e, + "border", + /*border*/ + l[12] + ), Et( + e, + "position", + /*absolute*/ + l[10] ? "absolute" : "static" + ), Et( + e, + "padding", + /*absolute*/ + l[10] ? "0" : "var(--size-8) 0" + ); + }, + m(f, u) { + Y(f, e, u), ~t && r[t].m(e, null), l[33](e), o = !0; + }, + p(f, u) { + let c = t; + t = a(f), t === c ? ~t && r[t].p(f, u) : (n && (Zi(), it(r[c], 1, 1, () => { + r[c] = null; + }), Pi()), ~t ? (n = r[t], n ? n.p(f, u) : (n = r[t] = s[t](f), n.c()), Ge(n, 1), n.m(e, null)) : n = null), (!o || u[0] & /*variant, show_progress*/ + 320 && i !== (i = "wrap " + /*variant*/ + f[8] + " " + /*show_progress*/ + f[6] + " svelte-16nch4a")) && Je(e, "class", i), (!o || u[0] & /*variant, show_progress, status, show_progress*/ + 336) && je(e, "hide", !/*status*/ + f[4] || /*status*/ + f[4] === "complete" || /*show_progress*/ + f[6] === "hidden"), (!o || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/ + 2384) && je( + e, + "translucent", + /*variant*/ + f[8] === "center" && /*status*/ + (f[4] === "pending" || /*status*/ + f[4] === "error") || /*translucent*/ + f[11] || /*show_progress*/ + f[6] === "minimal" + ), (!o || u[0] & /*variant, show_progress, status*/ + 336) && je( + e, + "generating", + /*status*/ + f[4] === "generating" + ), (!o || u[0] & /*variant, show_progress, border*/ + 4416) && je( + e, + "border", + /*border*/ + f[12] + ), u[0] & /*absolute*/ + 1024 && Et( + e, + "position", + /*absolute*/ + f[10] ? "absolute" : "static" + ), u[0] & /*absolute*/ + 1024 && Et( + e, + "padding", + /*absolute*/ + f[10] ? "0" : "var(--size-8) 0" + ); + }, + i(f) { + o || (Ge(n), o = !0); + }, + o(f) { + it(n), o = !1; + }, + d(f) { + f && X(e), ~t && r[t].d(), l[33](null); + } + }; +} +var G_ = function(l, e, t, n) { + function i(o) { + return o instanceof t ? o : new t(function(s) { + s(o); + }); + } + return new (t || (t = Promise))(function(o, s) { + function r(u) { + try { + f(n.next(u)); + } catch (c) { + s(c); + } + } + function a(u) { + try { + f(n.throw(u)); + } catch (c) { + s(c); + } + } + function f(u) { + u.done ? o(u.value) : i(u.value).then(r, a); + } + f((n = n.apply(l, e || [])).next()); + }); +}; +let _l = [], zi = !1; +function J_(l) { + return G_(this, arguments, void 0, function* (e, t = !0) { + if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) { + if (_l.push(e), !zi) zi = !0; + else return; + yield R_(), requestAnimationFrame(() => { + let n = [0, 0]; + for (let i = 0; i < _l.length; i++) { + const s = _l[i].getBoundingClientRect(); + (i === 0 || s.top + window.scrollY <= n[0]) && (n[0] = s.top + window.scrollY, n[1] = i); + } + window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), zi = !1, _l = []; + }); + } + }); +} +function Q_(l, e, t) { + let n, { $$slots: i = {}, $$scope: o } = e; + this && this.__awaiter; + const s = I_(); + let { i18n: r } = e, { eta: a = null } = e, { queue_position: f } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: _ = !1 } = e, { timer: d = !0 } = e, { show_progress: h = "full" } = e, { message: m = null } = e, { progress: w = null } = e, { variant: b = "default" } = e, { loading_text: p = "Loading..." } = e, { absolute: g = !0 } = e, { translucent: v = !1 } = e, { border: E = !1 } = e, { autoscroll: y } = e, C, k = !1, A = 0, S = 0, T = null, R = null, U = 0, Z = null, Q, J = null, K = !0; + const L = () => { + t(0, a = t(27, T = t(19, W = null))), t(25, A = performance.now()), t(26, S = 0), k = !0, F(); + }; + function F() { + requestAnimationFrame(() => { + t(26, S = (performance.now() - A) / 1e3), k && F(); + }); + } + function D() { + t(26, S = 0), t(0, a = t(27, T = t(19, W = null))), k && (k = !1); + } + T_(() => { + k && D(); + }); + let W = null; + function $(I) { + Po[I ? "unshift" : "push"](() => { + J = I, t(16, J), t(7, w), t(14, Z), t(15, Q); + }); + } + const oe = () => { + s("clear_status"); + }; + function ge(I) { + Po[I ? "unshift" : "push"](() => { + C = I, t(13, C); + }); + } + return l.$$set = (I) => { + "i18n" in I && t(1, r = I.i18n), "eta" in I && t(0, a = I.eta), "queue_position" in I && t(2, f = I.queue_position), "queue_size" in I && t(3, u = I.queue_size), "status" in I && t(4, c = I.status), "scroll_to_output" in I && t(22, _ = I.scroll_to_output), "timer" in I && t(5, d = I.timer), "show_progress" in I && t(6, h = I.show_progress), "message" in I && t(23, m = I.message), "progress" in I && t(7, w = I.progress), "variant" in I && t(8, b = I.variant), "loading_text" in I && t(9, p = I.loading_text), "absolute" in I && t(10, g = I.absolute), "translucent" in I && t(11, v = I.translucent), "border" in I && t(12, E = I.border), "autoscroll" in I && t(24, y = I.autoscroll), "$$scope" in I && t(29, o = I.$$scope); + }, l.$$.update = () => { + l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/ + 436207617 && (a === null && t(0, a = T), a != null && T !== a && (t(28, R = (performance.now() - A) / 1e3 + a), t(19, W = R.toFixed(1)), t(27, T = a))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/ + 335544320 && t(17, U = R === null || R <= 0 || !S ? null : Math.min(S / R, 1)), l.$$.dirty[0] & /*progress*/ + 128 && w != null && t(18, K = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/ + 114816 && (w != null ? t(14, Z = w.map((I) => { + if (I.index != null && I.length != null) + return I.index / I.length; + if (I.progress != null) + return I.progress; + })) : t(14, Z = null), Z ? (t(15, Q = Z[Z.length - 1]), J && (Q === 0 ? t(16, J.style.transition = "0", J) : t(16, J.style.transition = "150ms", J))) : t(15, Q = void 0)), l.$$.dirty[0] & /*status*/ + 16 && (c === "pending" ? L() : D()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/ + 20979728 && C && _ && (c === "pending" || c === "complete") && J_(C, y), l.$$.dirty[0] & /*status, message*/ + 8388624, l.$$.dirty[0] & /*timer_diff*/ + 67108864 && t(20, n = S.toFixed(1)); + }, [ + a, + r, + f, + u, + c, + d, + h, + w, + b, + p, + g, + v, + E, + C, + Z, + Q, + J, + U, + K, + W, + n, + s, + _, + m, + y, + A, + S, + T, + R, + o, + i, + $, + oe, + ge + ]; +} +class x_ extends A_ { + constructor(e) { + super(), L_( + this, + e, + Q_, + K_, + D_, + { + i18n: 1, + eta: 0, + queue_position: 2, + queue_size: 3, + status: 4, + scroll_to_output: 22, + timer: 5, + show_progress: 6, + message: 23, + progress: 7, + variant: 8, + loading_text: 9, + absolute: 10, + translucent: 11, + border: 12, + autoscroll: 24 + }, + null, + [-1, -1] + ); + } +} +const { setContext: Km, getContext: $_ } = window.__gradio__svelte__internal, ed = "WORKER_PROXY_CONTEXT_KEY"; +function Aa() { + return $_(ed); +} +function td(l) { + return l.host === window.location.host || l.host === "localhost:7860" || l.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 + l.host === "lite.local"; +} +function La(l, e) { + const t = e.toLowerCase(); + for (const [n, i] of Object.entries(l)) + if (n.toLowerCase() === t) + return i; +} +function Da(l) { + if (l == null) + return !1; + const e = new URL(l, window.location.href); + return !(!td(e) || e.protocol !== "http:" && e.protocol !== "https:"); +} +async function nd(l) { + if (l == null || !Da(l)) + return l; + const e = Aa(); + if (e == null) + return l; + const n = new URL(l, window.location.href).pathname; + return e.httpRequest({ + method: "GET", + path: n, + headers: {}, + query_string: "" + }).then((i) => { + if (i.status !== 200) + throw new Error(`Failed to get file ${n} from the Wasm worker.`); + const o = new Blob([i.body], { + type: La(i.headers, "content-type") + }); + return URL.createObjectURL(o); + }); +} +const { + SvelteComponent: ld, + assign: Il, + check_outros: Ra, + compute_rest_props: rs, + create_slot: oo, + detach: Jl, + element: Ta, + empty: Ia, + exclude_internal_props: id, + get_all_dirty_from_scope: so, + get_slot_changes: ao, + get_spread_update: ja, + group_outros: Ha, + init: od, + insert: Ql, + listen: Fa, + prevent_default: sd, + safe_not_equal: ad, + set_attributes: jl, + transition_in: Gt, + transition_out: Jt, + update_slot_base: ro +} = window.__gradio__svelte__internal, { createEventDispatcher: rd } = window.__gradio__svelte__internal; +function fd(l) { + let e, t, n, i, o; + const s = ( + /*#slots*/ + l[8].default + ), r = oo( + s, + l, + /*$$scope*/ + l[7], + null + ); + let a = [ + { href: ( + /*href*/ + l[0] + ) }, + { + target: t = typeof window < "u" && window.__is_colab__ ? "_blank" : null + }, + { rel: "noopener noreferrer" }, + { download: ( + /*download*/ + l[1] + ) }, + /*$$restProps*/ + l[6] + ], f = {}; + for (let u = 0; u < a.length; u += 1) + f = Il(f, a[u]); + return { + c() { + e = Ta("a"), r && r.c(), jl(e, f); + }, + m(u, c) { + Ql(u, e, c), r && r.m(e, null), n = !0, i || (o = Fa( + e, + "click", + /*dispatch*/ + l[3].bind(null, "click") + ), i = !0); + }, + p(u, c) { + r && r.p && (!n || c & /*$$scope*/ + 128) && ro( + r, + s, + u, + /*$$scope*/ + u[7], + n ? ao( + s, + /*$$scope*/ + u[7], + c, + null + ) : so( + /*$$scope*/ + u[7] + ), + null + ), jl(e, f = ja(a, [ + (!n || c & /*href*/ + 1) && { href: ( + /*href*/ + u[0] + ) }, + { target: t }, + { rel: "noopener noreferrer" }, + (!n || c & /*download*/ + 2) && { download: ( + /*download*/ + u[1] + ) }, + c & /*$$restProps*/ + 64 && /*$$restProps*/ + u[6] + ])); + }, + i(u) { + n || (Gt(r, u), n = !0); + }, + o(u) { + Jt(r, u), n = !1; + }, + d(u) { + u && Jl(e), r && r.d(u), i = !1, o(); + } + }; +} +function ud(l) { + let e, t, n, i; + const o = [_d, cd], s = []; + function r(a, f) { + return ( + /*is_downloading*/ + a[2] ? 0 : 1 + ); + } + return e = r(l), t = s[e] = o[e](l), { + c() { + t.c(), n = Ia(); + }, + m(a, f) { + s[e].m(a, f), Ql(a, n, f), i = !0; + }, + p(a, f) { + let u = e; + e = r(a), e === u ? s[e].p(a, f) : (Ha(), Jt(s[u], 1, 1, () => { + s[u] = null; + }), Ra(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), Gt(t, 1), t.m(n.parentNode, n)); + }, + i(a) { + i || (Gt(t), i = !0); + }, + o(a) { + Jt(t), i = !1; + }, + d(a) { + a && Jl(n), s[e].d(a); + } + }; +} +function cd(l) { + let e, t, n, i; + const o = ( + /*#slots*/ + l[8].default + ), s = oo( + o, + l, + /*$$scope*/ + l[7], + null + ); + let r = [ + /*$$restProps*/ + l[6], + { href: ( + /*href*/ + l[0] + ) } + ], a = {}; + for (let f = 0; f < r.length; f += 1) + a = Il(a, r[f]); + return { + c() { + e = Ta("a"), s && s.c(), jl(e, a); + }, + m(f, u) { + Ql(f, e, u), s && s.m(e, null), t = !0, n || (i = Fa(e, "click", sd( + /*wasm_click_handler*/ + l[5] + )), n = !0); + }, + p(f, u) { + s && s.p && (!t || u & /*$$scope*/ + 128) && ro( + s, + o, + f, + /*$$scope*/ + f[7], + t ? ao( + o, + /*$$scope*/ + f[7], + u, + null + ) : so( + /*$$scope*/ + f[7] + ), + null + ), jl(e, a = ja(r, [ + u & /*$$restProps*/ + 64 && /*$$restProps*/ + f[6], + (!t || u & /*href*/ + 1) && { href: ( + /*href*/ + f[0] + ) } + ])); + }, + i(f) { + t || (Gt(s, f), t = !0); + }, + o(f) { + Jt(s, f), t = !1; + }, + d(f) { + f && Jl(e), s && s.d(f), n = !1, i(); + } + }; +} +function _d(l) { + let e; + const t = ( + /*#slots*/ + l[8].default + ), n = oo( + t, + l, + /*$$scope*/ + l[7], + null + ); + return { + c() { + n && n.c(); + }, + m(i, o) { + n && n.m(i, o), e = !0; + }, + p(i, o) { + n && n.p && (!e || o & /*$$scope*/ + 128) && ro( + n, + t, + i, + /*$$scope*/ + i[7], + e ? ao( + t, + /*$$scope*/ + i[7], + o, + null + ) : so( + /*$$scope*/ + i[7] + ), + null + ); + }, + i(i) { + e || (Gt(n, i), e = !0); + }, + o(i) { + Jt(n, i), e = !1; + }, + d(i) { + n && n.d(i); + } + }; +} +function dd(l) { + let e, t, n, i, o; + const s = [ud, fd], r = []; + function a(f, u) { + return u & /*href*/ + 1 && (e = null), e == null && (e = !!/*worker_proxy*/ + (f[4] && Da( + /*href*/ + f[0] + ))), e ? 0 : 1; + } + return t = a(l, -1), n = r[t] = s[t](l), { + c() { + n.c(), i = Ia(); + }, + m(f, u) { + r[t].m(f, u), Ql(f, i, u), o = !0; + }, + p(f, [u]) { + let c = t; + t = a(f, u), t === c ? r[t].p(f, u) : (Ha(), Jt(r[c], 1, 1, () => { + r[c] = null; + }), Ra(), n = r[t], n ? n.p(f, u) : (n = r[t] = s[t](f), n.c()), Gt(n, 1), n.m(i.parentNode, i)); + }, + i(f) { + o || (Gt(n), o = !0); + }, + o(f) { + Jt(n), o = !1; + }, + d(f) { + f && Jl(i), r[t].d(f); + } + }; +} +function hd(l, e, t) { + const n = ["href", "download"]; + let i = rs(e, n), { $$slots: o = {}, $$scope: s } = e; + var r = this && this.__awaiter || function(h, m, w, b) { + function p(g) { + return g instanceof w ? g : new w(function(v) { + v(g); + }); + } + return new (w || (w = Promise))(function(g, v) { + function E(k) { + try { + C(b.next(k)); + } catch (A) { + v(A); + } + } + function y(k) { + try { + C(b.throw(k)); + } catch (A) { + v(A); + } + } + function C(k) { + k.done ? g(k.value) : p(k.value).then(E, y); + } + C((b = b.apply(h, m || [])).next()); + }); + }; + let { href: a = void 0 } = e, { download: f } = e; + const u = rd(); + let c = !1; + const _ = Aa(); + function d() { + return r(this, void 0, void 0, function* () { + if (c) + return; + if (u("click"), a == null) + throw new Error("href is not defined."); + if (_ == null) + throw new Error("Wasm worker proxy is not available."); + const m = new URL(a, window.location.href).pathname; + t(2, c = !0), _.httpRequest({ + method: "GET", + path: m, + headers: {}, + query_string: "" + }).then((w) => { + if (w.status !== 200) + throw new Error(`Failed to get file ${m} from the Wasm worker.`); + const b = new Blob( + [w.body], + { + type: La(w.headers, "content-type") + } + ), p = URL.createObjectURL(b), g = document.createElement("a"); + g.href = p, g.download = f, g.click(), URL.revokeObjectURL(p); + }).finally(() => { + t(2, c = !1); + }); + }); + } + return l.$$set = (h) => { + e = Il(Il({}, e), id(h)), t(6, i = rs(e, n)), "href" in h && t(0, a = h.href), "download" in h && t(1, f = h.download), "$$scope" in h && t(7, s = h.$$scope); + }, [ + a, + f, + c, + u, + _, + d, + i, + s, + o + ]; +} +class md extends ld { + constructor(e) { + super(), od(this, e, hd, dd, ad, { href: 0, download: 1 }); + } +} +var gd = Object.defineProperty, bd = (l, e, t) => e in l ? gd(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, at = (l, e, t) => (bd(l, typeof e != "symbol" ? e + "" : e, t), t), Xa = (l, e, t) => { + if (!e.has(l)) + throw TypeError("Cannot " + t); +}, qn = (l, e, t) => (Xa(l, e, "read from private field"), t ? t.call(l) : e.get(l)), wd = (l, e, t) => { + if (e.has(l)) + throw TypeError("Cannot add the same private member more than once"); + e instanceof WeakSet ? e.add(l) : e.set(l, t); +}, pd = (l, e, t, n) => (Xa(l, e, "write to private field"), e.set(l, t), t), zt; +new Intl.Collator(0, { numeric: 1 }).compare; +async function Ya(l, e) { + return l.map( + (t) => new vd({ + path: t.name, + orig_name: t.name, + blob: t, + size: t.size, + mime_type: t.type, + is_stream: e + }) + ); +} +class vd { + constructor({ + path: e, + url: t, + orig_name: n, + size: i, + blob: o, + is_stream: s, + mime_type: r, + alt_text: a + }) { + at(this, "path"), at(this, "url"), at(this, "orig_name"), at(this, "size"), at(this, "blob"), at(this, "is_stream"), at(this, "mime_type"), at(this, "alt_text"), at(this, "meta", { _type: "gradio.FileData" }), this.path = e, this.url = t, this.orig_name = n, this.size = i, this.blob = t ? void 0 : o, this.is_stream = s, this.mime_type = r, this.alt_text = a; + } +} +typeof process < "u" && process.versions && process.versions.node; +class Gm extends TransformStream { + /** Constructs a new instance. */ + constructor(e = { allowCR: !1 }) { + super({ + transform: (t, n) => { + for (t = qn(this, zt) + t; ; ) { + const i = t.indexOf(` +`), o = e.allowCR ? t.indexOf("\r") : -1; + if (o !== -1 && o !== t.length - 1 && (i === -1 || i - 1 > o)) { + n.enqueue(t.slice(0, o)), t = t.slice(o + 1); + continue; + } + if (i === -1) + break; + const s = t[i - 1] === "\r" ? i - 1 : i; + n.enqueue(t.slice(0, s)), t = t.slice(i + 1); + } + pd(this, zt, t); + }, + flush: (t) => { + if (qn(this, zt) === "") + return; + const n = e.allowCR && qn(this, zt).endsWith("\r") ? qn(this, zt).slice(0, -1) : qn(this, zt); + t.enqueue(n); + } + }), wd(this, zt, ""); + } +} +zt = /* @__PURE__ */ new WeakMap(); +const { + SvelteComponent: kd, + append: qe, + attr: Nt, + detach: Na, + element: Ut, + init: yd, + insert: Ua, + noop: fs, + safe_not_equal: Cd, + set_data: Hl, + set_style: Bi, + space: Gi, + text: hn, + toggle_class: us +} = window.__gradio__svelte__internal, { onMount: Sd, createEventDispatcher: zd, onDestroy: Bd } = window.__gradio__svelte__internal; +function cs(l) { + let e, t, n, i, o = Tn( + /*file_to_display*/ + l[2] + ) + "", s, r, a, f, u = ( + /*file_to_display*/ + l[2].orig_name + "" + ), c; + return { + c() { + e = Ut("div"), t = Ut("span"), n = Ut("div"), i = Ut("progress"), s = hn(o), a = Gi(), f = Ut("span"), c = hn(u), Bi(i, "visibility", "hidden"), Bi(i, "height", "0"), Bi(i, "width", "0"), i.value = r = Tn( + /*file_to_display*/ + l[2] + ), Nt(i, "max", "100"), Nt(i, "class", "svelte-cr2edf"), Nt(n, "class", "progress-bar svelte-cr2edf"), Nt(f, "class", "file-name svelte-cr2edf"), Nt(e, "class", "file svelte-cr2edf"); + }, + m(_, d) { + Ua(_, e, d), qe(e, t), qe(t, n), qe(n, i), qe(i, s), qe(e, a), qe(e, f), qe(f, c); + }, + p(_, d) { + d & /*file_to_display*/ + 4 && o !== (o = Tn( + /*file_to_display*/ + _[2] + ) + "") && Hl(s, o), d & /*file_to_display*/ + 4 && r !== (r = Tn( + /*file_to_display*/ + _[2] + )) && (i.value = r), d & /*file_to_display*/ + 4 && u !== (u = /*file_to_display*/ + _[2].orig_name + "") && Hl(c, u); + }, + d(_) { + _ && Na(e); + } + }; +} +function qd(l) { + let e, t, n, i = ( + /*files_with_progress*/ + l[0].length + "" + ), o, s, r = ( + /*files_with_progress*/ + l[0].length > 1 ? "files" : "file" + ), a, f, u, c = ( + /*file_to_display*/ + l[2] && cs(l) + ); + return { + c() { + e = Ut("div"), t = Ut("span"), n = hn("Uploading "), o = hn(i), s = Gi(), a = hn(r), f = hn("..."), u = Gi(), c && c.c(), Nt(t, "class", "uploading svelte-cr2edf"), Nt(e, "class", "wrap svelte-cr2edf"), us( + e, + "progress", + /*progress*/ + l[1] + ); + }, + m(_, d) { + Ua(_, e, d), qe(e, t), qe(t, n), qe(t, o), qe(t, s), qe(t, a), qe(t, f), qe(e, u), c && c.m(e, null); + }, + p(_, [d]) { + d & /*files_with_progress*/ + 1 && i !== (i = /*files_with_progress*/ + _[0].length + "") && Hl(o, i), d & /*files_with_progress*/ + 1 && r !== (r = /*files_with_progress*/ + _[0].length > 1 ? "files" : "file") && Hl(a, r), /*file_to_display*/ + _[2] ? c ? c.p(_, d) : (c = cs(_), c.c(), c.m(e, null)) : c && (c.d(1), c = null), d & /*progress*/ + 2 && us( + e, + "progress", + /*progress*/ + _[1] + ); + }, + i: fs, + o: fs, + d(_) { + _ && Na(e), c && c.d(); + } + }; +} +function Tn(l) { + return l.progress * 100 / (l.size || 0) || 0; +} +function Ed(l) { + let e = 0; + return l.forEach((t) => { + e += Tn(t); + }), document.documentElement.style.setProperty("--upload-progress-width", (e / l.length).toFixed(2) + "%"), e / l.length; +} +function Md(l, e, t) { + var n = this && this.__awaiter || function(m, w, b, p) { + function g(v) { + return v instanceof b ? v : new b(function(E) { + E(v); + }); + } + return new (b || (b = Promise))(function(v, E) { + function y(A) { + try { + k(p.next(A)); + } catch (S) { + E(S); + } + } + function C(A) { + try { + k(p.throw(A)); + } catch (S) { + E(S); + } + } + function k(A) { + A.done ? v(A.value) : g(A.value).then(y, C); + } + k((p = p.apply(m, w || [])).next()); + }); + }; + let { upload_id: i } = e, { root: o } = e, { files: s } = e, { stream_handler: r } = e, a, f = !1, u, c, _ = s.map((m) => Object.assign(Object.assign({}, m), { progress: 0 })); + const d = zd(); + function h(m, w) { + t(0, _ = _.map((b) => (b.orig_name === m && (b.progress += w), b))); + } + return Sd(() => n(void 0, void 0, void 0, function* () { + if (a = yield r(new URL(`${o}/upload_progress?upload_id=${i}`)), a == null) + throw new Error("Event source is not defined"); + a.onmessage = function(m) { + return n(this, void 0, void 0, function* () { + const w = JSON.parse(m.data); + f || t(1, f = !0), w.msg === "done" ? (a == null || a.close(), d("done")) : (t(7, u = w), h(w.orig_name, w.chunk_size)); + }); + }; + })), Bd(() => { + (a != null || a != null) && a.close(); + }), l.$$set = (m) => { + "upload_id" in m && t(3, i = m.upload_id), "root" in m && t(4, o = m.root), "files" in m && t(5, s = m.files), "stream_handler" in m && t(6, r = m.stream_handler); + }, l.$$.update = () => { + l.$$.dirty & /*files_with_progress*/ + 1 && Ed(_), l.$$.dirty & /*current_file_upload, files_with_progress*/ + 129 && t(2, c = u || _[0]); + }, [ + _, + f, + c, + i, + o, + s, + r, + u + ]; +} +class Ad extends kd { + constructor(e) { + super(), yd(this, e, Md, qd, Cd, { + upload_id: 3, + root: 4, + files: 5, + stream_handler: 6 + }); + } +} +const { + SvelteComponent: Ld, + append: _s, + attr: pe, + binding_callbacks: Dd, + bubble: Dt, + check_outros: Oa, + create_component: Rd, + create_slot: Wa, + destroy_component: Td, + detach: xl, + element: Ji, + empty: Va, + get_all_dirty_from_scope: Pa, + get_slot_changes: Za, + group_outros: Ka, + init: Id, + insert: $l, + listen: Le, + mount_component: jd, + prevent_default: Rt, + run_all: Hd, + safe_not_equal: Fd, + set_style: Ga, + space: Xd, + stop_propagation: Tt, + toggle_class: de, + transition_in: Mt, + transition_out: Qt, + update_slot_base: Ja +} = window.__gradio__svelte__internal, { createEventDispatcher: Yd, tick: Nd } = window.__gradio__svelte__internal; +function Ud(l) { + let e, t, n, i, o, s, r, a, f, u, c; + const _ = ( + /*#slots*/ + l[26].default + ), d = Wa( + _, + l, + /*$$scope*/ + l[25], + null + ); + return { + c() { + e = Ji("button"), d && d.c(), t = Xd(), n = Ji("input"), pe(n, "aria-label", "file upload"), pe(n, "data-testid", "file-upload"), pe(n, "type", "file"), pe(n, "accept", i = /*accept_file_types*/ + l[16] || void 0), n.multiple = o = /*file_count*/ + l[6] === "multiple" || void 0, pe(n, "webkitdirectory", s = /*file_count*/ + l[6] === "directory" || void 0), pe(n, "mozdirectory", r = /*file_count*/ + l[6] === "directory" || void 0), pe(n, "class", "svelte-1s26xmt"), pe(e, "tabindex", a = /*hidden*/ + l[9] ? -1 : 0), pe(e, "class", "svelte-1s26xmt"), de( + e, + "hidden", + /*hidden*/ + l[9] + ), de( + e, + "center", + /*center*/ + l[4] + ), de( + e, + "boundedheight", + /*boundedheight*/ + l[3] + ), de( + e, + "flex", + /*flex*/ + l[5] + ), de( + e, + "disable_click", + /*disable_click*/ + l[7] + ), Ga(e, "height", "100%"); + }, + m(h, m) { + $l(h, e, m), d && d.m(e, null), _s(e, t), _s(e, n), l[34](n), f = !0, u || (c = [ + Le( + n, + "change", + /*load_files_from_upload*/ + l[18] + ), + Le(e, "drag", Tt(Rt( + /*drag_handler*/ + l[27] + ))), + Le(e, "dragstart", Tt(Rt( + /*dragstart_handler*/ + l[28] + ))), + Le(e, "dragend", Tt(Rt( + /*dragend_handler*/ + l[29] + ))), + Le(e, "dragover", Tt(Rt( + /*dragover_handler*/ + l[30] + ))), + Le(e, "dragenter", Tt(Rt( + /*dragenter_handler*/ + l[31] + ))), + Le(e, "dragleave", Tt(Rt( + /*dragleave_handler*/ + l[32] + ))), + Le(e, "drop", Tt(Rt( + /*drop_handler*/ + l[33] + ))), + Le( + e, + "click", + /*open_file_upload*/ + l[13] + ), + Le( + e, + "drop", + /*loadFilesFromDrop*/ + l[19] + ), + Le( + e, + "dragenter", + /*updateDragging*/ + l[17] + ), + Le( + e, + "dragleave", + /*updateDragging*/ + l[17] + ) + ], u = !0); + }, + p(h, m) { + d && d.p && (!f || m[0] & /*$$scope*/ + 33554432) && Ja( + d, + _, + h, + /*$$scope*/ + h[25], + f ? Za( + _, + /*$$scope*/ + h[25], + m, + null + ) : Pa( + /*$$scope*/ + h[25] + ), + null + ), (!f || m[0] & /*accept_file_types*/ + 65536 && i !== (i = /*accept_file_types*/ + h[16] || void 0)) && pe(n, "accept", i), (!f || m[0] & /*file_count*/ + 64 && o !== (o = /*file_count*/ + h[6] === "multiple" || void 0)) && (n.multiple = o), (!f || m[0] & /*file_count*/ + 64 && s !== (s = /*file_count*/ + h[6] === "directory" || void 0)) && pe(n, "webkitdirectory", s), (!f || m[0] & /*file_count*/ + 64 && r !== (r = /*file_count*/ + h[6] === "directory" || void 0)) && pe(n, "mozdirectory", r), (!f || m[0] & /*hidden*/ + 512 && a !== (a = /*hidden*/ + h[9] ? -1 : 0)) && pe(e, "tabindex", a), (!f || m[0] & /*hidden*/ + 512) && de( + e, + "hidden", + /*hidden*/ + h[9] + ), (!f || m[0] & /*center*/ + 16) && de( + e, + "center", + /*center*/ + h[4] + ), (!f || m[0] & /*boundedheight*/ + 8) && de( + e, + "boundedheight", + /*boundedheight*/ + h[3] + ), (!f || m[0] & /*flex*/ + 32) && de( + e, + "flex", + /*flex*/ + h[5] + ), (!f || m[0] & /*disable_click*/ + 128) && de( + e, + "disable_click", + /*disable_click*/ + h[7] + ); + }, + i(h) { + f || (Mt(d, h), f = !0); + }, + o(h) { + Qt(d, h), f = !1; + }, + d(h) { + h && xl(e), d && d.d(h), l[34](null), u = !1, Hd(c); + } + }; +} +function Od(l) { + let e, t, n = !/*hidden*/ + l[9] && ds(l); + return { + c() { + n && n.c(), e = Va(); + }, + m(i, o) { + n && n.m(i, o), $l(i, e, o), t = !0; + }, + p(i, o) { + /*hidden*/ + i[9] ? n && (Ka(), Qt(n, 1, 1, () => { + n = null; + }), Oa()) : n ? (n.p(i, o), o[0] & /*hidden*/ + 512 && Mt(n, 1)) : (n = ds(i), n.c(), Mt(n, 1), n.m(e.parentNode, e)); + }, + i(i) { + t || (Mt(n), t = !0); + }, + o(i) { + Qt(n), t = !1; + }, + d(i) { + i && xl(e), n && n.d(i); + } + }; +} +function Wd(l) { + let e, t, n, i, o; + const s = ( + /*#slots*/ + l[26].default + ), r = Wa( + s, + l, + /*$$scope*/ + l[25], + null + ); + return { + c() { + e = Ji("button"), r && r.c(), pe(e, "tabindex", t = /*hidden*/ + l[9] ? -1 : 0), pe(e, "class", "svelte-1s26xmt"), de( + e, + "hidden", + /*hidden*/ + l[9] + ), de( + e, + "center", + /*center*/ + l[4] + ), de( + e, + "boundedheight", + /*boundedheight*/ + l[3] + ), de( + e, + "flex", + /*flex*/ + l[5] + ), Ga(e, "height", "100%"); + }, + m(a, f) { + $l(a, e, f), r && r.m(e, null), n = !0, i || (o = Le( + e, + "click", + /*paste_clipboard*/ + l[12] + ), i = !0); + }, + p(a, f) { + r && r.p && (!n || f[0] & /*$$scope*/ + 33554432) && Ja( + r, + s, + a, + /*$$scope*/ + a[25], + n ? Za( + s, + /*$$scope*/ + a[25], + f, + null + ) : Pa( + /*$$scope*/ + a[25] + ), + null + ), (!n || f[0] & /*hidden*/ + 512 && t !== (t = /*hidden*/ + a[9] ? -1 : 0)) && pe(e, "tabindex", t), (!n || f[0] & /*hidden*/ + 512) && de( + e, + "hidden", + /*hidden*/ + a[9] + ), (!n || f[0] & /*center*/ + 16) && de( + e, + "center", + /*center*/ + a[4] + ), (!n || f[0] & /*boundedheight*/ + 8) && de( + e, + "boundedheight", + /*boundedheight*/ + a[3] + ), (!n || f[0] & /*flex*/ + 32) && de( + e, + "flex", + /*flex*/ + a[5] + ); + }, + i(a) { + n || (Mt(r, a), n = !0); + }, + o(a) { + Qt(r, a), n = !1; + }, + d(a) { + a && xl(e), r && r.d(a), i = !1, o(); + } + }; +} +function ds(l) { + let e, t; + return e = new Ad({ + props: { + root: ( + /*root*/ + l[8] + ), + upload_id: ( + /*upload_id*/ + l[14] + ), + files: ( + /*file_data*/ + l[15] + ), + stream_handler: ( + /*stream_handler*/ + l[11] + ) + } + }), { + c() { + Rd(e.$$.fragment); + }, + m(n, i) { + jd(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*root*/ + 256 && (o.root = /*root*/ + n[8]), i[0] & /*upload_id*/ + 16384 && (o.upload_id = /*upload_id*/ + n[14]), i[0] & /*file_data*/ + 32768 && (o.files = /*file_data*/ + n[15]), i[0] & /*stream_handler*/ + 2048 && (o.stream_handler = /*stream_handler*/ + n[11]), e.$set(o); + }, + i(n) { + t || (Mt(e.$$.fragment, n), t = !0); + }, + o(n) { + Qt(e.$$.fragment, n), t = !1; + }, + d(n) { + Td(e, n); + } + }; +} +function Vd(l) { + let e, t, n, i; + const o = [Wd, Od, Ud], s = []; + function r(a, f) { + return ( + /*filetype*/ + a[0] === "clipboard" ? 0 : ( + /*uploading*/ + a[1] && /*show_progress*/ + a[10] ? 1 : 2 + ) + ); + } + return e = r(l), t = s[e] = o[e](l), { + c() { + t.c(), n = Va(); + }, + m(a, f) { + s[e].m(a, f), $l(a, n, f), i = !0; + }, + p(a, f) { + let u = e; + e = r(a), e === u ? s[e].p(a, f) : (Ka(), Qt(s[u], 1, 1, () => { + s[u] = null; + }), Oa(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), Mt(t, 1), t.m(n.parentNode, n)); + }, + i(a) { + i || (Mt(t), i = !0); + }, + o(a) { + Qt(t), i = !1; + }, + d(a) { + a && xl(n), s[e].d(a); + } + }; +} +function Pd(l, e, t) { + if (!l || l === "*" || l === "file/*" || Array.isArray(l) && l.some((i) => i === "*" || i === "file/*")) + return !0; + let n; + if (typeof l == "string") + n = l.split(",").map((i) => i.trim()); + else if (Array.isArray(l)) + n = l; + else + return !1; + return n.includes(e) || n.some((i) => { + const [o] = i.split("/").map((s) => s.trim()); + return i.endsWith("/*") && t.startsWith(o + "/"); + }); +} +function Zd(l, e, t) { + let { $$slots: n = {}, $$scope: i } = e; + var o = this && this.__awaiter || function(M, H, G, q) { + function ue(Ye) { + return Ye instanceof G ? Ye : new G(function(Qe) { + Qe(Ye); + }); + } + return new (G || (G = Promise))(function(Ye, Qe) { + function ke(Ue) { + try { + Ne(q.next(Ue)); + } catch (bt) { + Qe(bt); + } + } + function be(Ue) { + try { + Ne(q.throw(Ue)); + } catch (bt) { + Qe(bt); + } + } + function Ne(Ue) { + Ue.done ? Ye(Ue.value) : ue(Ue.value).then(ke, be); + } + Ne((q = q.apply(M, H || [])).next()); + }); + }; + let { filetype: s = null } = e, { dragging: r = !1 } = e, { boundedheight: a = !0 } = e, { center: f = !0 } = e, { flex: u = !0 } = e, { file_count: c = "single" } = e, { disable_click: _ = !1 } = e, { root: d } = e, { hidden: h = !1 } = e, { format: m = "file" } = e, { uploading: w = !1 } = e, { hidden_upload: b = null } = e, { show_progress: p = !0 } = e, { max_file_size: g = null } = e, { upload: v } = e, { stream_handler: E } = e, y, C, k; + const A = Yd(), S = ["image", "video", "audio", "text", "file"], T = (M) => M.startsWith(".") || M.endsWith("/*") ? M : S.includes(M) ? M + "/*" : "." + M; + function R() { + t(20, r = !r); + } + function U() { + navigator.clipboard.read().then((M) => o(this, void 0, void 0, function* () { + for (let H = 0; H < M.length; H++) { + const G = M[H].types.find((q) => q.startsWith("image/")); + if (G) { + M[H].getType(G).then((q) => o(this, void 0, void 0, function* () { + const ue = new File([q], `clipboard.${G.replace("image/", "")}`); + yield J([ue]); + })); + break; + } + } + })); + } + function Z() { + _ || b && (t(2, b.value = "", b), b.click()); + } + function Q(M) { + return o(this, void 0, void 0, function* () { + yield Nd(), t(14, y = Math.random().toString(36).substring(2, 15)), t(1, w = !0); + try { + const H = yield v(M, d, y, g ?? 1 / 0); + return A("load", c === "single" ? H == null ? void 0 : H[0] : H), t(1, w = !1), H || []; + } catch (H) { + return A("error", H.message), t(1, w = !1), []; + } + }); + } + function J(M) { + return o(this, void 0, void 0, function* () { + if (!M.length) + return; + let H = M.map((G) => new File([G], G instanceof File ? G.name : "file", { type: G.type })); + return t(15, C = yield Ya(H)), yield Q(C); + }); + } + function K(M) { + return o(this, void 0, void 0, function* () { + const H = M.target; + if (H.files) + if (m != "blob") + yield J(Array.from(H.files)); + else { + if (c === "single") { + A("load", H.files[0]); + return; + } + A("load", H.files); + } + }); + } + function L(M) { + return o(this, void 0, void 0, function* () { + var H; + if (t(20, r = !1), !(!((H = M.dataTransfer) === null || H === void 0) && H.files)) return; + const G = Array.from(M.dataTransfer.files).filter((q) => { + const ue = "." + q.name.split(".").pop(); + return ue && Pd(k, ue, q.type) || (ue && Array.isArray(s) ? s.includes(ue) : ue === s) ? !0 : (A("error", `Invalid file type only ${s} allowed.`), !1); + }); + yield J(G); + }); + } + function F(M) { + Dt.call(this, l, M); + } + function D(M) { + Dt.call(this, l, M); + } + function W(M) { + Dt.call(this, l, M); + } + function $(M) { + Dt.call(this, l, M); + } + function oe(M) { + Dt.call(this, l, M); + } + function ge(M) { + Dt.call(this, l, M); + } + function I(M) { + Dt.call(this, l, M); + } + function Xe(M) { + Dd[M ? "unshift" : "push"](() => { + b = M, t(2, b); + }); + } + return l.$$set = (M) => { + "filetype" in M && t(0, s = M.filetype), "dragging" in M && t(20, r = M.dragging), "boundedheight" in M && t(3, a = M.boundedheight), "center" in M && t(4, f = M.center), "flex" in M && t(5, u = M.flex), "file_count" in M && t(6, c = M.file_count), "disable_click" in M && t(7, _ = M.disable_click), "root" in M && t(8, d = M.root), "hidden" in M && t(9, h = M.hidden), "format" in M && t(21, m = M.format), "uploading" in M && t(1, w = M.uploading), "hidden_upload" in M && t(2, b = M.hidden_upload), "show_progress" in M && t(10, p = M.show_progress), "max_file_size" in M && t(22, g = M.max_file_size), "upload" in M && t(23, v = M.upload), "stream_handler" in M && t(11, E = M.stream_handler), "$$scope" in M && t(25, i = M.$$scope); + }, l.$$.update = () => { + l.$$.dirty[0] & /*filetype*/ + 1 && (s == null ? t(16, k = null) : typeof s == "string" ? t(16, k = T(s)) : (t(0, s = s.map(T)), t(16, k = s.join(", ")))); + }, [ + s, + w, + b, + a, + f, + u, + c, + _, + d, + h, + p, + E, + U, + Z, + y, + C, + k, + R, + K, + L, + r, + m, + g, + v, + J, + i, + n, + F, + D, + W, + $, + oe, + ge, + I, + Xe + ]; +} +class Kd extends Ld { + constructor(e) { + super(), Id( + this, + e, + Zd, + Vd, + Fd, + { + filetype: 0, + dragging: 20, + boundedheight: 3, + center: 4, + flex: 5, + file_count: 6, + disable_click: 7, + root: 8, + hidden: 9, + format: 21, + uploading: 1, + hidden_upload: 2, + show_progress: 10, + max_file_size: 22, + upload: 23, + stream_handler: 11, + paste_clipboard: 12, + open_file_upload: 13, + load_files: 24 + }, + null, + [-1, -1] + ); + } + get paste_clipboard() { + return this.$$.ctx[12]; + } + get open_file_upload() { + return this.$$.ctx[13]; + } + get load_files() { + return this.$$.ctx[24]; + } +} +const { + SvelteComponent: Gd, + append: dl, + attr: qi, + create_component: Jd, + destroy_component: Qd, + detach: xd, + element: Ei, + init: $d, + insert: e1, + listen: t1, + mount_component: n1, + noop: l1, + safe_not_equal: i1, + set_style: o1, + space: s1, + text: a1, + transition_in: r1, + transition_out: f1 +} = window.__gradio__svelte__internal, { createEventDispatcher: u1 } = window.__gradio__svelte__internal; +function c1(l) { + let e, t, n, i, o, s = "Click to Access Webcam", r, a, f, u; + return i = new ha({}), { + c() { + e = Ei("button"), t = Ei("div"), n = Ei("span"), Jd(i.$$.fragment), o = s1(), r = a1(s), qi(n, "class", "icon-wrap svelte-fjcd9c"), qi(t, "class", "wrap svelte-fjcd9c"), qi(e, "class", "svelte-fjcd9c"), o1(e, "height", "100%"); + }, + m(c, _) { + e1(c, e, _), dl(e, t), dl(t, n), n1(i, n, null), dl(t, o), dl(t, r), a = !0, f || (u = t1( + e, + "click", + /*click_handler*/ + l[1] + ), f = !0); + }, + p: l1, + i(c) { + a || (r1(i.$$.fragment, c), a = !0); + }, + o(c) { + f1(i.$$.fragment, c), a = !1; + }, + d(c) { + c && xd(e), Qd(i), f = !1, u(); + } + }; +} +function _1(l) { + const e = u1(); + return [e, () => e("click")]; +} +class d1 extends Gd { + constructor(e) { + super(), $d(this, e, _1, c1, i1, {}); + } +} +function h1() { + return navigator.mediaDevices.enumerateDevices(); +} +function m1(l, e) { + e.srcObject = l, e.muted = !0, e.play(); +} +async function hs(l, e, t) { + const n = { + width: { ideal: 1920 }, + height: { ideal: 1440 } + }, i = { + video: t ? { deviceId: { exact: t }, ...n } : n, + audio: l + }; + return navigator.mediaDevices.getUserMedia(i).then((o) => (m1(o, e), o)); +} +function g1(l) { + return l.filter( + (t) => t.kind === "videoinput" + ); +} +const { + SvelteComponent: b1, + action_destroyer: w1, + add_render_callback: p1, + append: ct, + attr: re, + binding_callbacks: v1, + check_outros: Un, + create_component: kn, + create_in_transition: k1, + destroy_component: yn, + destroy_each: y1, + detach: Ee, + element: Ie, + empty: fo, + ensure_array_like: ms, + group_outros: On, + init: C1, + insert: Me, + listen: Fl, + mount_component: Cn, + noop: uo, + run_all: S1, + safe_not_equal: z1, + set_data: Qa, + set_input_value: Qi, + space: Kn, + stop_propagation: B1, + text: xa, + toggle_class: hl, + transition_in: he, + transition_out: ve +} = window.__gradio__svelte__internal, { createEventDispatcher: q1, onMount: E1 } = window.__gradio__svelte__internal; +function gs(l, e, t) { + const n = l.slice(); + return n[32] = e[t], n; +} +function M1(l) { + let e, t, n, i, o, s, r, a, f, u, c; + const _ = [D1, L1], d = []; + function h(b, p) { + return ( + /*mode*/ + b[1] === "video" || /*streaming*/ + b[0] ? 0 : 1 + ); + } + n = h(l), i = d[n] = _[n](l); + let m = !/*recording*/ + l[8] && bs(l), w = ( + /*options_open*/ + l[10] && /*selected_device*/ + l[7] && ws(l) + ); + return { + c() { + e = Ie("div"), t = Ie("button"), i.c(), s = Kn(), m && m.c(), r = Kn(), w && w.c(), a = fo(), re(t, "aria-label", o = /*mode*/ + l[1] === "image" ? "capture photo" : "start recording"), re(t, "class", "svelte-8hqvb6"), re(e, "class", "button-wrap svelte-8hqvb6"); + }, + m(b, p) { + Me(b, e, p), ct(e, t), d[n].m(t, null), ct(e, s), m && m.m(e, null), Me(b, r, p), w && w.m(b, p), Me(b, a, p), f = !0, u || (c = Fl( + t, + "click", + /*record_video_or_photo*/ + l[13] + ), u = !0); + }, + p(b, p) { + let g = n; + n = h(b), n === g ? d[n].p(b, p) : (On(), ve(d[g], 1, 1, () => { + d[g] = null; + }), Un(), i = d[n], i ? i.p(b, p) : (i = d[n] = _[n](b), i.c()), he(i, 1), i.m(t, null)), (!f || p[0] & /*mode*/ + 2 && o !== (o = /*mode*/ + b[1] === "image" ? "capture photo" : "start recording")) && re(t, "aria-label", o), /*recording*/ + b[8] ? m && (On(), ve(m, 1, 1, () => { + m = null; + }), Un()) : m ? (m.p(b, p), p[0] & /*recording*/ + 256 && he(m, 1)) : (m = bs(b), m.c(), he(m, 1), m.m(e, null)), /*options_open*/ + b[10] && /*selected_device*/ + b[7] ? w ? (w.p(b, p), p[0] & /*options_open, selected_device*/ + 1152 && he(w, 1)) : (w = ws(b), w.c(), he(w, 1), w.m(a.parentNode, a)) : w && (On(), ve(w, 1, 1, () => { + w = null; + }), Un()); + }, + i(b) { + f || (he(i), he(m), he(w), f = !0); + }, + o(b) { + ve(i), ve(m), ve(w), f = !1; + }, + d(b) { + b && (Ee(e), Ee(r), Ee(a)), d[n].d(), m && m.d(), w && w.d(b), u = !1, c(); + } + }; +} +function A1(l) { + let e, t, n, i; + return t = new d1({}), t.$on( + "click", + /*click_handler*/ + l[20] + ), { + c() { + e = Ie("div"), kn(t.$$.fragment), re(e, "title", "grant webcam access"); + }, + m(o, s) { + Me(o, e, s), Cn(t, e, null), i = !0; + }, + p: uo, + i(o) { + i || (he(t.$$.fragment, o), o && (n || p1(() => { + n = k1(e, w_, { delay: 100, duration: 200 }), n.start(); + })), i = !0); + }, + o(o) { + ve(t.$$.fragment, o), i = !1; + }, + d(o) { + o && Ee(e), yn(t); + } + }; +} +function L1(l) { + let e, t, n; + return t = new du({}), { + c() { + e = Ie("div"), kn(t.$$.fragment), re(e, "class", "icon svelte-8hqvb6"), re(e, "title", "capture photo"); + }, + m(i, o) { + Me(i, e, o), Cn(t, e, null), n = !0; + }, + p: uo, + i(i) { + n || (he(t.$$.fragment, i), n = !0); + }, + o(i) { + ve(t.$$.fragment, i), n = !1; + }, + d(i) { + i && Ee(e), yn(t); + } + }; +} +function D1(l) { + let e, t, n, i; + const o = [T1, R1], s = []; + function r(a, f) { + return ( + /*recording*/ + a[8] ? 0 : 1 + ); + } + return e = r(l), t = s[e] = o[e](l), { + c() { + t.c(), n = fo(); + }, + m(a, f) { + s[e].m(a, f), Me(a, n, f), i = !0; + }, + p(a, f) { + let u = e; + e = r(a), e !== u && (On(), ve(s[u], 1, 1, () => { + s[u] = null; + }), Un(), t = s[e], t || (t = s[e] = o[e](a), t.c()), he(t, 1), t.m(n.parentNode, n)); + }, + i(a) { + i || (he(t), i = !0); + }, + o(a) { + ve(t), i = !1; + }, + d(a) { + a && Ee(n), s[e].d(a); + } + }; +} +function R1(l) { + let e, t, n; + return t = new ku({}), { + c() { + e = Ie("div"), kn(t.$$.fragment), re(e, "class", "icon red svelte-8hqvb6"), re(e, "title", "start recording"); + }, + m(i, o) { + Me(i, e, o), Cn(t, e, null), n = !0; + }, + i(i) { + n || (he(t.$$.fragment, i), n = !0); + }, + o(i) { + ve(t.$$.fragment, i), n = !1; + }, + d(i) { + i && Ee(e), yn(t); + } + }; +} +function T1(l) { + let e, t, n; + return t = new Sc({}), { + c() { + e = Ie("div"), kn(t.$$.fragment), re(e, "class", "icon red svelte-8hqvb6"), re(e, "title", "stop recording"); + }, + m(i, o) { + Me(i, e, o), Cn(t, e, null), n = !0; + }, + i(i) { + n || (he(t.$$.fragment, i), n = !0); + }, + o(i) { + ve(t.$$.fragment, i), n = !1; + }, + d(i) { + i && Ee(e), yn(t); + } + }; +} +function bs(l) { + let e, t, n, i, o; + return t = new io({}), { + c() { + e = Ie("button"), kn(t.$$.fragment), re(e, "class", "icon svelte-8hqvb6"), re(e, "aria-label", "select input source"); + }, + m(s, r) { + Me(s, e, r), Cn(t, e, null), n = !0, i || (o = Fl( + e, + "click", + /*click_handler_1*/ + l[21] + ), i = !0); + }, + p: uo, + i(s) { + n || (he(t.$$.fragment, s), n = !0); + }, + o(s) { + ve(t.$$.fragment, s), n = !1; + }, + d(s) { + s && Ee(e), yn(t), i = !1, o(); + } + }; +} +function ws(l) { + let e, t, n, i, o, s, r; + n = new io({}); + function a(c, _) { + return ( + /*available_video_devices*/ + c[6].length === 0 ? j1 : I1 + ); + } + let f = a(l), u = f(l); + return { + c() { + e = Ie("select"), t = Ie("button"), kn(n.$$.fragment), i = Kn(), u.c(), re(t, "class", "inset-icon svelte-8hqvb6"), re(e, "class", "select-wrap svelte-8hqvb6"), re(e, "aria-label", "select source"); + }, + m(c, _) { + Me(c, e, _), ct(e, t), Cn(n, t, null), ct(t, i), u.m(e, null), o = !0, s || (r = [ + Fl(t, "click", B1( + /*click_handler_2*/ + l[22] + )), + w1(co.call( + null, + e, + /*handle_click_outside*/ + l[14] + )), + Fl( + e, + "change", + /*handle_device_change*/ + l[11] + ) + ], s = !0); + }, + p(c, _) { + f === (f = a(c)) && u ? u.p(c, _) : (u.d(1), u = f(c), u && (u.c(), u.m(e, null))); + }, + i(c) { + o || (he(n.$$.fragment, c), o = !0); + }, + o(c) { + ve(n.$$.fragment, c), o = !1; + }, + d(c) { + c && Ee(e), yn(n), u.d(), s = !1, S1(r); + } + }; +} +function I1(l) { + let e, t = ms( + /*available_video_devices*/ + l[6] + ), n = []; + for (let i = 0; i < t.length; i += 1) + n[i] = ps(gs(l, t, i)); + return { + c() { + for (let i = 0; i < n.length; i += 1) + n[i].c(); + e = fo(); + }, + m(i, o) { + for (let s = 0; s < n.length; s += 1) + n[s] && n[s].m(i, o); + Me(i, e, o); + }, + p(i, o) { + if (o[0] & /*available_video_devices, selected_device*/ + 192) { + t = ms( + /*available_video_devices*/ + i[6] + ); + let s; + for (s = 0; s < t.length; s += 1) { + const r = gs(i, t, s); + n[s] ? n[s].p(r, o) : (n[s] = ps(r), n[s].c(), n[s].m(e.parentNode, e)); + } + for (; s < n.length; s += 1) + n[s].d(1); + n.length = t.length; + } + }, + d(i) { + i && Ee(e), y1(n, i); + } + }; +} +function j1(l) { + let e, t = ( + /*i18n*/ + l[3]("common.no_devices") + "" + ), n; + return { + c() { + e = Ie("option"), n = xa(t), e.__value = "", Qi(e, e.__value), re(e, "class", "svelte-8hqvb6"); + }, + m(i, o) { + Me(i, e, o), ct(e, n); + }, + p(i, o) { + o[0] & /*i18n*/ + 8 && t !== (t = /*i18n*/ + i[3]("common.no_devices") + "") && Qa(n, t); + }, + d(i) { + i && Ee(e); + } + }; +} +function ps(l) { + let e, t = ( + /*device*/ + l[32].label + "" + ), n, i, o, s; + return { + c() { + e = Ie("option"), n = xa(t), i = Kn(), e.__value = o = /*device*/ + l[32].deviceId, Qi(e, e.__value), e.selected = s = /*selected_device*/ + l[7].deviceId === /*device*/ + l[32].deviceId, re(e, "class", "svelte-8hqvb6"); + }, + m(r, a) { + Me(r, e, a), ct(e, n), ct(e, i); + }, + p(r, a) { + a[0] & /*available_video_devices*/ + 64 && t !== (t = /*device*/ + r[32].label + "") && Qa(n, t), a[0] & /*available_video_devices*/ + 64 && o !== (o = /*device*/ + r[32].deviceId) && (e.__value = o, Qi(e, e.__value)), a[0] & /*selected_device, available_video_devices*/ + 192 && s !== (s = /*selected_device*/ + r[7].deviceId === /*device*/ + r[32].deviceId) && (e.selected = s); + }, + d(r) { + r && Ee(e); + } + }; +} +function H1(l) { + let e, t, n, i, o, s; + const r = [A1, M1], a = []; + function f(u, c) { + return ( + /*webcam_accessed*/ + u[9] ? 1 : 0 + ); + } + return i = f(l), o = a[i] = r[i](l), { + c() { + e = Ie("div"), t = Ie("video"), n = Kn(), o.c(), re(t, "class", "svelte-8hqvb6"), hl( + t, + "flip", + /*mirror_webcam*/ + l[2] + ), hl(t, "hide", !/*webcam_accessed*/ + l[9]), re(e, "class", "wrap svelte-8hqvb6"); + }, + m(u, c) { + Me(u, e, c), ct(e, t), l[19](t), ct(e, n), a[i].m(e, null), s = !0; + }, + p(u, c) { + (!s || c[0] & /*mirror_webcam*/ + 4) && hl( + t, + "flip", + /*mirror_webcam*/ + u[2] + ), (!s || c[0] & /*webcam_accessed*/ + 512) && hl(t, "hide", !/*webcam_accessed*/ + u[9]); + let _ = i; + i = f(u), i === _ ? a[i].p(u, c) : (On(), ve(a[_], 1, 1, () => { + a[_] = null; + }), Un(), o = a[i], o ? o.p(u, c) : (o = a[i] = r[i](u), o.c()), he(o, 1), o.m(e, null)); + }, + i(u) { + s || (he(o), s = !0); + }, + o(u) { + ve(o), s = !1; + }, + d(u) { + u && Ee(e), l[19](null), a[i].d(); + } + }; +} +function co(l, e) { + const t = (n) => { + l && !l.contains(n.target) && !n.defaultPrevented && e(n); + }; + return document.addEventListener("click", t, !0), { + destroy() { + document.removeEventListener("click", t, !0); + } + }; +} +function F1(l, e, t) { + var n = this && this.__awaiter || function(L, F, D, W) { + function $(oe) { + return oe instanceof D ? oe : new D(function(ge) { + ge(oe); + }); + } + return new (D || (D = Promise))(function(oe, ge) { + function I(H) { + try { + M(W.next(H)); + } catch (G) { + ge(G); + } + } + function Xe(H) { + try { + M(W.throw(H)); + } catch (G) { + ge(G); + } + } + function M(H) { + H.done ? oe(H.value) : $(H.value).then(I, Xe); + } + M((W = W.apply(L, F || [])).next()); + }); + }; + let i, o = [], s = null, r, { streaming: a = !1 } = e, { pending: f = !1 } = e, { root: u = "" } = e, { mode: c = "image" } = e, { mirror_webcam: _ } = e, { include_audio: d } = e, { i18n: h } = e, { upload: m } = e; + const w = q1(); + E1(() => r = document.createElement("canvas")); + const b = (L) => n(void 0, void 0, void 0, function* () { + const D = L.target.value; + yield hs(d, i, D).then((W) => n(void 0, void 0, void 0, function* () { + y = W, t(7, s = o.find(($) => $.deviceId === D) || null), t(10, R = !1); + })); + }); + function p() { + return n(this, void 0, void 0, function* () { + try { + hs(d, i).then((L) => n(this, void 0, void 0, function* () { + t(9, S = !0), t(6, o = yield h1()), y = L; + })).then(() => g1(o)).then((L) => { + t(6, o = L); + const F = y.getTracks().map((D) => { + var W; + return (W = D.getSettings()) === null || W === void 0 ? void 0 : W.deviceId; + })[0]; + t(7, s = F && L.find((D) => D.deviceId === F) || o[0]); + }), (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) && w("error", h("image.no_webcam_support")); + } catch (L) { + if (L instanceof DOMException && L.name == "NotAllowedError") + w("error", h("image.allow_webcam_access")); + else + throw L; + } + }); + } + function g() { + var L = r.getContext("2d"); + (!a || a && v) && i.videoWidth && i.videoHeight && (r.width = i.videoWidth, r.height = i.videoHeight, L.drawImage(i, 0, 0, i.videoWidth, i.videoHeight), _ && (L.scale(-1, 1), L.drawImage(i, -i.videoWidth, 0)), r.toBlob( + (F) => { + w(a ? "stream" : "capture", F); + }, + "image/png", + 0.8 + )); + } + let v = !1, E = [], y, C, k; + function A() { + if (v) { + k.stop(); + let L = new Blob(E, { type: C }), F = new FileReader(); + F.onload = function(D) { + return n(this, void 0, void 0, function* () { + var W; + if (D.target) { + let $ = new File([L], "sample." + C.substring(6)); + const oe = yield Ya([$]); + let ge = ((W = yield m(oe, u)) === null || W === void 0 ? void 0 : W.filter(Boolean))[0]; + w("capture", ge), w("stop_recording"); + } + }); + }, F.readAsDataURL(L); + } else { + w("start_recording"), E = []; + let L = ["video/webm", "video/mp4"]; + for (let F of L) + if (MediaRecorder.isTypeSupported(F)) { + C = F; + break; + } + if (C === null) { + console.error("No supported MediaRecorder mimeType"); + return; + } + k = new MediaRecorder(y, { mimeType: C }), k.addEventListener("dataavailable", function(F) { + E.push(F.data); + }), k.start(200); + } + t(8, v = !v); + } + let S = !1; + function T() { + c === "image" && a && t(8, v = !v), c === "image" ? g() : A(), !v && y && (y.getTracks().forEach((L) => L.stop()), t(5, i.srcObject = null, i), t(9, S = !1)); + } + a && c === "image" && window.setInterval( + () => { + i && !f && g(); + }, + 500 + ); + let R = !1; + function U(L) { + L.preventDefault(), L.stopPropagation(), t(10, R = !1); + } + function Z(L) { + v1[L ? "unshift" : "push"](() => { + i = L, t(5, i); + }); + } + const Q = async () => p(), J = () => t(10, R = !0), K = () => t(10, R = !1); + return l.$$set = (L) => { + "streaming" in L && t(0, a = L.streaming), "pending" in L && t(15, f = L.pending), "root" in L && t(16, u = L.root), "mode" in L && t(1, c = L.mode), "mirror_webcam" in L && t(2, _ = L.mirror_webcam), "include_audio" in L && t(17, d = L.include_audio), "i18n" in L && t(3, h = L.i18n), "upload" in L && t(18, m = L.upload); + }, [ + a, + c, + _, + h, + co, + i, + o, + s, + v, + S, + R, + b, + p, + T, + U, + f, + u, + d, + m, + Z, + Q, + J, + K + ]; +} +class X1 extends b1 { + constructor(e) { + super(), C1( + this, + e, + F1, + H1, + z1, + { + streaming: 0, + pending: 15, + root: 16, + mode: 1, + mirror_webcam: 2, + include_audio: 17, + i18n: 3, + upload: 18, + click_outside: 4 + }, + null, + [-1, -1] + ); + } + get click_outside() { + return co; + } +} +const { + SvelteComponent: Y1, + append: yt, + attr: j, + detach: N1, + init: U1, + insert: O1, + noop: Mi, + safe_not_equal: W1, + set_style: Ct, + svg_element: rt +} = window.__gradio__svelte__internal; +function V1(l) { + let e, t, n, i, o, s, r, a, f; + return { + c() { + e = rt("svg"), t = rt("rect"), n = rt("rect"), i = rt("rect"), o = rt("rect"), s = rt("line"), r = rt("line"), a = rt("line"), f = rt("line"), j(t, "x", "2"), j(t, "y", "2"), j(t, "width", "5"), j(t, "height", "5"), j(t, "rx", "1"), j(t, "ry", "1"), j(t, "stroke-width", "2"), j(t, "fill", "none"), j(n, "x", "17"), j(n, "y", "2"), j(n, "width", "5"), j(n, "height", "5"), j(n, "rx", "1"), j(n, "ry", "1"), j(n, "stroke-width", "2"), j(n, "fill", "none"), j(i, "x", "2"), j(i, "y", "17"), j(i, "width", "5"), j(i, "height", "5"), j(i, "rx", "1"), j(i, "ry", "1"), j(i, "stroke-width", "2"), j(i, "fill", "none"), j(o, "x", "17"), j(o, "y", "17"), j(o, "width", "5"), j(o, "height", "5"), j(o, "rx", "1"), j(o, "ry", "1"), j(o, "stroke-width", "2"), j(o, "fill", "none"), j(s, "x1", "7.5"), j(s, "y1", "4.5"), j(s, "x2", "16"), j(s, "y2", "4.5"), Ct(s, "stroke-width", "2px"), j(r, "x1", "7.5"), j(r, "y1", "19.5"), j(r, "x2", "16"), j(r, "y2", "19.5"), Ct(r, "stroke-width", "2px"), j(a, "x1", "4.5"), j(a, "y1", "8"), j(a, "x2", "4.5"), j(a, "y2", "16"), Ct(a, "stroke-width", "2px"), j(f, "x1", "19.5"), j(f, "y1", "8"), j(f, "x2", "19.5"), j(f, "y2", "16"), Ct(f, "stroke-width", "2px"), j(e, "width", "100%"), j(e, "height", "100%"), j(e, "viewBox", "0 0 24 24"), j(e, "version", "1.1"), j(e, "xmlns", "http://www.w3.org/2000/svg"), j(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), j(e, "xml:space", "preserve"), j(e, "stroke", "currentColor"), Ct(e, "fill-rule", "evenodd"), Ct(e, "clip-rule", "evenodd"), Ct(e, "stroke-linecap", "round"), Ct(e, "stroke-linejoin", "round"); + }, + m(u, c) { + O1(u, e, c), yt(e, t), yt(e, n), yt(e, i), yt(e, o), yt(e, s), yt(e, r), yt(e, a), yt(e, f); + }, + p: Mi, + i: Mi, + o: Mi, + d(u) { + u && N1(e); + } + }; +} +class P1 extends Y1 { + constructor(e) { + super(), U1(this, e, null, V1, W1, {}); + } +} +const { + SvelteComponent: Z1, + append: K1, + attr: Ze, + detach: G1, + init: J1, + insert: Q1, + noop: Ai, + safe_not_equal: x1, + set_style: ml, + svg_element: vs +} = window.__gradio__svelte__internal; +function $1(l) { + let e, t; + return { + c() { + e = vs("svg"), t = vs("path"), Ze(t, "d", "M 14.4 2.85 V 11.1 V 3.95 C 14.4 3.0387 15.1388 2.3 16.05 2.3 C 16.9612 2.3 17.7 3.0387 17.7 3.95 V 11.1 V 7.25 C 17.7 6.3387 18.4388 5.6 19.35 5.6 C 20.2612 5.6 21 6.3387 21 7.25 V 16.6 C 21 20.2451 18.0451 23.2 14.4 23.2 H 13.16 C 11.4831 23.2 9.8692 22.5618 8.6459 21.4149 L 3.1915 16.3014 C 2.403 15.5622 2.3829 14.3171 3.1472 13.5528 C 3.8943 12.8057 5.1057 12.8057 5.8528 13.5528 L 7.8 15.5 V 6.15 C 7.8 5.2387 8.5387 4.5 9.45 4.5 C 10.3612 4.5 11.1 5.2387 11.1 6.15 V 11.1 V 2.85 C 11.1 1.9387 11.8388 1.2 12.75 1.2 C 13.6612 1.2 14.4 1.9387 14.4 2.85 Z"), Ze(t, "fill", "none"), Ze(t, "stroke-width", "2"), Ze(e, "width", "100%"), Ze(e, "height", "100%"), Ze(e, "viewBox", "0 0 24 24"), Ze(e, "version", "1.1"), Ze(e, "xmlns", "http://www.w3.org/2000/svg"), Ze(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Ze(e, "xml:space", "preserve"), Ze(e, "stroke", "currentColor"), ml(e, "fill-rule", "evenodd"), ml(e, "clip-rule", "evenodd"), ml(e, "stroke-linecap", "round"), ml(e, "stroke-linejoin", "round"); + }, + m(n, i) { + Q1(n, e, i), K1(e, t); + }, + p: Ai, + i: Ai, + o: Ai, + d(n) { + n && G1(e); + } + }; +} +class e0 extends Z1 { + constructor(e) { + super(), J1(this, e, null, $1, x1, {}); + } +} +const { + SvelteComponent: t0, + append: n0, + attr: Ke, + detach: l0, + init: i0, + insert: o0, + noop: Li, + safe_not_equal: s0, + set_style: gl, + svg_element: ks +} = window.__gradio__svelte__internal; +function a0(l) { + let e, t; + return { + c() { + e = ks("svg"), t = ks("path"), Ke(t, "d", "M10 12L14 16M14 12L10 16M4 6H20M16 6L15.7294 5.18807C15.4671 4.40125 15.3359 4.00784 15.0927 3.71698C14.8779 3.46013 14.6021 3.26132 14.2905 3.13878C13.9376 3 13.523 3 12.6936 3H11.3064C10.477 3 10.0624 3 9.70951 3.13878C9.39792 3.26132 9.12208 3.46013 8.90729 3.71698C8.66405 4.00784 8.53292 4.40125 8.27064 5.18807L8 6M18 6V16.2C18 17.8802 18 18.7202 17.673 19.362C17.3854 19.9265 16.9265 20.3854 16.362 20.673C15.7202 21 14.8802 21 13.2 21H10.8C9.11984 21 8.27976 21 7.63803 20.673C7.07354 20.3854 6.6146 19.9265 6.32698 19.362C6 18.7202 6 17.8802 6 16.2V6"), Ke(t, "fill", "none"), Ke(t, "stroke-width", "2"), Ke(e, "width", "100%"), Ke(e, "height", "100%"), Ke(e, "viewBox", "0 0 24 24"), Ke(e, "version", "1.1"), Ke(e, "xmlns", "http://www.w3.org/2000/svg"), Ke(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Ke(e, "xml:space", "preserve"), Ke(e, "stroke", "currentColor"), gl(e, "fill-rule", "evenodd"), gl(e, "clip-rule", "evenodd"), gl(e, "stroke-linecap", "round"), gl(e, "stroke-linejoin", "round"); + }, + m(n, i) { + o0(n, e, i), n0(e, t); + }, + p: Li, + i: Li, + o: Li, + d(n) { + n && l0(e); + } + }; +} +class r0 extends t0 { + constructor(e) { + super(), i0(this, e, null, a0, s0, {}); + } +} +const { + SvelteComponent: f0, + append: ys, + attr: Di, + bubble: Cs, + create_component: u0, + destroy_component: c0, + detach: $a, + element: Ss, + init: _0, + insert: er, + listen: Ri, + mount_component: d0, + run_all: h0, + safe_not_equal: m0, + set_data: g0, + set_input_value: zs, + space: b0, + text: w0, + transition_in: p0, + transition_out: v0 +} = window.__gradio__svelte__internal, { createEventDispatcher: k0, afterUpdate: y0 } = window.__gradio__svelte__internal; +function C0(l) { + let e; + return { + c() { + e = w0( + /*label*/ + l[1] + ); + }, + m(t, n) { + er(t, e, n); + }, + p(t, n) { + n & /*label*/ + 2 && g0( + e, + /*label*/ + t[1] + ); + }, + d(t) { + t && $a(e); + } + }; +} +function S0(l) { + let e, t, n, i, o, s, r; + return t = new aa({ + props: { + show_label: ( + /*show_label*/ + l[4] + ), + info: ( + /*info*/ + l[2] + ), + $$slots: { default: [C0] }, + $$scope: { ctx: l } + } + }), { + c() { + e = Ss("label"), u0(t.$$.fragment), n = b0(), i = Ss("input"), Di(i, "type", "color"), i.disabled = /*disabled*/ + l[3], Di(i, "class", "svelte-16l8u73"), Di(e, "class", "block"); + }, + m(a, f) { + er(a, e, f), d0(t, e, null), ys(e, n), ys(e, i), zs( + i, + /*value*/ + l[0] + ), o = !0, s || (r = [ + Ri( + i, + "input", + /*input_input_handler*/ + l[8] + ), + Ri( + i, + "focus", + /*focus_handler*/ + l[6] + ), + Ri( + i, + "blur", + /*blur_handler*/ + l[7] + ) + ], s = !0); + }, + p(a, [f]) { + const u = {}; + f & /*show_label*/ + 16 && (u.show_label = /*show_label*/ + a[4]), f & /*info*/ + 4 && (u.info = /*info*/ + a[2]), f & /*$$scope, label*/ + 2050 && (u.$$scope = { dirty: f, ctx: a }), t.$set(u), (!o || f & /*disabled*/ + 8) && (i.disabled = /*disabled*/ + a[3]), f & /*value*/ + 1 && zs( + i, + /*value*/ + a[0] + ); + }, + i(a) { + o || (p0(t.$$.fragment, a), o = !0); + }, + o(a) { + v0(t.$$.fragment, a), o = !1; + }, + d(a) { + a && $a(e), c0(t), s = !1, h0(r); + } + }; +} +function z0(l, e, t) { + let { value: n = "#000000" } = e, { value_is_output: i = !1 } = e, { label: o } = e, { info: s = void 0 } = e, { disabled: r = !1 } = e, { show_label: a = !0 } = e; + const f = k0(); + function u() { + f("change", n), i || f("input"); + } + y0(() => { + t(5, i = !1); + }); + function c(h) { + Cs.call(this, l, h); + } + function _(h) { + Cs.call(this, l, h); + } + function d() { + n = this.value, t(0, n); + } + return l.$$set = (h) => { + "value" in h && t(0, n = h.value), "value_is_output" in h && t(5, i = h.value_is_output), "label" in h && t(1, o = h.label), "info" in h && t(2, s = h.info), "disabled" in h && t(3, r = h.disabled), "show_label" in h && t(4, a = h.show_label); + }, l.$$.update = () => { + l.$$.dirty & /*value*/ + 1 && u(); + }, [ + n, + o, + s, + r, + a, + i, + c, + _, + d + ]; +} +class B0 extends f0 { + constructor(e) { + super(), _0(this, e, z0, S0, m0, { + value: 0, + value_is_output: 5, + label: 1, + info: 2, + disabled: 3, + show_label: 4 + }); + } +} +const { + SvelteComponent: q0, + append: tr, + attr: ne, + bubble: E0, + check_outros: M0, + create_slot: nr, + detach: tl, + element: ei, + empty: A0, + get_all_dirty_from_scope: lr, + get_slot_changes: ir, + group_outros: L0, + init: D0, + insert: nl, + listen: R0, + safe_not_equal: T0, + set_style: Be, + space: or, + src_url_equal: Xl, + toggle_class: mn, + transition_in: Yl, + transition_out: Nl, + update_slot_base: sr +} = window.__gradio__svelte__internal; +function I0(l) { + let e, t, n, i, o, s, r = ( + /*icon*/ + l[7] && Bs(l) + ); + const a = ( + /*#slots*/ + l[12].default + ), f = nr( + a, + l, + /*$$scope*/ + l[11], + null + ); + return { + c() { + e = ei("button"), r && r.c(), t = or(), f && f.c(), ne(e, "class", n = /*size*/ + l[4] + " " + /*variant*/ + l[3] + " " + /*elem_classes*/ + l[1].join(" ") + " svelte-8huxfn"), ne( + e, + "id", + /*elem_id*/ + l[0] + ), e.disabled = /*disabled*/ + l[8], mn(e, "hidden", !/*visible*/ + l[2]), Be( + e, + "flex-grow", + /*scale*/ + l[9] + ), Be( + e, + "width", + /*scale*/ + l[9] === 0 ? "fit-content" : null + ), Be(e, "min-width", typeof /*min_width*/ + l[10] == "number" ? `calc(min(${/*min_width*/ + l[10]}px, 100%))` : null); + }, + m(u, c) { + nl(u, e, c), r && r.m(e, null), tr(e, t), f && f.m(e, null), i = !0, o || (s = R0( + e, + "click", + /*click_handler*/ + l[13] + ), o = !0); + }, + p(u, c) { + /*icon*/ + u[7] ? r ? r.p(u, c) : (r = Bs(u), r.c(), r.m(e, t)) : r && (r.d(1), r = null), f && f.p && (!i || c & /*$$scope*/ + 2048) && sr( + f, + a, + u, + /*$$scope*/ + u[11], + i ? ir( + a, + /*$$scope*/ + u[11], + c, + null + ) : lr( + /*$$scope*/ + u[11] + ), + null + ), (!i || c & /*size, variant, elem_classes*/ + 26 && n !== (n = /*size*/ + u[4] + " " + /*variant*/ + u[3] + " " + /*elem_classes*/ + u[1].join(" ") + " svelte-8huxfn")) && ne(e, "class", n), (!i || c & /*elem_id*/ + 1) && ne( + e, + "id", + /*elem_id*/ + u[0] + ), (!i || c & /*disabled*/ + 256) && (e.disabled = /*disabled*/ + u[8]), (!i || c & /*size, variant, elem_classes, visible*/ + 30) && mn(e, "hidden", !/*visible*/ + u[2]), c & /*scale*/ + 512 && Be( + e, + "flex-grow", + /*scale*/ + u[9] + ), c & /*scale*/ + 512 && Be( + e, + "width", + /*scale*/ + u[9] === 0 ? "fit-content" : null + ), c & /*min_width*/ + 1024 && Be(e, "min-width", typeof /*min_width*/ + u[10] == "number" ? `calc(min(${/*min_width*/ + u[10]}px, 100%))` : null); + }, + i(u) { + i || (Yl(f, u), i = !0); + }, + o(u) { + Nl(f, u), i = !1; + }, + d(u) { + u && tl(e), r && r.d(), f && f.d(u), o = !1, s(); + } + }; +} +function j0(l) { + let e, t, n, i, o = ( + /*icon*/ + l[7] && qs(l) + ); + const s = ( + /*#slots*/ + l[12].default + ), r = nr( + s, + l, + /*$$scope*/ + l[11], + null + ); + return { + c() { + e = ei("a"), o && o.c(), t = or(), r && r.c(), ne( + e, + "href", + /*link*/ + l[6] + ), ne(e, "rel", "noopener noreferrer"), ne( + e, + "aria-disabled", + /*disabled*/ + l[8] + ), ne(e, "class", n = /*size*/ + l[4] + " " + /*variant*/ + l[3] + " " + /*elem_classes*/ + l[1].join(" ") + " svelte-8huxfn"), ne( + e, + "id", + /*elem_id*/ + l[0] + ), mn(e, "hidden", !/*visible*/ + l[2]), mn( + e, + "disabled", + /*disabled*/ + l[8] + ), Be( + e, + "flex-grow", + /*scale*/ + l[9] + ), Be( + e, + "pointer-events", + /*disabled*/ + l[8] ? "none" : null + ), Be( + e, + "width", + /*scale*/ + l[9] === 0 ? "fit-content" : null + ), Be(e, "min-width", typeof /*min_width*/ + l[10] == "number" ? `calc(min(${/*min_width*/ + l[10]}px, 100%))` : null); + }, + m(a, f) { + nl(a, e, f), o && o.m(e, null), tr(e, t), r && r.m(e, null), i = !0; + }, + p(a, f) { + /*icon*/ + a[7] ? o ? o.p(a, f) : (o = qs(a), o.c(), o.m(e, t)) : o && (o.d(1), o = null), r && r.p && (!i || f & /*$$scope*/ + 2048) && sr( + r, + s, + a, + /*$$scope*/ + a[11], + i ? ir( + s, + /*$$scope*/ + a[11], + f, + null + ) : lr( + /*$$scope*/ + a[11] + ), + null + ), (!i || f & /*link*/ + 64) && ne( + e, + "href", + /*link*/ + a[6] + ), (!i || f & /*disabled*/ + 256) && ne( + e, + "aria-disabled", + /*disabled*/ + a[8] + ), (!i || f & /*size, variant, elem_classes*/ + 26 && n !== (n = /*size*/ + a[4] + " " + /*variant*/ + a[3] + " " + /*elem_classes*/ + a[1].join(" ") + " svelte-8huxfn")) && ne(e, "class", n), (!i || f & /*elem_id*/ + 1) && ne( + e, + "id", + /*elem_id*/ + a[0] + ), (!i || f & /*size, variant, elem_classes, visible*/ + 30) && mn(e, "hidden", !/*visible*/ + a[2]), (!i || f & /*size, variant, elem_classes, disabled*/ + 282) && mn( + e, + "disabled", + /*disabled*/ + a[8] + ), f & /*scale*/ + 512 && Be( + e, + "flex-grow", + /*scale*/ + a[9] + ), f & /*disabled*/ + 256 && Be( + e, + "pointer-events", + /*disabled*/ + a[8] ? "none" : null + ), f & /*scale*/ + 512 && Be( + e, + "width", + /*scale*/ + a[9] === 0 ? "fit-content" : null + ), f & /*min_width*/ + 1024 && Be(e, "min-width", typeof /*min_width*/ + a[10] == "number" ? `calc(min(${/*min_width*/ + a[10]}px, 100%))` : null); + }, + i(a) { + i || (Yl(r, a), i = !0); + }, + o(a) { + Nl(r, a), i = !1; + }, + d(a) { + a && tl(e), o && o.d(), r && r.d(a); + } + }; +} +function Bs(l) { + let e, t, n; + return { + c() { + e = ei("img"), ne(e, "class", "button-icon svelte-8huxfn"), Xl(e.src, t = /*icon*/ + l[7].url) || ne(e, "src", t), ne(e, "alt", n = `${/*value*/ + l[5]} icon`); + }, + m(i, o) { + nl(i, e, o); + }, + p(i, o) { + o & /*icon*/ + 128 && !Xl(e.src, t = /*icon*/ + i[7].url) && ne(e, "src", t), o & /*value*/ + 32 && n !== (n = `${/*value*/ + i[5]} icon`) && ne(e, "alt", n); + }, + d(i) { + i && tl(e); + } + }; +} +function qs(l) { + let e, t, n; + return { + c() { + e = ei("img"), ne(e, "class", "button-icon svelte-8huxfn"), Xl(e.src, t = /*icon*/ + l[7].url) || ne(e, "src", t), ne(e, "alt", n = `${/*value*/ + l[5]} icon`); + }, + m(i, o) { + nl(i, e, o); + }, + p(i, o) { + o & /*icon*/ + 128 && !Xl(e.src, t = /*icon*/ + i[7].url) && ne(e, "src", t), o & /*value*/ + 32 && n !== (n = `${/*value*/ + i[5]} icon`) && ne(e, "alt", n); + }, + d(i) { + i && tl(e); + } + }; +} +function H0(l) { + let e, t, n, i; + const o = [j0, I0], s = []; + function r(a, f) { + return ( + /*link*/ + a[6] && /*link*/ + a[6].length > 0 ? 0 : 1 + ); + } + return e = r(l), t = s[e] = o[e](l), { + c() { + t.c(), n = A0(); + }, + m(a, f) { + s[e].m(a, f), nl(a, n, f), i = !0; + }, + p(a, [f]) { + let u = e; + e = r(a), e === u ? s[e].p(a, f) : (L0(), Nl(s[u], 1, 1, () => { + s[u] = null; + }), M0(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), Yl(t, 1), t.m(n.parentNode, n)); + }, + i(a) { + i || (Yl(t), i = !0); + }, + o(a) { + Nl(t), i = !1; + }, + d(a) { + a && tl(n), s[e].d(a); + } + }; +} +function F0(l, e, t) { + let { $$slots: n = {}, $$scope: i } = e, { elem_id: o = "" } = e, { elem_classes: s = [] } = e, { visible: r = !0 } = e, { variant: a = "secondary" } = e, { size: f = "lg" } = e, { value: u = null } = e, { link: c = null } = e, { icon: _ = null } = e, { disabled: d = !1 } = e, { scale: h = null } = e, { min_width: m = void 0 } = e; + function w(b) { + E0.call(this, l, b); + } + return l.$$set = (b) => { + "elem_id" in b && t(0, o = b.elem_id), "elem_classes" in b && t(1, s = b.elem_classes), "visible" in b && t(2, r = b.visible), "variant" in b && t(3, a = b.variant), "size" in b && t(4, f = b.size), "value" in b && t(5, u = b.value), "link" in b && t(6, c = b.link), "icon" in b && t(7, _ = b.icon), "disabled" in b && t(8, d = b.disabled), "scale" in b && t(9, h = b.scale), "min_width" in b && t(10, m = b.min_width), "$$scope" in b && t(11, i = b.$$scope); + }, [ + o, + s, + r, + a, + f, + u, + c, + _, + d, + h, + m, + i, + n, + w + ]; +} +class xi extends q0 { + constructor(e) { + super(), D0(this, e, F0, H0, T0, { + elem_id: 0, + elem_classes: 1, + visible: 2, + variant: 3, + size: 4, + value: 5, + link: 6, + icon: 7, + disabled: 8, + scale: 9, + min_width: 10 + }); + } +} +const { + SvelteComponent: X0, + add_render_callback: ar, + append: bl, + attr: Re, + binding_callbacks: Es, + check_outros: Y0, + create_bidirectional_transition: Ms, + destroy_each: N0, + detach: Wn, + element: Ul, + empty: U0, + ensure_array_like: As, + group_outros: O0, + init: W0, + insert: Vn, + listen: $i, + prevent_default: V0, + run_all: P0, + safe_not_equal: Z0, + set_data: K0, + set_style: rn, + space: eo, + text: G0, + toggle_class: et, + transition_in: Ti, + transition_out: Ls +} = window.__gradio__svelte__internal, { createEventDispatcher: J0 } = window.__gradio__svelte__internal; +function Ds(l, e, t) { + const n = l.slice(); + return n[26] = e[t], n; +} +function Rs(l) { + let e, t, n, i, o, s = As( + /*filtered_indices*/ + l[1] + ), r = []; + for (let a = 0; a < s.length; a += 1) + r[a] = Ts(Ds(l, s, a)); + return { + c() { + e = Ul("ul"); + for (let a = 0; a < r.length; a += 1) + r[a].c(); + Re(e, "class", "options svelte-yuohum"), Re(e, "role", "listbox"), rn( + e, + "bottom", + /*bottom*/ + l[9] + ), rn(e, "max-height", `calc(${/*max_height*/ + l[10]}px - var(--window-padding))`), rn( + e, + "width", + /*input_width*/ + l[8] + "px" + ); + }, + m(a, f) { + Vn(a, e, f); + for (let u = 0; u < r.length; u += 1) + r[u] && r[u].m(e, null); + l[22](e), n = !0, i || (o = $i(e, "mousedown", V0( + /*mousedown_handler*/ + l[21] + )), i = !0); + }, + p(a, f) { + if (f & /*filtered_indices, choices, selected_indices, active_index*/ + 51) { + s = As( + /*filtered_indices*/ + a[1] + ); + let u; + for (u = 0; u < s.length; u += 1) { + const c = Ds(a, s, u); + r[u] ? r[u].p(c, f) : (r[u] = Ts(c), r[u].c(), r[u].m(e, null)); + } + for (; u < r.length; u += 1) + r[u].d(1); + r.length = s.length; + } + f & /*bottom*/ + 512 && rn( + e, + "bottom", + /*bottom*/ + a[9] + ), f & /*max_height*/ + 1024 && rn(e, "max-height", `calc(${/*max_height*/ + a[10]}px - var(--window-padding))`), f & /*input_width*/ + 256 && rn( + e, + "width", + /*input_width*/ + a[8] + "px" + ); + }, + i(a) { + n || (a && ar(() => { + n && (t || (t = Ms(e, Yo, { duration: 200, y: 5 }, !0)), t.run(1)); + }), n = !0); + }, + o(a) { + a && (t || (t = Ms(e, Yo, { duration: 200, y: 5 }, !1)), t.run(0)), n = !1; + }, + d(a) { + a && Wn(e), N0(r, a), l[22](null), a && t && t.end(), i = !1, o(); + } + }; +} +function Ts(l) { + let e, t, n, i = ( + /*choices*/ + l[0][ + /*index*/ + l[26] + ][0] + "" + ), o, s, r, a, f; + return { + c() { + e = Ul("li"), t = Ul("span"), t.textContent = "✓", n = eo(), o = G0(i), s = eo(), Re(t, "class", "inner-item svelte-yuohum"), et(t, "hide", !/*selected_indices*/ + l[4].includes( + /*index*/ + l[26] + )), Re(e, "class", "item svelte-yuohum"), Re(e, "data-index", r = /*index*/ + l[26]), Re(e, "aria-label", a = /*choices*/ + l[0][ + /*index*/ + l[26] + ][0]), Re(e, "data-testid", "dropdown-option"), Re(e, "role", "option"), Re(e, "aria-selected", f = /*selected_indices*/ + l[4].includes( + /*index*/ + l[26] + )), et( + e, + "selected", + /*selected_indices*/ + l[4].includes( + /*index*/ + l[26] + ) + ), et( + e, + "active", + /*index*/ + l[26] === /*active_index*/ + l[5] + ), et( + e, + "bg-gray-100", + /*index*/ + l[26] === /*active_index*/ + l[5] + ), et( + e, + "dark:bg-gray-600", + /*index*/ + l[26] === /*active_index*/ + l[5] + ); + }, + m(u, c) { + Vn(u, e, c), bl(e, t), bl(e, n), bl(e, o), bl(e, s); + }, + p(u, c) { + c & /*selected_indices, filtered_indices*/ + 18 && et(t, "hide", !/*selected_indices*/ + u[4].includes( + /*index*/ + u[26] + )), c & /*choices, filtered_indices*/ + 3 && i !== (i = /*choices*/ + u[0][ + /*index*/ + u[26] + ][0] + "") && K0(o, i), c & /*filtered_indices*/ + 2 && r !== (r = /*index*/ + u[26]) && Re(e, "data-index", r), c & /*choices, filtered_indices*/ + 3 && a !== (a = /*choices*/ + u[0][ + /*index*/ + u[26] + ][0]) && Re(e, "aria-label", a), c & /*selected_indices, filtered_indices*/ + 18 && f !== (f = /*selected_indices*/ + u[4].includes( + /*index*/ + u[26] + )) && Re(e, "aria-selected", f), c & /*selected_indices, filtered_indices*/ + 18 && et( + e, + "selected", + /*selected_indices*/ + u[4].includes( + /*index*/ + u[26] + ) + ), c & /*filtered_indices, active_index*/ + 34 && et( + e, + "active", + /*index*/ + u[26] === /*active_index*/ + u[5] + ), c & /*filtered_indices, active_index*/ + 34 && et( + e, + "bg-gray-100", + /*index*/ + u[26] === /*active_index*/ + u[5] + ), c & /*filtered_indices, active_index*/ + 34 && et( + e, + "dark:bg-gray-600", + /*index*/ + u[26] === /*active_index*/ + u[5] + ); + }, + d(u) { + u && Wn(e); + } + }; +} +function Q0(l) { + let e, t, n, i, o; + ar( + /*onwindowresize*/ + l[19] + ); + let s = ( + /*show_options*/ + l[2] && !/*disabled*/ + l[3] && Rs(l) + ); + return { + c() { + e = Ul("div"), t = eo(), s && s.c(), n = U0(), Re(e, "class", "reference"); + }, + m(r, a) { + Vn(r, e, a), l[20](e), Vn(r, t, a), s && s.m(r, a), Vn(r, n, a), i || (o = [ + $i( + window, + "scroll", + /*scroll_listener*/ + l[12] + ), + $i( + window, + "resize", + /*onwindowresize*/ + l[19] + ) + ], i = !0); + }, + p(r, [a]) { + /*show_options*/ + r[2] && !/*disabled*/ + r[3] ? s ? (s.p(r, a), a & /*show_options, disabled*/ + 12 && Ti(s, 1)) : (s = Rs(r), s.c(), Ti(s, 1), s.m(n.parentNode, n)) : s && (O0(), Ls(s, 1, 1, () => { + s = null; + }), Y0()); + }, + i(r) { + Ti(s); + }, + o(r) { + Ls(s); + }, + d(r) { + r && (Wn(e), Wn(t), Wn(n)), l[20](null), s && s.d(r), i = !1, P0(o); + } + }; +} +function x0(l, e, t) { + var n, i; + let { choices: o } = e, { filtered_indices: s } = e, { show_options: r = !1 } = e, { disabled: a = !1 } = e, { selected_indices: f = [] } = e, { active_index: u = null } = e, c, _, d, h, m, w, b, p, g; + function v() { + const { top: R, bottom: U } = m.getBoundingClientRect(); + t(16, c = R), t(17, _ = g - U); + } + let E = null; + function y() { + r && (E !== null && clearTimeout(E), E = setTimeout( + () => { + v(), E = null; + }, + 10 + )); + } + const C = J0(); + function k() { + t(11, g = window.innerHeight); + } + function A(R) { + Es[R ? "unshift" : "push"](() => { + m = R, t(6, m); + }); + } + const S = (R) => C("change", R); + function T(R) { + Es[R ? "unshift" : "push"](() => { + w = R, t(7, w); + }); + } + return l.$$set = (R) => { + "choices" in R && t(0, o = R.choices), "filtered_indices" in R && t(1, s = R.filtered_indices), "show_options" in R && t(2, r = R.show_options), "disabled" in R && t(3, a = R.disabled), "selected_indices" in R && t(4, f = R.selected_indices), "active_index" in R && t(5, u = R.active_index); + }, l.$$.update = () => { + if (l.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ + 508116) { + if (r && m) { + if (w && f.length > 0) { + let U = w.querySelectorAll("li"); + for (const Z of Array.from(U)) + if (Z.getAttribute("data-index") === f[0].toString()) { + t(14, n = w == null ? void 0 : w.scrollTo) === null || n === void 0 || n.call(w, 0, Z.offsetTop); + break; + } + } + v(); + const R = t(15, i = m.parentElement) === null || i === void 0 ? void 0 : i.getBoundingClientRect(); + t(18, d = (R == null ? void 0 : R.height) || 0), t(8, h = (R == null ? void 0 : R.width) || 0); + } + _ > c ? (t(10, p = _), t(9, b = null)) : (t(9, b = `${_ + d}px`), t(10, p = c - d)); + } + }, [ + o, + s, + r, + a, + f, + u, + m, + w, + h, + b, + p, + g, + y, + C, + n, + i, + c, + _, + d, + k, + A, + S, + T + ]; +} +class $0 extends X0 { + constructor(e) { + super(), W0(this, e, x0, Q0, Z0, { + choices: 0, + filtered_indices: 1, + show_options: 2, + disabled: 3, + selected_indices: 4, + active_index: 5 + }); + } +} +function eh(l, e) { + return (l % e + e) % e; +} +function Is(l, e) { + return l.reduce((t, n, i) => ((!e || n[0].toLowerCase().includes(e.toLowerCase())) && t.push(i), t), []); +} +function th(l, e, t) { + l("change", e), t || l("input"); +} +function nh(l, e, t) { + if (l.key === "Escape") + return [!1, e]; + if ((l.key === "ArrowDown" || l.key === "ArrowUp") && t.length >= 0) + if (e === null) + e = l.key === "ArrowDown" ? t[0] : t[t.length - 1]; + else { + const n = t.indexOf(e), i = l.key === "ArrowUp" ? -1 : 1; + e = t[eh(n + i, t.length)]; + } + return [!0, e]; +} +const { + SvelteComponent: lh, + append: It, + attr: De, + binding_callbacks: ih, + check_outros: oh, + create_component: to, + destroy_component: no, + detach: _o, + element: cn, + group_outros: sh, + init: ah, + insert: ho, + listen: En, + mount_component: lo, + run_all: rh, + safe_not_equal: fh, + set_data: uh, + set_input_value: js, + space: Ii, + text: ch, + toggle_class: fn, + transition_in: _n, + transition_out: In +} = window.__gradio__svelte__internal, { onMount: _h } = window.__gradio__svelte__internal, { createEventDispatcher: dh, afterUpdate: hh } = window.__gradio__svelte__internal; +function mh(l) { + let e; + return { + c() { + e = ch( + /*label*/ + l[0] + ); + }, + m(t, n) { + ho(t, e, n); + }, + p(t, n) { + n[0] & /*label*/ + 1 && uh( + e, + /*label*/ + t[0] + ); + }, + d(t) { + t && _o(e); + } + }; +} +function Hs(l) { + let e, t, n; + return t = new io({}), { + c() { + e = cn("div"), to(t.$$.fragment), De(e, "class", "icon-wrap svelte-1m1zvyj"); + }, + m(i, o) { + ho(i, e, o), lo(t, e, null), n = !0; + }, + i(i) { + n || (_n(t.$$.fragment, i), n = !0); + }, + o(i) { + In(t.$$.fragment, i), n = !1; + }, + d(i) { + i && _o(e), no(t); + } + }; +} +function gh(l) { + let e, t, n, i, o, s, r, a, f, u, c, _, d, h; + t = new aa({ + props: { + show_label: ( + /*show_label*/ + l[4] + ), + info: ( + /*info*/ + l[1] + ), + $$slots: { default: [mh] }, + $$scope: { ctx: l } + } + }); + let m = !/*disabled*/ + l[3] && Hs(); + return c = new $0({ + props: { + show_options: ( + /*show_options*/ + l[12] + ), + choices: ( + /*choices*/ + l[2] + ), + filtered_indices: ( + /*filtered_indices*/ + l[10] + ), + disabled: ( + /*disabled*/ + l[3] + ), + selected_indices: ( + /*selected_index*/ + l[11] === null ? [] : [ + /*selected_index*/ + l[11] + ] + ), + active_index: ( + /*active_index*/ + l[14] + ) + } + }), c.$on( + "change", + /*handle_option_selected*/ + l[16] + ), { + c() { + e = cn("div"), to(t.$$.fragment), n = Ii(), i = cn("div"), o = cn("div"), s = cn("div"), r = cn("input"), f = Ii(), m && m.c(), u = Ii(), to(c.$$.fragment), De(r, "role", "listbox"), De(r, "aria-controls", "dropdown-options"), De( + r, + "aria-expanded", + /*show_options*/ + l[12] + ), De( + r, + "aria-label", + /*label*/ + l[0] + ), De(r, "class", "border-none svelte-1m1zvyj"), r.disabled = /*disabled*/ + l[3], De(r, "autocomplete", "off"), r.readOnly = a = !/*filterable*/ + l[7], fn(r, "subdued", !/*choices_names*/ + l[13].includes( + /*input_text*/ + l[9] + ) && !/*allow_custom_value*/ + l[6]), De(s, "class", "secondary-wrap svelte-1m1zvyj"), De(o, "class", "wrap-inner svelte-1m1zvyj"), fn( + o, + "show_options", + /*show_options*/ + l[12] + ), De(i, "class", "wrap svelte-1m1zvyj"), De(e, "class", "svelte-1m1zvyj"), fn( + e, + "container", + /*container*/ + l[5] + ); + }, + m(w, b) { + ho(w, e, b), lo(t, e, null), It(e, n), It(e, i), It(i, o), It(o, s), It(s, r), js( + r, + /*input_text*/ + l[9] + ), l[29](r), It(s, f), m && m.m(s, null), It(i, u), lo(c, i, null), _ = !0, d || (h = [ + En( + r, + "input", + /*input_input_handler*/ + l[28] + ), + En( + r, + "keydown", + /*handle_key_down*/ + l[19] + ), + En( + r, + "keyup", + /*keyup_handler*/ + l[30] + ), + En( + r, + "blur", + /*handle_blur*/ + l[18] + ), + En( + r, + "focus", + /*handle_focus*/ + l[17] + ) + ], d = !0); + }, + p(w, b) { + const p = {}; + b[0] & /*show_label*/ + 16 && (p.show_label = /*show_label*/ + w[4]), b[0] & /*info*/ + 2 && (p.info = /*info*/ + w[1]), b[0] & /*label*/ + 1 | b[1] & /*$$scope*/ + 4 && (p.$$scope = { dirty: b, ctx: w }), t.$set(p), (!_ || b[0] & /*show_options*/ + 4096) && De( + r, + "aria-expanded", + /*show_options*/ + w[12] + ), (!_ || b[0] & /*label*/ + 1) && De( + r, + "aria-label", + /*label*/ + w[0] + ), (!_ || b[0] & /*disabled*/ + 8) && (r.disabled = /*disabled*/ + w[3]), (!_ || b[0] & /*filterable*/ + 128 && a !== (a = !/*filterable*/ + w[7])) && (r.readOnly = a), b[0] & /*input_text*/ + 512 && r.value !== /*input_text*/ + w[9] && js( + r, + /*input_text*/ + w[9] + ), (!_ || b[0] & /*choices_names, input_text, allow_custom_value*/ + 8768) && fn(r, "subdued", !/*choices_names*/ + w[13].includes( + /*input_text*/ + w[9] + ) && !/*allow_custom_value*/ + w[6]), /*disabled*/ + w[3] ? m && (sh(), In(m, 1, 1, () => { + m = null; + }), oh()) : m ? b[0] & /*disabled*/ + 8 && _n(m, 1) : (m = Hs(), m.c(), _n(m, 1), m.m(s, null)), (!_ || b[0] & /*show_options*/ + 4096) && fn( + o, + "show_options", + /*show_options*/ + w[12] + ); + const g = {}; + b[0] & /*show_options*/ + 4096 && (g.show_options = /*show_options*/ + w[12]), b[0] & /*choices*/ + 4 && (g.choices = /*choices*/ + w[2]), b[0] & /*filtered_indices*/ + 1024 && (g.filtered_indices = /*filtered_indices*/ + w[10]), b[0] & /*disabled*/ + 8 && (g.disabled = /*disabled*/ + w[3]), b[0] & /*selected_index*/ + 2048 && (g.selected_indices = /*selected_index*/ + w[11] === null ? [] : [ + /*selected_index*/ + w[11] + ]), b[0] & /*active_index*/ + 16384 && (g.active_index = /*active_index*/ + w[14]), c.$set(g), (!_ || b[0] & /*container*/ + 32) && fn( + e, + "container", + /*container*/ + w[5] + ); + }, + i(w) { + _ || (_n(t.$$.fragment, w), _n(m), _n(c.$$.fragment, w), _ = !0); + }, + o(w) { + In(t.$$.fragment, w), In(m), In(c.$$.fragment, w), _ = !1; + }, + d(w) { + w && _o(e), no(t), l[29](null), m && m.d(), no(c), d = !1, rh(h); + } + }; +} +function bh(l, e, t) { + let { label: n } = e, { info: i = void 0 } = e, { value: o = [] } = e, s = [], { value_is_output: r = !1 } = e, { choices: a } = e, f, { disabled: u = !1 } = e, { show_label: c } = e, { container: _ = !0 } = e, { allow_custom_value: d = !1 } = e, { filterable: h = !0 } = e, m, w = !1, b, p, g = "", v = "", E = !1, y = [], C = null, k = null, A; + const S = dh(); + o ? (A = a.map((D) => D[1]).indexOf(o), k = A, k === -1 ? (s = o, k = null) : ([g, s] = a[k], v = g), R()) : a.length > 0 && (A = 0, k = 0, [g, o] = a[k], s = o, v = g); + function T() { + t(13, b = a.map((D) => D[0])), t(24, p = a.map((D) => D[1])); + } + function R() { + T(), o === void 0 || Array.isArray(o) && o.length === 0 ? (t(9, g = ""), t(11, k = null)) : p.includes(o) ? (t(9, g = b[p.indexOf(o)]), t(11, k = p.indexOf(o))) : d ? (t(9, g = o), t(11, k = null)) : (t(9, g = ""), t(11, k = null)), t(27, A = k); + } + function U(D) { + if (t(11, k = parseInt(D.detail.target.dataset.index)), isNaN(k)) { + t(11, k = null); + return; + } + t(12, w = !1), t(14, C = null), m.blur(); + } + function Z(D) { + t(10, y = a.map((W, $) => $)), t(12, w = !0), S("focus"); + } + function Q() { + d ? t(20, o = g) : t(9, g = b[p.indexOf(o)]), t(12, w = !1), t(14, C = null), S("blur"); + } + function J(D) { + t(12, [w, C] = nh(D, C, y), w, (t(14, C), t(2, a), t(23, f), t(6, d), t(9, g), t(10, y), t(8, m), t(25, v), t(11, k), t(27, A), t(26, E), t(24, p))), D.key === "Enter" && (C !== null ? (t(11, k = C), t(12, w = !1), m.blur(), t(14, C = null)) : b.includes(g) ? (t(11, k = b.indexOf(g)), t(12, w = !1), t(14, C = null), m.blur()) : d && (t(20, o = g), t(11, k = null), t(12, w = !1), t(14, C = null), m.blur()), S("enter", o)); + } + hh(() => { + t(21, r = !1), t(26, E = !0); + }), _h(() => { + m.focus(); + }); + function K() { + g = this.value, t(9, g), t(11, k), t(27, A), t(26, E), t(2, a), t(24, p); + } + function L(D) { + ih[D ? "unshift" : "push"](() => { + m = D, t(8, m); + }); + } + const F = (D) => S("key_up", { key: D.key, input_value: g }); + return l.$$set = (D) => { + "label" in D && t(0, n = D.label), "info" in D && t(1, i = D.info), "value" in D && t(20, o = D.value), "value_is_output" in D && t(21, r = D.value_is_output), "choices" in D && t(2, a = D.choices), "disabled" in D && t(3, u = D.disabled), "show_label" in D && t(4, c = D.show_label), "container" in D && t(5, _ = D.container), "allow_custom_value" in D && t(6, d = D.allow_custom_value), "filterable" in D && t(7, h = D.filterable); + }, l.$$.update = () => { + l.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/ + 218105860 && k !== A && k !== null && E && (t(9, [g, o] = a[k], g, (t(20, o), t(11, k), t(27, A), t(26, E), t(2, a), t(24, p))), t(27, A = k), S("select", { + index: k, + value: p[k], + selected: !0 + })), l.$$.dirty[0] & /*value, old_value, value_is_output*/ + 7340032 && o != s && (R(), th(S, o, r), t(22, s = o)), l.$$.dirty[0] & /*choices*/ + 4 && T(), l.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ + 8390468 && a !== f && (d || R(), t(23, f = a), t(10, y = Is(a, g)), !d && y.length > 0 && t(14, C = y[0]), m == document.activeElement && t(12, w = !0)), l.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ + 33556036 && g !== v && (t(10, y = Is(a, g)), t(25, v = g), !d && y.length > 0 && t(14, C = y[0])); + }, [ + n, + i, + a, + u, + c, + _, + d, + h, + m, + g, + y, + k, + w, + b, + C, + S, + U, + Z, + Q, + J, + o, + r, + s, + f, + p, + v, + E, + A, + K, + L, + F + ]; +} +class wh extends lh { + constructor(e) { + super(), ah( + this, + e, + bh, + gh, + fh, + { + label: 0, + info: 1, + value: 20, + value_is_output: 21, + choices: 2, + disabled: 3, + show_label: 4, + container: 5, + allow_custom_value: 6, + filterable: 7 + }, + null, + [-1, -1] + ); + } +} +const { + SvelteComponent: ph, + append: tt, + attr: wl, + check_outros: vh, + create_component: jn, + destroy_component: Hn, + detach: ll, + element: Bt, + group_outros: kh, + init: yh, + insert: il, + mount_component: Fn, + safe_not_equal: Ch, + set_style: Xn, + space: pl, + text: mo, + transition_in: qt, + transition_out: Ft +} = window.__gradio__svelte__internal, { createEventDispatcher: Sh } = window.__gradio__svelte__internal, { onMount: zh, onDestroy: Bh } = window.__gradio__svelte__internal; +function qh(l) { + let e; + return { + c() { + e = mo("Cancel"); + }, + m(t, n) { + il(t, e, n); + }, + d(t) { + t && ll(e); + } + }; +} +function Fs(l) { + let e, t, n; + return t = new xi({ + props: { + variant: "stop", + $$slots: { default: [Eh] }, + $$scope: { ctx: l } + } + }), t.$on( + "click", + /*click_handler_1*/ + l[12] + ), { + c() { + e = Bt("div"), jn(t.$$.fragment), Xn(e, "margin-right", "8px"); + }, + m(i, o) { + il(i, e, o), Fn(t, e, null), n = !0; + }, + p(i, o) { + const s = {}; + o & /*$$scope*/ + 65536 && (s.$$scope = { dirty: o, ctx: i }), t.$set(s); + }, + i(i) { + n || (qt(t.$$.fragment, i), n = !0); + }, + o(i) { + Ft(t.$$.fragment, i), n = !1; + }, + d(i) { + i && ll(e), Hn(t); + } + }; +} +function Eh(l) { + let e; + return { + c() { + e = mo("Remove"); + }, + m(t, n) { + il(t, e, n); + }, + d(t) { + t && ll(e); + } + }; +} +function Mh(l) { + let e; + return { + c() { + e = mo("OK"); + }, + m(t, n) { + il(t, e, n); + }, + d(t) { + t && ll(e); + } + }; +} +function Ah(l) { + let e, t, n, i, o, s, r, a, f, u, c, _, d, h, m, w; + o = new wh({ + props: { + value: ( + /*currentLabel*/ + l[0] + ), + label: "Label", + choices: ( + /*choices*/ + l[2] + ), + show_label: !1, + allow_custom_value: !0 + } + }), o.$on( + "change", + /*onDropDownChange*/ + l[5] + ), o.$on( + "enter", + /*onDropDownEnter*/ + l[7] + ), a = new B0({ + props: { + value: ( + /*currentColor*/ + l[1] + ), + label: "Color", + show_label: !1 + } + }), a.$on( + "change", + /*onColorChange*/ + l[6] + ), c = new xi({ + props: { + $$slots: { default: [qh] }, + $$scope: { ctx: l } + } + }), c.$on( + "click", + /*click_handler*/ + l[11] + ); + let b = ( + /*showRemove*/ + l[3] && Fs(l) + ); + return m = new xi({ + props: { + variant: "primary", + $$slots: { default: [Mh] }, + $$scope: { ctx: l } + } + }), m.$on( + "click", + /*click_handler_2*/ + l[13] + ), { + c() { + e = Bt("div"), t = Bt("div"), n = Bt("span"), i = Bt("div"), jn(o.$$.fragment), s = pl(), r = Bt("div"), jn(a.$$.fragment), f = pl(), u = Bt("div"), jn(c.$$.fragment), _ = pl(), b && b.c(), d = pl(), h = Bt("div"), jn(m.$$.fragment), Xn(i, "margin-right", "10px"), Xn(r, "margin-right", "40px"), Xn(r, "margin-bottom", "8px"), Xn(u, "margin-right", "8px"), wl(n, "class", "model-content svelte-hkn2q1"), wl(t, "class", "modal-container svelte-hkn2q1"), wl(e, "class", "modal svelte-hkn2q1"), wl(e, "id", "model-box-edit"); + }, + m(p, g) { + il(p, e, g), tt(e, t), tt(t, n), tt(n, i), Fn(o, i, null), tt(n, s), tt(n, r), Fn(a, r, null), tt(n, f), tt(n, u), Fn(c, u, null), tt(n, _), b && b.m(n, null), tt(n, d), tt(n, h), Fn(m, h, null), w = !0; + }, + p(p, [g]) { + const v = {}; + g & /*currentLabel*/ + 1 && (v.value = /*currentLabel*/ + p[0]), g & /*choices*/ + 4 && (v.choices = /*choices*/ + p[2]), o.$set(v); + const E = {}; + g & /*currentColor*/ + 2 && (E.value = /*currentColor*/ + p[1]), a.$set(E); + const y = {}; + g & /*$$scope*/ + 65536 && (y.$$scope = { dirty: g, ctx: p }), c.$set(y), /*showRemove*/ + p[3] ? b ? (b.p(p, g), g & /*showRemove*/ + 8 && qt(b, 1)) : (b = Fs(p), b.c(), qt(b, 1), b.m(n, d)) : b && (kh(), Ft(b, 1, 1, () => { + b = null; + }), vh()); + const C = {}; + g & /*$$scope*/ + 65536 && (C.$$scope = { dirty: g, ctx: p }), m.$set(C); + }, + i(p) { + w || (qt(o.$$.fragment, p), qt(a.$$.fragment, p), qt(c.$$.fragment, p), qt(b), qt(m.$$.fragment, p), w = !0); + }, + o(p) { + Ft(o.$$.fragment, p), Ft(a.$$.fragment, p), Ft(c.$$.fragment, p), Ft(b), Ft(m.$$.fragment, p), w = !1; + }, + d(p) { + p && ll(e), Hn(o), Hn(a), Hn(c), b && b.d(), Hn(m); + } + }; +} +function Lh(l, e, t) { + let { label: n = "" } = e, { currentLabel: i = "" } = e, { choices: o = [] } = e, { choicesColors: s = [] } = e, { color: r = "" } = e, { currentColor: a = "" } = e, { showRemove: f = !0 } = e; + const u = Sh(); + function c(g) { + u("change", { + label: i, + color: a, + ret: g + // -1: remove, 0: cancel, 1: change + }); + } + function _(g) { + const { detail: v } = g; + let E = v; + Number.isInteger(E) ? (Array.isArray(s) && E < s.length && t(1, a = s[E]), Array.isArray(o) && E < o.length && t(0, i = o[E][0])) : t(0, i = E); + } + function d(g) { + const { detail: v } = g; + t(1, a = v); + } + function h(g) { + _(g), c(1); + } + function m(g) { + switch (g.key) { + case "Enter": + c(1); + break; + } + } + zh(() => { + document.addEventListener("keydown", m), t(0, i = n), t(1, a = r); + }), Bh(() => { + document.removeEventListener("keydown", m); + }); + const w = () => c(0), b = () => c(-1), p = () => c(1); + return l.$$set = (g) => { + "label" in g && t(8, n = g.label), "currentLabel" in g && t(0, i = g.currentLabel), "choices" in g && t(2, o = g.choices), "choicesColors" in g && t(9, s = g.choicesColors), "color" in g && t(10, r = g.color), "currentColor" in g && t(1, a = g.currentColor), "showRemove" in g && t(3, f = g.showRemove); + }, [ + i, + a, + o, + f, + c, + _, + d, + h, + n, + s, + r, + w, + b, + p + ]; +} +class rr extends ph { + constructor(e) { + super(), yh(this, e, Lh, Ah, Ch, { + label: 8, + currentLabel: 0, + choices: 2, + choicesColors: 9, + color: 10, + currentColor: 1, + showRemove: 3 + }); + } +} +const _e = (l, e, t) => Math.min(Math.max(l, e), t); +function ji(l, e) { + if (l.startsWith("rgba")) + return l.replace(/[\d.]+$/, e.toString()); + const t = l.match(/\d+/g); + if (!t || t.length !== 3) + return `rgba(50, 50, 50, ${e})`; + const [n, i, o] = t; + return `rgba(${n}, ${i}, ${o}, ${e})`; +} +class Hi { + constructor(e, t, n, i, o, s, r, a, f, u, c, _ = "rgb(255, 255, 255)", d = 0.5, h = 25, m = 8, w = 2, b = 4, p = 1) { + this.stopDrag = () => { + this.isDragging = !1, document.removeEventListener("pointermove", this.handleDrag), document.removeEventListener("pointerup", this.stopDrag); + }, this.handleDrag = (g) => { + if (this.isDragging) { + let v = g.clientX - this.offsetMouseX - this.xmin, E = g.clientY - this.offsetMouseY - this.ymin; + const y = this.canvasXmax - this.canvasXmin, C = this.canvasYmax - this.canvasYmin; + v = _e(v, -this.xmin, y - this.xmax), E = _e(E, -this.ymin, C - this.ymax), this.xmin += v, this.ymin += E, this.xmax += v, this.ymax += E, this.updateHandles(), this.renderCallBack(); + } + }, this.handleCreating = (g) => { + if (this.isCreating) { + let [v, E] = this.toBoxCoordinates(g.clientX, g.clientY); + v -= this.offsetMouseX, E -= this.offsetMouseY, v > this.xmax ? (this.creatingAnchorX == "xmax" && (this.xmin = this.xmax), this.xmax = v, this.creatingAnchorX = "xmin") : v > this.xmin && v < this.xmax && this.creatingAnchorX == "xmin" ? this.xmax = v : v > this.xmin && v < this.xmax && this.creatingAnchorX == "xmax" ? this.xmin = v : v < this.xmin && (this.creatingAnchorX == "xmin" && (this.xmax = this.xmin), this.xmin = v, this.creatingAnchorX = "xmax"), E > this.ymax ? (this.creatingAnchorY == "ymax" && (this.ymin = this.ymax), this.ymax = E, this.creatingAnchorY = "ymin") : E > this.ymin && E < this.ymax && this.creatingAnchorY == "ymin" ? this.ymax = E : E > this.ymin && E < this.ymax && this.creatingAnchorY == "ymax" ? this.ymin = E : E < this.ymin && (this.creatingAnchorY == "ymin" && (this.ymax = this.ymin), this.ymin = E, this.creatingAnchorY = "ymax"), this.updateHandles(), this.renderCallBack(); + } + }, this.stopCreating = (g) => { + if (this.isCreating = !1, document.removeEventListener("pointermove", this.handleCreating), document.removeEventListener("pointerup", this.stopCreating), this.getArea() > 0) { + const v = this.canvasXmax - this.canvasXmin, E = this.canvasYmax - this.canvasYmin; + this.xmin = _e(this.xmin, 0, v - this.minSize), this.ymin = _e(this.ymin, 0, E - this.minSize), this.xmax = _e(this.xmax, this.minSize, v), this.ymax = _e(this.ymax, this.minSize, E), this.minSize > 0 && (this.getWidth() < this.minSize && (this.creatingAnchorX == "xmin" ? this.xmax = this.xmin + this.minSize : this.xmin = this.xmax - this.minSize), this.getHeight() < this.minSize && (this.creatingAnchorY == "ymin" ? this.ymax = this.ymin + this.minSize : this.ymin = this.ymax - this.minSize), this.xmax > v ? (this.xmin -= this.xmax - v, this.xmax = v) : this.xmin < 0 && (this.xmax -= this.xmin, this.xmin = 0), this.ymax > E ? (this.ymin -= this.ymax - E, this.ymax = E) : this.ymin < 0 && (this.ymax -= this.ymin, this.ymin = 0)), this.updateHandles(), this.renderCallBack(); + } + this.onFinishCreation(); + }, this.handleResize = (g) => { + if (this.isResizing) { + const v = g.clientX, E = g.clientY, y = v - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, C = E - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, k = this.canvasXmax - this.canvasXmin, A = this.canvasYmax - this.canvasYmin; + switch (this.resizingHandleIndex) { + case 0: + this.xmin += y, this.ymin += C, this.xmin = _e(this.xmin, 0, this.xmax - this.minSize), this.ymin = _e(this.ymin, 0, this.ymax - this.minSize); + break; + case 1: + this.xmax += y, this.ymin += C, this.xmax = _e(this.xmax, this.xmin + this.minSize, k), this.ymin = _e(this.ymin, 0, this.ymax - this.minSize); + break; + case 2: + this.xmax += y, this.ymax += C, this.xmax = _e(this.xmax, this.xmin + this.minSize, k), this.ymax = _e(this.ymax, this.ymin + this.minSize, A); + break; + case 3: + this.xmin += y, this.ymax += C, this.xmin = _e(this.xmin, 0, this.xmax - this.minSize), this.ymax = _e(this.ymax, this.ymin + this.minSize, A); + break; + case 4: + this.ymin += C, this.ymin = _e(this.ymin, 0, this.ymax - this.minSize); + break; + case 5: + this.xmax += y, this.xmax = _e(this.xmax, this.xmin + this.minSize, k); + break; + case 6: + this.ymax += C, this.ymax = _e(this.ymax, this.ymin + this.minSize, A); + break; + case 7: + this.xmin += y, this.xmin = _e(this.xmin, 0, this.xmax - this.minSize); + break; + } + this.updateHandles(), this.renderCallBack(); + } + }, this.stopResize = () => { + this.isResizing = !1, document.removeEventListener("pointermove", this.handleResize), document.removeEventListener("pointerup", this.stopResize); + }, this.renderCallBack = e, this.onFinishCreation = t, this.canvasXmin = n, this.canvasYmin = i, this.canvasXmax = o, this.canvasYmax = s, this.scaleFactor = p, this.label = r, this.isDragging = !1, this.isCreating = !1, this.xmin = a, this.ymin = f, this.xmax = u, this.ymax = c, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = m, this.thickness = w, this.selectedThickness = b, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = h, this.color = _, this.alpha = d, this.creatingAnchorX = "xmin", this.creatingAnchorY = "ymin"; + } + toJSON() { + return { + label: this.label, + xmin: this.xmin, + ymin: this.ymin, + xmax: this.xmax, + ymax: this.ymax, + color: this.color, + scaleFactor: this.scaleFactor + }; + } + setSelected(e) { + this.isSelected = e; + } + setScaleFactor(e) { + let t = e / this.scaleFactor; + this.xmin = Math.round(this.xmin * t), this.ymin = Math.round(this.ymin * t), this.xmax = Math.round(this.xmax * t), this.ymax = Math.round(this.ymax * t), this.updateHandles(), this.scaleFactor = e; + } + updateHandles() { + const e = this.resizeHandleSize / 2, t = this.getWidth(), n = this.getHeight(); + this.resizeHandles = [ + { + // Top left + xmin: this.xmin - e, + ymin: this.ymin - e, + xmax: this.xmin + e, + ymax: this.ymin + e, + cursor: "nwse-resize" + }, + { + // Top right + xmin: this.xmax - e, + ymin: this.ymin - e, + xmax: this.xmax + e, + ymax: this.ymin + e, + cursor: "nesw-resize" + }, + { + // Bottom right + xmin: this.xmax - e, + ymin: this.ymax - e, + xmax: this.xmax + e, + ymax: this.ymax + e, + cursor: "nwse-resize" + }, + { + // Bottom left + xmin: this.xmin - e, + ymin: this.ymax - e, + xmax: this.xmin + e, + ymax: this.ymax + e, + cursor: "nesw-resize" + }, + { + // Top center + xmin: this.xmin + t / 2 - e, + ymin: this.ymin - e, + xmax: this.xmin + t / 2 + e, + ymax: this.ymin + e, + cursor: "ns-resize" + }, + { + // Right center + xmin: this.xmax - e, + ymin: this.ymin + n / 2 - e, + xmax: this.xmax + e, + ymax: this.ymin + n / 2 + e, + cursor: "ew-resize" + }, + { + // Bottom center + xmin: this.xmin + t / 2 - e, + ymin: this.ymax - e, + xmax: this.xmin + t / 2 + e, + ymax: this.ymax + e, + cursor: "ns-resize" + }, + { + // Left center + xmin: this.xmin - e, + ymin: this.ymin + n / 2 - e, + xmax: this.xmin + e, + ymax: this.ymin + n / 2 + e, + cursor: "ew-resize" + } + ]; + } + getWidth() { + return this.xmax - this.xmin; + } + getHeight() { + return this.ymax - this.ymin; + } + getArea() { + return this.getWidth() * this.getHeight(); + } + toCanvasCoordinates(e, t) { + return e = e + this.canvasXmin, t = t + this.canvasYmin, [e, t]; + } + toBoxCoordinates(e, t) { + return e = e - this.canvasXmin, t = t - this.canvasYmin, [e, t]; + } + render(e) { + let t, n; + if (e.beginPath(), [t, n] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, n, this.getWidth(), this.getHeight()), e.fillStyle = ji(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = ji(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { + this.isSelected ? e.font = "bold 14px Arial" : e.font = "12px Arial"; + const i = e.measureText(this.label).width + 10, o = 20; + let s = this.xmin, r = this.ymin - o; + e.fillStyle = "white", [s, r] = this.toCanvasCoordinates(s, r), e.fillRect(s, r, i, o), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(s, r, i, o), e.fillStyle = "black", e.fillText(this.label, s + 5, r + 15); + } + e.fillStyle = ji(this.color, 1); + for (const i of this.resizeHandles) + [t, n] = this.toCanvasCoordinates(i.xmin, i.ymin), e.fillRect( + t, + n, + i.xmax - i.xmin, + i.ymax - i.ymin + ); + } + startDrag(e) { + this.isDragging = !0, this.offsetMouseX = e.clientX - this.xmin, this.offsetMouseY = e.clientY - this.ymin, document.addEventListener("pointermove", this.handleDrag), document.addEventListener("pointerup", this.stopDrag); + } + isPointInsideBox(e, t) { + return [e, t] = this.toBoxCoordinates(e, t), e >= this.xmin && e <= this.xmax && t >= this.ymin && t <= this.ymax; + } + indexOfPointInsideHandle(e, t) { + [e, t] = this.toBoxCoordinates(e, t); + for (let n = 0; n < this.resizeHandles.length; n++) { + const i = this.resizeHandles[n]; + if (e >= i.xmin && e <= i.xmax && t >= i.ymin && t <= i.ymax) + return this.resizingHandleIndex = n, n; + } + return -1; + } + startCreating(e, t, n) { + this.isCreating = !0, this.offsetMouseX = t, this.offsetMouseY = n, document.addEventListener("pointermove", this.handleCreating), document.addEventListener("pointerup", this.stopCreating); + } + startResize(e, t) { + this.resizingHandleIndex = e, this.isResizing = !0, this.offsetMouseX = t.clientX - this.resizeHandles[e].xmin, this.offsetMouseY = t.clientY - this.resizeHandles[e].ymin, document.addEventListener("pointermove", this.handleResize), document.addEventListener("pointerup", this.stopResize); + } +} +const jt = [ + "rgb(255, 168, 77)", + "rgb(92, 172, 238)", + "rgb(255, 99, 71)", + "rgb(118, 238, 118)", + "rgb(255, 145, 164)", + "rgb(0, 191, 255)", + "rgb(255, 218, 185)", + "rgb(255, 69, 0)", + "rgb(34, 139, 34)", + "rgb(255, 240, 245)", + "rgb(255, 193, 37)", + "rgb(255, 193, 7)", + "rgb(255, 250, 138)" +], { + SvelteComponent: Dh, + append: Yn, + attr: nt, + binding_callbacks: Rh, + bubble: Xs, + check_outros: Ml, + create_component: Gn, + destroy_component: Jn, + detach: Ot, + element: bn, + empty: Th, + group_outros: Al, + init: Ih, + insert: Wt, + is_function: jh, + listen: ut, + mount_component: Qn, + noop: Hh, + run_all: fr, + safe_not_equal: Fh, + set_style: vl, + space: Pn, + toggle_class: kl, + transition_in: me, + transition_out: Te +} = window.__gradio__svelte__internal, { onMount: Xh, onDestroy: Yh, createEventDispatcher: Nh } = window.__gradio__svelte__internal; +function Ys(l) { + let e, t, n, i, o, s, r, a, f, u; + n = new P1({}), s = new e0({}); + let c = ( + /*showRemoveButton*/ + l[1] && Ns(l) + ); + return { + c() { + e = bn("span"), t = bn("button"), Gn(n.$$.fragment), i = Pn(), o = bn("button"), Gn(s.$$.fragment), r = Pn(), c && c.c(), nt(t, "class", "icon svelte-1m8vz1h"), nt(t, "aria-label", "Create box"), kl( + t, + "selected", + /*mode*/ + l[11] === /*Mode*/ + l[8].creation + ), nt(o, "class", "icon svelte-1m8vz1h"), nt(o, "aria-label", "Edit boxes"), kl( + o, + "selected", + /*mode*/ + l[11] === /*Mode*/ + l[8].drag + ), nt(e, "class", "canvas-control svelte-1m8vz1h"); + }, + m(_, d) { + Wt(_, e, d), Yn(e, t), Qn(n, t, null), Yn(e, i), Yn(e, o), Qn(s, o, null), Yn(e, r), c && c.m(e, null), a = !0, f || (u = [ + ut( + t, + "click", + /*click_handler*/ + l[34] + ), + ut( + o, + "click", + /*click_handler_1*/ + l[35] + ) + ], f = !0); + }, + p(_, d) { + (!a || d[0] & /*mode, Mode*/ + 2304) && kl( + t, + "selected", + /*mode*/ + _[11] === /*Mode*/ + _[8].creation + ), (!a || d[0] & /*mode, Mode*/ + 2304) && kl( + o, + "selected", + /*mode*/ + _[11] === /*Mode*/ + _[8].drag + ), /*showRemoveButton*/ + _[1] ? c ? (c.p(_, d), d[0] & /*showRemoveButton*/ + 2 && me(c, 1)) : (c = Ns(_), c.c(), me(c, 1), c.m(e, null)) : c && (Al(), Te(c, 1, 1, () => { + c = null; + }), Ml()); + }, + i(_) { + a || (me(n.$$.fragment, _), me(s.$$.fragment, _), me(c), a = !0); + }, + o(_) { + Te(n.$$.fragment, _), Te(s.$$.fragment, _), Te(c), a = !1; + }, + d(_) { + _ && Ot(e), Jn(n), Jn(s), c && c.d(), f = !1, fr(u); + } + }; +} +function Ns(l) { + let e, t, n, i, o; + return t = new r0({}), { + c() { + e = bn("button"), Gn(t.$$.fragment), nt(e, "class", "icon svelte-1m8vz1h"), nt(e, "aria-label", "Remove boxes"); + }, + m(s, r) { + Wt(s, e, r), Qn(t, e, null), n = !0, i || (o = ut( + e, + "click", + /*click_handler_2*/ + l[36] + ), i = !0); + }, + p: Hh, + i(s) { + n || (me(t.$$.fragment, s), n = !0); + }, + o(s) { + Te(t.$$.fragment, s), n = !1; + }, + d(s) { + s && Ot(e), Jn(t), i = !1, o(); + } + }; +} +function Us(l) { + let e, t; + return e = new rr({ + props: { + choices: ( + /*choices*/ + l[3] + ), + choicesColors: ( + /*choicesColors*/ + l[4] + ), + label: ( + /*selectedBox*/ + l[10] >= 0 && /*selectedBox*/ + l[10] < /*value*/ + l[0].boxes.length ? ( + /*value*/ + l[0].boxes[ + /*selectedBox*/ + l[10] + ].label + ) : "" + ), + color: ( + /*selectedBox*/ + l[10] >= 0 && /*selectedBox*/ + l[10] < /*value*/ + l[0].boxes.length ? xn( + /*value*/ + l[0].boxes[ + /*selectedBox*/ + l[10] + ].color + ) : "" + ) + } + }), e.$on( + "change", + /*onModalEditChange*/ + l[20] + ), e.$on( + "enter{onModalEditChange}", + /*enter_onModalEditChange_handler*/ + l[37] + ), { + c() { + Gn(e.$$.fragment); + }, + m(n, i) { + Qn(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*choices*/ + 8 && (o.choices = /*choices*/ + n[3]), i[0] & /*choicesColors*/ + 16 && (o.choicesColors = /*choicesColors*/ + n[4]), i[0] & /*selectedBox, value*/ + 1025 && (o.label = /*selectedBox*/ + n[10] >= 0 && /*selectedBox*/ + n[10] < /*value*/ + n[0].boxes.length ? ( + /*value*/ + n[0].boxes[ + /*selectedBox*/ + n[10] + ].label + ) : ""), i[0] & /*selectedBox, value*/ + 1025 && (o.color = /*selectedBox*/ + n[10] >= 0 && /*selectedBox*/ + n[10] < /*value*/ + n[0].boxes.length ? xn( + /*value*/ + n[0].boxes[ + /*selectedBox*/ + n[10] + ].color + ) : ""), e.$set(o); + }, + i(n) { + t || (me(e.$$.fragment, n), t = !0); + }, + o(n) { + Te(e.$$.fragment, n), t = !1; + }, + d(n) { + Jn(e, n); + } + }; +} +function Os(l) { + let e, t; + return e = new rr({ + props: { + choices: ( + /*choices*/ + l[3] + ), + showRemove: !1, + choicesColors: ( + /*choicesColors*/ + l[4] + ), + label: ( + /*selectedBox*/ + l[10] >= 0 && /*selectedBox*/ + l[10] < /*value*/ + l[0].boxes.length ? ( + /*value*/ + l[0].boxes[ + /*selectedBox*/ + l[10] + ].label + ) : "" + ), + color: ( + /*selectedBox*/ + l[10] >= 0 && /*selectedBox*/ + l[10] < /*value*/ + l[0].boxes.length ? xn( + /*value*/ + l[0].boxes[ + /*selectedBox*/ + l[10] + ].color + ) : "" + ) + } + }), e.$on( + "change", + /*onModalNewChange*/ + l[21] + ), e.$on( + "enter{onModalNewChange}", + /*enter_onModalNewChange_handler*/ + l[38] + ), { + c() { + Gn(e.$$.fragment); + }, + m(n, i) { + Qn(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*choices*/ + 8 && (o.choices = /*choices*/ + n[3]), i[0] & /*choicesColors*/ + 16 && (o.choicesColors = /*choicesColors*/ + n[4]), i[0] & /*selectedBox, value*/ + 1025 && (o.label = /*selectedBox*/ + n[10] >= 0 && /*selectedBox*/ + n[10] < /*value*/ + n[0].boxes.length ? ( + /*value*/ + n[0].boxes[ + /*selectedBox*/ + n[10] + ].label + ) : ""), i[0] & /*selectedBox, value*/ + 1025 && (o.color = /*selectedBox*/ + n[10] >= 0 && /*selectedBox*/ + n[10] < /*value*/ + n[0].boxes.length ? xn( + /*value*/ + n[0].boxes[ + /*selectedBox*/ + n[10] + ].color + ) : ""), e.$set(o); + }, + i(n) { + t || (me(e.$$.fragment, n), t = !0); + }, + o(n) { + Te(e.$$.fragment, n), t = !1; + }, + d(n) { + Jn(e, n); + } + }; +} +function Uh(l) { + let e, t, n, i, o, s, r, a, f, u = ( + /*interactive*/ + l[2] && Ys(l) + ), c = ( + /*editModalVisible*/ + l[12] && Us(l) + ), _ = ( + /*newModalVisible*/ + l[13] && Os(l) + ); + return { + c() { + e = bn("div"), t = bn("canvas"), n = Pn(), u && u.c(), i = Pn(), c && c.c(), o = Pn(), _ && _.c(), s = Th(), vl( + t, + "height", + /*height*/ + l[5] + ), vl( + t, + "width", + /*width*/ + l[6] + ), nt(t, "class", "canvas-annotator svelte-1m8vz1h"), nt(e, "class", "canvas-container svelte-1m8vz1h"), nt(e, "tabindex", "-1"); + }, + m(d, h) { + Wt(d, e, h), Yn(e, t), l[33](t), Wt(d, n, h), u && u.m(d, h), Wt(d, i, h), c && c.m(d, h), Wt(d, o, h), _ && _.m(d, h), Wt(d, s, h), r = !0, a || (f = [ + ut( + t, + "pointerdown", + /*handlePointerDown*/ + l[14] + ), + ut( + t, + "pointerup", + /*handlePointerUp*/ + l[15] + ), + ut(t, "pointermove", function() { + jh( + /*handlesCursor*/ + l[7] ? ( + /*handlePointerMove*/ + l[16] + ) : null + ) && /*handlesCursor*/ + (l[7] ? ( + /*handlePointerMove*/ + l[16] + ) : null).apply(this, arguments); + }), + ut( + t, + "dblclick", + /*handleDoubleClick*/ + l[19] + ), + ut( + e, + "focusin", + /*handleCanvasFocus*/ + l[23] + ), + ut( + e, + "focusout", + /*handleCanvasBlur*/ + l[24] + ) + ], a = !0); + }, + p(d, h) { + l = d, (!r || h[0] & /*height*/ + 32) && vl( + t, + "height", + /*height*/ + l[5] + ), (!r || h[0] & /*width*/ + 64) && vl( + t, + "width", + /*width*/ + l[6] + ), /*interactive*/ + l[2] ? u ? (u.p(l, h), h[0] & /*interactive*/ + 4 && me(u, 1)) : (u = Ys(l), u.c(), me(u, 1), u.m(i.parentNode, i)) : u && (Al(), Te(u, 1, 1, () => { + u = null; + }), Ml()), /*editModalVisible*/ + l[12] ? c ? (c.p(l, h), h[0] & /*editModalVisible*/ + 4096 && me(c, 1)) : (c = Us(l), c.c(), me(c, 1), c.m(o.parentNode, o)) : c && (Al(), Te(c, 1, 1, () => { + c = null; + }), Ml()), /*newModalVisible*/ + l[13] ? _ ? (_.p(l, h), h[0] & /*newModalVisible*/ + 8192 && me(_, 1)) : (_ = Os(l), _.c(), me(_, 1), _.m(s.parentNode, s)) : _ && (Al(), Te(_, 1, 1, () => { + _ = null; + }), Ml()); + }, + i(d) { + r || (me(u), me(c), me(_), r = !0); + }, + o(d) { + Te(u), Te(c), Te(_), r = !1; + }, + d(d) { + d && (Ot(e), Ot(n), Ot(i), Ot(o), Ot(s)), l[33](null), u && u.d(d), c && c.d(d), _ && _.d(d), a = !1, fr(f); + } + }; +} +function Fi(l) { + var e = parseInt(l.slice(1, 3), 16), t = parseInt(l.slice(3, 5), 16), n = parseInt(l.slice(5, 7), 16); + return "rgb(" + e + ", " + t + ", " + n + ")"; +} +function xn(l) { + const e = l.match(/(\d+(\.\d+)?)/g), t = parseInt(e[0]), n = parseInt(e[1]), i = parseInt(e[2]); + return "#" + (1 << 24 | t << 16 | n << 8 | i).toString(16).slice(1); +} +function Oh(l, e, t) { + var n; + (function(B) { + B[B.creation = 0] = "creation", B[B.drag = 1] = "drag"; + })(n || (n = {})); + let { imageUrl: i = null } = e, { interactive: o } = e, { boxAlpha: s = 0.5 } = e, { boxMinSize: r = 25 } = e, { handleSize: a } = e, { boxThickness: f } = e, { boxSelectedThickness: u } = e, { value: c } = e, { choices: _ = [] } = e, { choicesColors: d = [] } = e, { disableEditBoxes: h = !1 } = e, { height: m = "100%" } = e, { width: w = "100%" } = e, { singleBox: b = !1 } = e, { showRemoveButton: p = null } = e, { handlesCursor: g = !0 } = e; + p === null && (p = h); + let v, E, y = null, C = -1, k = n.drag; + c !== null && c.boxes.length == 0 && (k = n.creation); + let A = 0, S = 0, T = 0, R = 0, U = 1, Z = 0, Q = 0, J = !1, K = !1; + const L = Nh(); + function F() { + if (E) { + E.clearRect(0, 0, v.width, v.height), y !== null && E.drawImage(y, A, S, Z, Q); + for (const B of c.boxes.slice().reverse()) + B.render(E); + } + } + function D(B) { + t(10, C = B), c.boxes.forEach((N) => { + N.setSelected(!1); + }), B >= 0 && B < c.boxes.length && c.boxes[B].setSelected(!0), F(); + } + function W(B) { + o && (B.target instanceof Element && B.target.hasPointerCapture(B.pointerId) && B.target.releasePointerCapture(B.pointerId), k === n.creation ? Xe(B) : k === n.drag && $(B)); + } + function $(B) { + const N = v.getBoundingClientRect(), ee = B.clientX - N.left, ce = B.clientY - N.top; + for (const [te, ie] of c.boxes.entries()) { + const Sn = ie.indexOfPointInsideHandle(ee, ce); + if (Sn >= 0) { + D(te), ie.startResize(Sn, B); + return; + } + } + for (const [te, ie] of c.boxes.entries()) + if (ie.isPointInsideBox(ee, ce)) { + D(te), ie.startDrag(B); + return; + } + b || D(-1); + } + function oe(B) { + L("change"); + } + function ge(B) { + if (c === null || k !== n.drag) + return; + const N = v.getBoundingClientRect(), ee = B.clientX - N.left, ce = B.clientY - N.top; + for (const [te, ie] of c.boxes.entries()) { + const Sn = ie.indexOfPointInsideHandle(ee, ce); + if (Sn >= 0) { + t(9, v.style.cursor = ie.resizeHandles[Sn].cursor, v); + return; + } + } + t(9, v.style.cursor = "default", v); + } + function I(B) { + if (o) + switch (B.key) { + case "Delete": + ke(); + break; + } + } + function Xe(B) { + const N = v.getBoundingClientRect(), ee = (B.clientX - N.left - A) / U, ce = (B.clientY - N.top - S) / U; + let te; + d.length > 0 ? te = Fi(d[0]) : b ? c.boxes.length > 0 ? te = c.boxes[0].color : te = jt[0] : te = jt[c.boxes.length % jt.length]; + let ie = new Hi(F, G, A, S, T, R, "", ee, ce, ee, ce, te, s, r, a, f, u); + ie.startCreating(B, N.left, N.top), b ? t(0, c.boxes = [ie], c) : t(0, c.boxes = [ie, ...c.boxes], c), D(0), F(), L("change"); + } + function M() { + t(11, k = n.creation), t(9, v.style.cursor = "crosshair", v); + } + function H() { + t(11, k = n.drag), t(9, v.style.cursor = "default", v); + } + function G() { + C >= 0 && C < c.boxes.length && (c.boxes[C].getArea() < 1 ? ke() : (h || t(13, K = !0), b && H())); + } + function q() { + C >= 0 && C < c.boxes.length && !h && t(12, J = !0); + } + function ue(B) { + o && q(); + } + function Ye(B) { + t(12, J = !1); + const { detail: N } = B; + let ee = N.label, ce = N.color, te = N.ret; + if (C >= 0 && C < c.boxes.length) { + let ie = c.boxes[C]; + te == 1 ? (ie.label = ee, ie.color = Fi(ce), F(), L("change")) : te == -1 && ke(); + } + } + function Qe(B) { + t(13, K = !1); + const { detail: N } = B; + let ee = N.label, ce = N.color, te = N.ret; + if (C >= 0 && C < c.boxes.length) { + let ie = c.boxes[C]; + te == 1 ? (ie.label = ee, ie.color = Fi(ce), F(), L("change")) : ke(); + } + } + function ke() { + C >= 0 && C < c.boxes.length && (c.boxes.splice(C, 1), D(-1), b && M(), L("change")); + } + function be() { + if (v) { + if (U = 1, t(9, v.width = v.clientWidth, v), y !== null) + if (y.width > v.width) + U = v.width / y.width, Z = y.width * U, Q = y.height * U, A = 0, S = 0, T = Z, R = Q, t(9, v.height = Q, v); + else { + Z = y.width, Q = y.height; + var B = (v.width - Z) / 2; + A = B, S = 0, T = B + Z, R = y.height, t(9, v.height = Q, v); + } + else + A = 0, S = 0, T = v.width, R = v.height, t(9, v.height = v.clientHeight, v); + if (T > 0 && R > 0) + for (const N of c.boxes) + N.canvasXmin = A, N.canvasYmin = S, N.canvasXmax = T, N.canvasYmax = R, N.setScaleFactor(U); + F(), L("change"); + } + } + const Ne = new ResizeObserver(be); + function Ue() { + for (let B = 0; B < c.boxes.length; B++) { + let N = c.boxes[B]; + if (!(N instanceof Hi)) { + let ee = "", ce = ""; + N.hasOwnProperty("color") ? (ee = N.color, Array.isArray(ee) && ee.length === 3 && (ee = `rgb(${ee[0]}, ${ee[1]}, ${ee[2]})`)) : ee = jt[B % jt.length], N.hasOwnProperty("label") && (ce = N.label), N = new Hi(F, G, A, S, T, R, ce, N.xmin, N.ymin, N.xmax, N.ymax, ee, s, r, a, f, u), t(0, c.boxes[B] = N, c); + } + } + } + function bt() { + i !== null && (y === null || y.src != i) && (y = new Image(), y.src = i, y.onload = function() { + be(), F(); + }); + } + Xh(() => { + if (Array.isArray(_) && _.length > 0 && (!Array.isArray(d) || d.length == 0)) + for (let B = 0; B < _.length; B++) { + let N = jt[B % jt.length]; + d.push(xn(N)); + } + E = v.getContext("2d"), Ne.observe(v), C < 0 && c !== null && c.boxes.length > 0 && D(0), bt(), be(), F(); + }); + function ti() { + document.addEventListener("keydown", I); + } + function ni() { + document.removeEventListener("keydown", I); + } + Yh(() => { + document.removeEventListener("keydown", I); + }); + function z(B) { + Rh[B ? "unshift" : "push"](() => { + v = B, t(9, v); + }); + } + const wt = () => M(), st = () => H(), tn = () => ke(); + function li(B) { + Xs.call(this, l, B); + } + function Lt(B) { + Xs.call(this, l, B); + } + return l.$$set = (B) => { + "imageUrl" in B && t(25, i = B.imageUrl), "interactive" in B && t(2, o = B.interactive), "boxAlpha" in B && t(26, s = B.boxAlpha), "boxMinSize" in B && t(27, r = B.boxMinSize), "handleSize" in B && t(28, a = B.handleSize), "boxThickness" in B && t(29, f = B.boxThickness), "boxSelectedThickness" in B && t(30, u = B.boxSelectedThickness), "value" in B && t(0, c = B.value), "choices" in B && t(3, _ = B.choices), "choicesColors" in B && t(4, d = B.choicesColors), "disableEditBoxes" in B && t(31, h = B.disableEditBoxes), "height" in B && t(5, m = B.height), "width" in B && t(6, w = B.width), "singleBox" in B && t(32, b = B.singleBox), "showRemoveButton" in B && t(1, p = B.showRemoveButton), "handlesCursor" in B && t(7, g = B.handlesCursor); + }, l.$$.update = () => { + l.$$.dirty[0] & /*value*/ + 1 && (bt(), Ue(), be(), F()); + }, [ + c, + p, + o, + _, + d, + m, + w, + g, + n, + v, + C, + k, + J, + K, + W, + oe, + ge, + M, + H, + ue, + Ye, + Qe, + ke, + ti, + ni, + i, + s, + r, + a, + f, + u, + h, + b, + z, + wt, + st, + tn, + li, + Lt + ]; +} +class Wh extends Dh { + constructor(e) { + super(), Ih( + this, + e, + Oh, + Uh, + Fh, + { + imageUrl: 25, + interactive: 2, + boxAlpha: 26, + boxMinSize: 27, + handleSize: 28, + boxThickness: 29, + boxSelectedThickness: 30, + value: 0, + choices: 3, + choicesColors: 4, + disableEditBoxes: 31, + height: 5, + width: 6, + singleBox: 32, + showRemoveButton: 1, + handlesCursor: 7 + }, + null, + [-1, -1] + ); + } +} +const { + SvelteComponent: Vh, + add_flush_callback: Ph, + bind: Zh, + binding_callbacks: Kh, + create_component: Gh, + destroy_component: Jh, + init: Qh, + mount_component: xh, + safe_not_equal: $h, + transition_in: em, + transition_out: tm +} = window.__gradio__svelte__internal, { createEventDispatcher: nm } = window.__gradio__svelte__internal; +function lm(l) { + let e, t, n; + function i(s) { + l[19](s); + } + let o = { + interactive: ( + /*interactive*/ + l[1] + ), + boxAlpha: ( + /*boxesAlpha*/ + l[2] + ), + choices: ( + /*labelList*/ + l[3] + ), + choicesColors: ( + /*labelColors*/ + l[4] + ), + height: ( + /*height*/ + l[8] + ), + width: ( + /*width*/ + l[9] + ), + boxMinSize: ( + /*boxMinSize*/ + l[5] + ), + handleSize: ( + /*handleSize*/ + l[6] + ), + boxThickness: ( + /*boxThickness*/ + l[7] + ), + boxSelectedThickness: ( + /*boxSelectedThickness*/ + l[10] + ), + disableEditBoxes: ( + /*disableEditBoxes*/ + l[11] + ), + singleBox: ( + /*singleBox*/ + l[12] + ), + showRemoveButton: ( + /*showRemoveButton*/ + l[13] + ), + handlesCursor: ( + /*handlesCursor*/ + l[14] + ), + imageUrl: ( + /*resolved_src*/ + l[15] + ) + }; + return ( + /*value*/ + l[0] !== void 0 && (o.value = /*value*/ + l[0]), e = new Wh({ props: o }), Kh.push(() => Zh(e, "value", i)), e.$on( + "change", + /*change_handler*/ + l[20] + ), { + c() { + Gh(e.$$.fragment); + }, + m(s, r) { + xh(e, s, r), n = !0; + }, + p(s, [r]) { + const a = {}; + r & /*interactive*/ + 2 && (a.interactive = /*interactive*/ + s[1]), r & /*boxesAlpha*/ + 4 && (a.boxAlpha = /*boxesAlpha*/ + s[2]), r & /*labelList*/ + 8 && (a.choices = /*labelList*/ + s[3]), r & /*labelColors*/ + 16 && (a.choicesColors = /*labelColors*/ + s[4]), r & /*height*/ + 256 && (a.height = /*height*/ + s[8]), r & /*width*/ + 512 && (a.width = /*width*/ + s[9]), r & /*boxMinSize*/ + 32 && (a.boxMinSize = /*boxMinSize*/ + s[5]), r & /*handleSize*/ + 64 && (a.handleSize = /*handleSize*/ + s[6]), r & /*boxThickness*/ + 128 && (a.boxThickness = /*boxThickness*/ + s[7]), r & /*boxSelectedThickness*/ + 1024 && (a.boxSelectedThickness = /*boxSelectedThickness*/ + s[10]), r & /*disableEditBoxes*/ + 2048 && (a.disableEditBoxes = /*disableEditBoxes*/ + s[11]), r & /*singleBox*/ + 4096 && (a.singleBox = /*singleBox*/ + s[12]), r & /*showRemoveButton*/ + 8192 && (a.showRemoveButton = /*showRemoveButton*/ + s[13]), r & /*handlesCursor*/ + 16384 && (a.handlesCursor = /*handlesCursor*/ + s[14]), r & /*resolved_src*/ + 32768 && (a.imageUrl = /*resolved_src*/ + s[15]), !t && r & /*value*/ + 1 && (t = !0, a.value = /*value*/ + s[0], Ph(() => t = !1)), e.$set(a); + }, + i(s) { + n || (em(e.$$.fragment, s), n = !0); + }, + o(s) { + tm(e.$$.fragment, s), n = !1; + }, + d(s) { + Jh(e, s); + } + } + ); +} +function im(l, e, t) { + let { src: n = void 0 } = e, { interactive: i } = e, { boxesAlpha: o } = e, { labelList: s } = e, { labelColors: r } = e, { boxMinSize: a } = e, { handleSize: f } = e, { boxThickness: u } = e, { height: c } = e, { width: _ } = e, { boxSelectedThickness: d } = e, { value: h } = e, { disableEditBoxes: m } = e, { singleBox: w } = e, { showRemoveButton: b } = e, { handlesCursor: p } = e, g, v; + const E = nm(); + function y(k) { + h = k, t(0, h); + } + const C = () => E("change"); + return l.$$set = (k) => { + "src" in k && t(17, n = k.src), "interactive" in k && t(1, i = k.interactive), "boxesAlpha" in k && t(2, o = k.boxesAlpha), "labelList" in k && t(3, s = k.labelList), "labelColors" in k && t(4, r = k.labelColors), "boxMinSize" in k && t(5, a = k.boxMinSize), "handleSize" in k && t(6, f = k.handleSize), "boxThickness" in k && t(7, u = k.boxThickness), "height" in k && t(8, c = k.height), "width" in k && t(9, _ = k.width), "boxSelectedThickness" in k && t(10, d = k.boxSelectedThickness), "value" in k && t(0, h = k.value), "disableEditBoxes" in k && t(11, m = k.disableEditBoxes), "singleBox" in k && t(12, w = k.singleBox), "showRemoveButton" in k && t(13, b = k.showRemoveButton), "handlesCursor" in k && t(14, p = k.handlesCursor); + }, l.$$.update = () => { + if (l.$$.dirty & /*src, latest_src*/ + 393216) { + t(15, g = n), t(18, v = n); + const k = n; + nd(k).then((A) => { + v === k && t(15, g = A); + }); + } + }, [ + h, + i, + o, + s, + r, + a, + f, + u, + c, + _, + d, + m, + w, + b, + p, + g, + E, + n, + v, + y, + C + ]; +} +class om extends Vh { + constructor(e) { + super(), Qh(this, e, im, lm, $h, { + src: 17, + interactive: 1, + boxesAlpha: 2, + labelList: 3, + labelColors: 4, + boxMinSize: 5, + handleSize: 6, + boxThickness: 7, + height: 8, + width: 9, + boxSelectedThickness: 10, + value: 0, + disableEditBoxes: 11, + singleBox: 12, + showRemoveButton: 13, + handlesCursor: 14 + }); + } +} +class Ws { + constructor() { + this.boxes = []; + } +} +const { + SvelteComponent: sm, + add_flush_callback: Ol, + append: un, + attr: Nn, + bind: Wl, + binding_callbacks: $n, + bubble: Mn, + check_outros: Xt, + create_component: _t, + create_slot: am, + destroy_component: dt, + detach: Zt, + element: Zn, + empty: rm, + get_all_dirty_from_scope: fm, + get_slot_changes: um, + group_outros: Yt, + init: cm, + insert: Kt, + mount_component: ht, + noop: _m, + safe_not_equal: dm, + space: Ht, + toggle_class: Vs, + transition_in: P, + transition_out: x, + update_slot_base: hm +} = window.__gradio__svelte__internal, { createEventDispatcher: mm, tick: gm } = window.__gradio__svelte__internal; +function Ps(l) { + let e, t; + return e = new md({ + props: { + href: ( + /*value*/ + l[1].image.url + ), + download: ( + /*value*/ + l[1].image.orig_name || "image" + ), + $$slots: { default: [bm] }, + $$scope: { ctx: l } + } + }), { + c() { + _t(e.$$.fragment); + }, + m(n, i) { + ht(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*value*/ + 2 && (o.href = /*value*/ + n[1].image.url), i[0] & /*value*/ + 2 && (o.download = /*value*/ + n[1].image.orig_name || "image"), i[0] & /*i18n*/ + 256 | i[1] & /*$$scope*/ + 2097152 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + }, + i(n) { + t || (P(e.$$.fragment, n), t = !0); + }, + o(n) { + x(e.$$.fragment, n), t = !1; + }, + d(n) { + dt(e, n); + } + }; +} +function bm(l) { + let e, t; + return e = new Vl({ + props: { + Icon: Ou, + label: ( + /*i18n*/ + l[8]("common.download") + ) + } + }), { + c() { + _t(e.$$.fragment); + }, + m(n, i) { + ht(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*i18n*/ + 256 && (o.label = /*i18n*/ + n[8]("common.download")), e.$set(o); + }, + i(n) { + t || (P(e.$$.fragment, n), t = !0); + }, + o(n) { + x(e.$$.fragment, n), t = !1; + }, + d(n) { + dt(e, n); + } + }; +} +function Zs(l) { + let e, t; + return e = new Qc({ + props: { + i18n: ( + /*i18n*/ + l[8] + ), + formatter: ( + /*func*/ + l[37] + ), + value: ( + /*value*/ + l[1] + ) + } + }), e.$on( + "share", + /*share_handler*/ + l[38] + ), e.$on( + "error", + /*error_handler*/ + l[39] + ), { + c() { + _t(e.$$.fragment); + }, + m(n, i) { + ht(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*i18n*/ + 256 && (o.i18n = /*i18n*/ + n[8]), i[0] & /*value*/ + 2 && (o.value = /*value*/ + n[1]), e.$set(o); + }, + i(n) { + t || (P(e.$$.fragment, n), t = !0); + }, + o(n) { + x(e.$$.fragment, n), t = !1; + }, + d(n) { + dt(e, n); + } + }; +} +function Ks(l) { + let e, t, n; + return t = new Vl({ + props: { Icon: ua, label: "Remove Image" } + }), t.$on( + "click", + /*clear*/ + l[35] + ), { + c() { + e = Zn("div"), _t(t.$$.fragment); + }, + m(i, o) { + Kt(i, e, o), ht(t, e, null), n = !0; + }, + p: _m, + i(i) { + n || (P(t.$$.fragment, i), n = !0); + }, + o(i) { + x(t.$$.fragment, i), n = !1; + }, + d(i) { + i && Zt(e), dt(t); + } + }; +} +function Gs(l) { + let e; + const t = ( + /*#slots*/ + l[36].default + ), n = am( + t, + l, + /*$$scope*/ + l[52], + null + ); + return { + c() { + n && n.c(); + }, + m(i, o) { + n && n.m(i, o), e = !0; + }, + p(i, o) { + n && n.p && (!e || o[1] & /*$$scope*/ + 2097152) && hm( + n, + t, + i, + /*$$scope*/ + i[52], + e ? um( + t, + /*$$scope*/ + i[52], + o, + null + ) : fm( + /*$$scope*/ + i[52] + ), + null + ); + }, + i(i) { + e || (P(n, i), e = !0); + }, + o(i) { + x(n, i), e = !1; + }, + d(i) { + n && n.d(i); + } + }; +} +function wm(l) { + let e, t, n = ( + /*value*/ + l[1] === null && Gs(l) + ); + return { + c() { + n && n.c(), e = rm(); + }, + m(i, o) { + n && n.m(i, o), Kt(i, e, o), t = !0; + }, + p(i, o) { + /*value*/ + i[1] === null ? n ? (n.p(i, o), o[0] & /*value*/ + 2 && P(n, 1)) : (n = Gs(i), n.c(), P(n, 1), n.m(e.parentNode, e)) : n && (Yt(), x(n, 1, 1, () => { + n = null; + }), Xt()); + }, + i(i) { + t || (P(n), t = !0); + }, + o(i) { + x(n), t = !1; + }, + d(i) { + i && Zt(e), n && n.d(i); + } + }; +} +function Js(l) { + let e, t; + return e = new X1({ + props: { + root: ( + /*root*/ + l[6] + ), + mode: "image", + include_audio: !1, + i18n: ( + /*i18n*/ + l[8] + ), + upload: ( + /*upload*/ + l[30] + ) + } + }), e.$on( + "capture", + /*capture_handler*/ + l[44] + ), e.$on( + "stream", + /*stream_handler_1*/ + l[45] + ), e.$on( + "error", + /*error_handler_2*/ + l[46] + ), e.$on( + "drag", + /*drag_handler*/ + l[47] + ), e.$on( + "upload", + /*upload_handler*/ + l[48] + ), { + c() { + _t(e.$$.fragment); + }, + m(n, i) { + ht(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*root*/ + 64 && (o.root = /*root*/ + n[6]), i[0] & /*i18n*/ + 256 && (o.i18n = /*i18n*/ + n[8]), i[0] & /*upload*/ + 1073741824 && (o.upload = /*upload*/ + n[30]), e.$set(o); + }, + i(n) { + t || (P(e.$$.fragment, n), t = !0); + }, + o(n) { + x(e.$$.fragment, n), t = !1; + }, + d(n) { + dt(e, n); + } + }; +} +function Qs(l) { + let e, t, n, i; + function o(r) { + l[49](r); + } + let s = { + height: ( + /*height*/ + l[17] + ), + width: ( + /*width*/ + l[18] + ), + boxesAlpha: ( + /*boxesAlpha*/ + l[12] + ), + labelList: ( + /*labelList*/ + l[13] + ), + labelColors: ( + /*labelColors*/ + l[14] + ), + boxMinSize: ( + /*boxMinSize*/ + l[15] + ), + interactive: ( + /*interactive*/ + l[7] + ), + handleSize: ( + /*handleSize*/ + l[16] + ), + boxThickness: ( + /*boxThickness*/ + l[19] + ), + singleBox: ( + /*singleBox*/ + l[21] + ), + disableEditBoxes: ( + /*disableEditBoxes*/ + l[20] + ), + showRemoveButton: ( + /*showRemoveButton*/ + l[22] + ), + handlesCursor: ( + /*handlesCursor*/ + l[23] + ), + boxSelectedThickness: ( + /*boxSelectedThickness*/ + l[24] + ), + src: ( + /*value*/ + l[1].image.url + ) + }; + return ( + /*value*/ + l[1] !== void 0 && (s.value = /*value*/ + l[1]), t = new om({ props: s }), $n.push(() => Wl(t, "value", o)), t.$on( + "change", + /*change_handler*/ + l[50] + ), { + c() { + e = Zn("div"), _t(t.$$.fragment), Nn(e, "class", "image-frame svelte-1gjdske"), Vs( + e, + "selectable", + /*selectable*/ + l[5] + ); + }, + m(r, a) { + Kt(r, e, a), ht(t, e, null), i = !0; + }, + p(r, a) { + const f = {}; + a[0] & /*height*/ + 131072 && (f.height = /*height*/ + r[17]), a[0] & /*width*/ + 262144 && (f.width = /*width*/ + r[18]), a[0] & /*boxesAlpha*/ + 4096 && (f.boxesAlpha = /*boxesAlpha*/ + r[12]), a[0] & /*labelList*/ + 8192 && (f.labelList = /*labelList*/ + r[13]), a[0] & /*labelColors*/ + 16384 && (f.labelColors = /*labelColors*/ + r[14]), a[0] & /*boxMinSize*/ + 32768 && (f.boxMinSize = /*boxMinSize*/ + r[15]), a[0] & /*interactive*/ + 128 && (f.interactive = /*interactive*/ + r[7]), a[0] & /*handleSize*/ + 65536 && (f.handleSize = /*handleSize*/ + r[16]), a[0] & /*boxThickness*/ + 524288 && (f.boxThickness = /*boxThickness*/ + r[19]), a[0] & /*singleBox*/ + 2097152 && (f.singleBox = /*singleBox*/ + r[21]), a[0] & /*disableEditBoxes*/ + 1048576 && (f.disableEditBoxes = /*disableEditBoxes*/ + r[20]), a[0] & /*showRemoveButton*/ + 4194304 && (f.showRemoveButton = /*showRemoveButton*/ + r[22]), a[0] & /*handlesCursor*/ + 8388608 && (f.handlesCursor = /*handlesCursor*/ + r[23]), a[0] & /*boxSelectedThickness*/ + 16777216 && (f.boxSelectedThickness = /*boxSelectedThickness*/ + r[24]), a[0] & /*value*/ + 2 && (f.src = /*value*/ + r[1].image.url), !n && a[0] & /*value*/ + 2 && (n = !0, f.value = /*value*/ + r[1], Ol(() => n = !1)), t.$set(f), (!i || a[0] & /*selectable*/ + 32) && Vs( + e, + "selectable", + /*selectable*/ + r[5] + ); + }, + i(r) { + i || (P(t.$$.fragment, r), i = !0); + }, + o(r) { + x(t.$$.fragment, r), i = !1; + }, + d(r) { + r && Zt(e), dt(t); + } + } + ); +} +function xs(l) { + let e, t, n; + function i(s) { + l[51](s); + } + let o = { + sources: ( + /*sources*/ + l[4] + ), + handle_clear: ( + /*clear*/ + l[35] + ), + handle_select: ( + /*handle_select_source*/ + l[34] + ) + }; + return ( + /*active_source*/ + l[0] !== void 0 && (o.active_source = /*active_source*/ + l[0]), e = new d_({ props: o }), $n.push(() => Wl(e, "active_source", i)), { + c() { + _t(e.$$.fragment); + }, + m(s, r) { + ht(e, s, r), n = !0; + }, + p(s, r) { + const a = {}; + r[0] & /*sources*/ + 16 && (a.sources = /*sources*/ + s[4]), !t && r[0] & /*active_source*/ + 1 && (t = !0, a.active_source = /*active_source*/ + s[0], Ol(() => t = !1)), e.$set(a); + }, + i(s) { + n || (P(e.$$.fragment, s), n = !0); + }, + o(s) { + x(e.$$.fragment, s), n = !1; + }, + d(s) { + dt(e, s); + } + } + ); +} +function pm(l) { + let e, t, n, i, o, s, r, a, f, u, c, _, d, h, m = ( + /*sources*/ + (l[4].length > 1 || /*sources*/ + l[4].includes("clipboard")) && /*value*/ + l[1] === null && /*interactive*/ + l[7] + ), w; + e = new Mf({ + props: { + show_label: ( + /*show_label*/ + l[3] + ), + Icon: ca, + label: ( + /*label*/ + l[2] || "Image Annotator" + ) + } + }); + let b = ( + /*showDownloadButton*/ + l[10] && /*value*/ + l[1] !== null && Ps(l) + ), p = ( + /*showShareButton*/ + l[9] && /*value*/ + l[1] !== null && Zs(l) + ), g = ( + /*showClearButton*/ + l[11] && /*value*/ + l[1] !== null && /*interactive*/ + l[7] && Ks(l) + ); + function v(S) { + l[41](S); + } + function E(S) { + l[42](S); + } + let y = { + hidden: ( + /*value*/ + l[1] !== null || /*active_source*/ + l[0] === "webcam" + ), + filetype: ( + /*active_source*/ + l[0] === "clipboard" ? "clipboard" : "image/*" + ), + root: ( + /*root*/ + l[6] + ), + max_file_size: ( + /*max_file_size*/ + l[25] + ), + disable_click: !/*sources*/ + l[4].includes("upload"), + upload: ( + /*cli_upload*/ + l[26] + ), + stream_handler: ( + /*stream_handler*/ + l[27] + ), + $$slots: { default: [wm] }, + $$scope: { ctx: l } + }; + /*uploading*/ + l[28] !== void 0 && (y.uploading = /*uploading*/ + l[28]), /*dragging*/ + l[29] !== void 0 && (y.dragging = /*dragging*/ + l[29]), f = new Kd({ props: y }), l[40](f), $n.push(() => Wl(f, "uploading", v)), $n.push(() => Wl(f, "dragging", E)), f.$on( + "load", + /*handle_upload*/ + l[31] + ), f.$on( + "error", + /*error_handler_1*/ + l[43] + ); + let C = ( + /*value*/ + l[1] === null && /*active_source*/ + l[0] === "webcam" && Js(l) + ), k = ( + /*value*/ + l[1] !== null && Qs(l) + ), A = m && xs(l); + return { + c() { + _t(e.$$.fragment), t = Ht(), n = Zn("div"), b && b.c(), i = Ht(), p && p.c(), o = Ht(), g && g.c(), s = Ht(), r = Zn("div"), a = Zn("div"), _t(f.$$.fragment), _ = Ht(), C && C.c(), d = Ht(), k && k.c(), h = Ht(), A && A.c(), Nn(n, "class", "icon-buttons svelte-1gjdske"), Nn(a, "class", "upload-container svelte-1gjdske"), Nn(r, "data-testid", "image"), Nn(r, "class", "image-container svelte-1gjdske"); + }, + m(S, T) { + ht(e, S, T), Kt(S, t, T), Kt(S, n, T), b && b.m(n, null), un(n, i), p && p.m(n, null), un(n, o), g && g.m(n, null), Kt(S, s, T), Kt(S, r, T), un(r, a), ht(f, a, null), un(a, _), C && C.m(a, null), un(a, d), k && k.m(a, null), un(r, h), A && A.m(r, null), w = !0; + }, + p(S, T) { + const R = {}; + T[0] & /*show_label*/ + 8 && (R.show_label = /*show_label*/ + S[3]), T[0] & /*label*/ + 4 && (R.label = /*label*/ + S[2] || "Image Annotator"), e.$set(R), /*showDownloadButton*/ + S[10] && /*value*/ + S[1] !== null ? b ? (b.p(S, T), T[0] & /*showDownloadButton, value*/ + 1026 && P(b, 1)) : (b = Ps(S), b.c(), P(b, 1), b.m(n, i)) : b && (Yt(), x(b, 1, 1, () => { + b = null; + }), Xt()), /*showShareButton*/ + S[9] && /*value*/ + S[1] !== null ? p ? (p.p(S, T), T[0] & /*showShareButton, value*/ + 514 && P(p, 1)) : (p = Zs(S), p.c(), P(p, 1), p.m(n, o)) : p && (Yt(), x(p, 1, 1, () => { + p = null; + }), Xt()), /*showClearButton*/ + S[11] && /*value*/ + S[1] !== null && /*interactive*/ + S[7] ? g ? (g.p(S, T), T[0] & /*showClearButton, value, interactive*/ + 2178 && P(g, 1)) : (g = Ks(S), g.c(), P(g, 1), g.m(n, null)) : g && (Yt(), x(g, 1, 1, () => { + g = null; + }), Xt()); + const U = {}; + T[0] & /*value, active_source*/ + 3 && (U.hidden = /*value*/ + S[1] !== null || /*active_source*/ + S[0] === "webcam"), T[0] & /*active_source*/ + 1 && (U.filetype = /*active_source*/ + S[0] === "clipboard" ? "clipboard" : "image/*"), T[0] & /*root*/ + 64 && (U.root = /*root*/ + S[6]), T[0] & /*max_file_size*/ + 33554432 && (U.max_file_size = /*max_file_size*/ + S[25]), T[0] & /*sources*/ + 16 && (U.disable_click = !/*sources*/ + S[4].includes("upload")), T[0] & /*cli_upload*/ + 67108864 && (U.upload = /*cli_upload*/ + S[26]), T[0] & /*stream_handler*/ + 134217728 && (U.stream_handler = /*stream_handler*/ + S[27]), T[0] & /*value*/ + 2 | T[1] & /*$$scope*/ + 2097152 && (U.$$scope = { dirty: T, ctx: S }), !u && T[0] & /*uploading*/ + 268435456 && (u = !0, U.uploading = /*uploading*/ + S[28], Ol(() => u = !1)), !c && T[0] & /*dragging*/ + 536870912 && (c = !0, U.dragging = /*dragging*/ + S[29], Ol(() => c = !1)), f.$set(U), /*value*/ + S[1] === null && /*active_source*/ + S[0] === "webcam" ? C ? (C.p(S, T), T[0] & /*value, active_source*/ + 3 && P(C, 1)) : (C = Js(S), C.c(), P(C, 1), C.m(a, d)) : C && (Yt(), x(C, 1, 1, () => { + C = null; + }), Xt()), /*value*/ + S[1] !== null ? k ? (k.p(S, T), T[0] & /*value*/ + 2 && P(k, 1)) : (k = Qs(S), k.c(), P(k, 1), k.m(a, null)) : k && (Yt(), x(k, 1, 1, () => { + k = null; + }), Xt()), T[0] & /*sources, value, interactive*/ + 146 && (m = /*sources*/ + (S[4].length > 1 || /*sources*/ + S[4].includes("clipboard")) && /*value*/ + S[1] === null && /*interactive*/ + S[7]), m ? A ? (A.p(S, T), T[0] & /*sources, value, interactive*/ + 146 && P(A, 1)) : (A = xs(S), A.c(), P(A, 1), A.m(r, null)) : A && (Yt(), x(A, 1, 1, () => { + A = null; + }), Xt()); + }, + i(S) { + w || (P(e.$$.fragment, S), P(b), P(p), P(g), P(f.$$.fragment, S), P(C), P(k), P(A), w = !0); + }, + o(S) { + x(e.$$.fragment, S), x(b), x(p), x(g), x(f.$$.fragment, S), x(C), x(k), x(A), w = !1; + }, + d(S) { + S && (Zt(t), Zt(n), Zt(s), Zt(r)), dt(e, S), b && b.d(), p && p.d(), g && g.d(), l[40](null), dt(f), C && C.d(), k && k.d(), A && A.d(); + } + }; +} +function vm(l, e, t) { + let { $$slots: n = {}, $$scope: i } = e; + var o = this && this.__awaiter || function(z, wt, st, tn) { + function li(Lt) { + return Lt instanceof st ? Lt : new st(function(B) { + B(Lt); + }); + } + return new (st || (st = Promise))(function(Lt, B) { + function N(te) { + try { + ce(tn.next(te)); + } catch (ie) { + B(ie); + } + } + function ee(te) { + try { + ce(tn.throw(te)); + } catch (ie) { + B(ie); + } + } + function ce(te) { + te.done ? Lt(te.value) : li(te.value).then(N, ee); + } + ce((tn = tn.apply(z, wt || [])).next()); + }); + }; + let { value: s } = e, { label: r = void 0 } = e, { show_label: a } = e, { sources: f = ["upload", "webcam", "clipboard"] } = e, { selectable: u = !1 } = e, { root: c } = e, { interactive: _ } = e, { i18n: d } = e, { showShareButton: h } = e, { showDownloadButton: m } = e, { showClearButton: w } = e, { boxesAlpha: b } = e, { labelList: p } = e, { labelColors: g } = e, { boxMinSize: v } = e, { handleSize: E } = e, { height: y } = e, { width: C } = e, { boxThickness: k } = e, { disableEditBoxes: A } = e, { singleBox: S } = e, { showRemoveButton: T } = e, { handlesCursor: R } = e, { boxSelectedThickness: U } = e, { max_file_size: Z = null } = e, { cli_upload: Q } = e, { stream_handler: J } = e, K, L = !1, { active_source: F = null } = e; + function D({ detail: z }) { + t(1, s = new Ws()), t(1, s.image = z, s), $("upload"); + } + function W(z) { + return o(this, void 0, void 0, function* () { + const wt = yield K.load_files([new File([z], "webcam.png")]), st = (wt == null ? void 0 : wt[0]) || null; + st ? (t(1, s = new Ws()), t(1, s.image = st, s)) : t(1, s = null), yield gm(), $("change"); + }); + } + const $ = mm(); + let oe = !1; + function ge(z) { + return o(this, void 0, void 0, function* () { + switch (z) { + case "clipboard": + K.paste_clipboard(); + break; + } + }); + } + function I() { + t(1, s = null), $("clear"), $("change"); + } + const Xe = async (z) => z === null ? "" : ``; + function M(z) { + Mn.call(this, l, z); + } + function H(z) { + Mn.call(this, l, z); + } + function G(z) { + $n[z ? "unshift" : "push"](() => { + K = z, t(30, K); + }); + } + function q(z) { + L = z, t(28, L); + } + function ue(z) { + oe = z, t(29, oe); + } + function Ye(z) { + Mn.call(this, l, z); + } + const Qe = (z) => W(z.detail), ke = (z) => W(z.detail); + function be(z) { + Mn.call(this, l, z); + } + function Ne(z) { + Mn.call(this, l, z); + } + const Ue = (z) => W(z.detail); + function bt(z) { + s = z, t(1, s); + } + const ti = () => $("change"); + function ni(z) { + F = z, t(0, F), t(4, f); + } + return l.$$set = (z) => { + "value" in z && t(1, s = z.value), "label" in z && t(2, r = z.label), "show_label" in z && t(3, a = z.show_label), "sources" in z && t(4, f = z.sources), "selectable" in z && t(5, u = z.selectable), "root" in z && t(6, c = z.root), "interactive" in z && t(7, _ = z.interactive), "i18n" in z && t(8, d = z.i18n), "showShareButton" in z && t(9, h = z.showShareButton), "showDownloadButton" in z && t(10, m = z.showDownloadButton), "showClearButton" in z && t(11, w = z.showClearButton), "boxesAlpha" in z && t(12, b = z.boxesAlpha), "labelList" in z && t(13, p = z.labelList), "labelColors" in z && t(14, g = z.labelColors), "boxMinSize" in z && t(15, v = z.boxMinSize), "handleSize" in z && t(16, E = z.handleSize), "height" in z && t(17, y = z.height), "width" in z && t(18, C = z.width), "boxThickness" in z && t(19, k = z.boxThickness), "disableEditBoxes" in z && t(20, A = z.disableEditBoxes), "singleBox" in z && t(21, S = z.singleBox), "showRemoveButton" in z && t(22, T = z.showRemoveButton), "handlesCursor" in z && t(23, R = z.handlesCursor), "boxSelectedThickness" in z && t(24, U = z.boxSelectedThickness), "max_file_size" in z && t(25, Z = z.max_file_size), "cli_upload" in z && t(26, Q = z.cli_upload), "stream_handler" in z && t(27, J = z.stream_handler), "active_source" in z && t(0, F = z.active_source), "$$scope" in z && t(52, i = z.$$scope); + }, l.$$.update = () => { + l.$$.dirty[0] & /*uploading*/ + 268435456 && L && I(), l.$$.dirty[0] & /*dragging*/ + 536870912 && $("drag", oe), l.$$.dirty[0] & /*active_source, sources*/ + 17 && !F && f && t(0, F = f[0]); + }, [ + F, + s, + r, + a, + f, + u, + c, + _, + d, + h, + m, + w, + b, + p, + g, + v, + E, + y, + C, + k, + A, + S, + T, + R, + U, + Z, + Q, + J, + L, + oe, + K, + D, + W, + $, + ge, + I, + n, + Xe, + M, + H, + G, + q, + ue, + Ye, + Qe, + ke, + be, + Ne, + Ue, + bt, + ti, + ni, + i + ]; +} +class km extends sm { + constructor(e) { + super(), cm( + this, + e, + vm, + pm, + dm, + { + value: 1, + label: 2, + show_label: 3, + sources: 4, + selectable: 5, + root: 6, + interactive: 7, + i18n: 8, + showShareButton: 9, + showDownloadButton: 10, + showClearButton: 11, + boxesAlpha: 12, + labelList: 13, + labelColors: 14, + boxMinSize: 15, + handleSize: 16, + height: 17, + width: 18, + boxThickness: 19, + disableEditBoxes: 20, + singleBox: 21, + showRemoveButton: 22, + handlesCursor: 23, + boxSelectedThickness: 24, + max_file_size: 25, + cli_upload: 26, + stream_handler: 27, + active_source: 0 + }, + null, + [-1, -1] + ); + } +} +const { + SvelteComponent: ym, + attr: Ll, + detach: ur, + element: cr, + init: Cm, + insert: _r, + noop: $s, + safe_not_equal: Sm, + src_url_equal: ea, + toggle_class: St +} = window.__gradio__svelte__internal; +function ta(l) { + let e, t; + return { + c() { + e = cr("img"), ea(e.src, t = /*value*/ + l[0].url) || Ll(e, "src", t), Ll(e, "alt", ""); + }, + m(n, i) { + _r(n, e, i); + }, + p(n, i) { + i & /*value*/ + 1 && !ea(e.src, t = /*value*/ + n[0].url) && Ll(e, "src", t); + }, + d(n) { + n && ur(e); + } + }; +} +function zm(l) { + let e, t = ( + /*value*/ + l[0] && ta(l) + ); + return { + c() { + e = cr("div"), t && t.c(), Ll(e, "class", "container svelte-1sgcyba"), St( + e, + "table", + /*type*/ + l[1] === "table" + ), St( + e, + "gallery", + /*type*/ + l[1] === "gallery" + ), St( + e, + "selected", + /*selected*/ + l[2] + ), St( + e, + "border", + /*value*/ + l[0] + ); + }, + m(n, i) { + _r(n, e, i), t && t.m(e, null); + }, + p(n, [i]) { + /*value*/ + n[0] ? t ? t.p(n, i) : (t = ta(n), t.c(), t.m(e, null)) : t && (t.d(1), t = null), i & /*type*/ + 2 && St( + e, + "table", + /*type*/ + n[1] === "table" + ), i & /*type*/ + 2 && St( + e, + "gallery", + /*type*/ + n[1] === "gallery" + ), i & /*selected*/ + 4 && St( + e, + "selected", + /*selected*/ + n[2] + ), i & /*value*/ + 1 && St( + e, + "border", + /*value*/ + n[0] + ); + }, + i: $s, + o: $s, + d(n) { + n && ur(e), t && t.d(); + } + }; +} +function Bm(l, e, t) { + let { value: n } = e, { type: i } = e, { selected: o = !1 } = e; + return l.$$set = (s) => { + "value" in s && t(0, n = s.value), "type" in s && t(1, i = s.type), "selected" in s && t(2, o = s.selected); + }, [n, i, o]; +} +class Jm extends ym { + constructor(e) { + super(), Cm(this, e, Bm, zm, Sm, { value: 0, type: 1, selected: 2 }); + } +} +const { + SvelteComponent: qm, + add_flush_callback: na, + assign: Em, + bind: la, + binding_callbacks: ia, + check_outros: Mm, + create_component: xt, + destroy_component: $t, + detach: dr, + empty: Am, + flush: V, + get_spread_object: Lm, + get_spread_update: Dm, + group_outros: Rm, + init: Tm, + insert: hr, + mount_component: en, + safe_not_equal: Im, + space: jm, + transition_in: mt, + transition_out: gt +} = window.__gradio__svelte__internal; +function Hm(l) { + let e, t; + return e = new su({ + props: { + unpadded_box: !0, + size: "large", + $$slots: { default: [Ym] }, + $$scope: { ctx: l } + } + }), { + c() { + xt(e.$$.fragment); + }, + m(n, i) { + en(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[1] & /*$$scope*/ + 4096 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + }, + i(n) { + t || (mt(e.$$.fragment, n), t = !0); + }, + o(n) { + gt(e.$$.fragment, n), t = !1; + }, + d(n) { + $t(e, n); + } + }; +} +function Fm(l) { + let e, t; + return e = new wa({ + props: { + i18n: ( + /*gradio*/ + l[30].i18n + ), + type: "clipboard", + mode: "short" + } + }), { + c() { + xt(e.$$.fragment); + }, + m(n, i) { + en(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*gradio*/ + 1073741824 && (o.i18n = /*gradio*/ + n[30].i18n), e.$set(o); + }, + i(n) { + t || (mt(e.$$.fragment, n), t = !0); + }, + o(n) { + gt(e.$$.fragment, n), t = !1; + }, + d(n) { + $t(e, n); + } + }; +} +function Xm(l) { + let e, t; + return e = new wa({ + props: { + i18n: ( + /*gradio*/ + l[30].i18n + ), + type: "image" + } + }), { + c() { + xt(e.$$.fragment); + }, + m(n, i) { + en(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*gradio*/ + 1073741824 && (o.i18n = /*gradio*/ + n[30].i18n), e.$set(o); + }, + i(n) { + t || (mt(e.$$.fragment, n), t = !0); + }, + o(n) { + gt(e.$$.fragment, n), t = !1; + }, + d(n) { + $t(e, n); + } + }; +} +function Ym(l) { + let e, t; + return e = new ca({}), { + c() { + xt(e.$$.fragment); + }, + m(n, i) { + en(e, n, i), t = !0; + }, + i(n) { + t || (mt(e.$$.fragment, n), t = !0); + }, + o(n) { + gt(e.$$.fragment, n), t = !1; + }, + d(n) { + $t(e, n); + } + }; +} +function Nm(l) { + let e, t, n, i; + const o = [Xm, Fm, Hm], s = []; + function r(a, f) { + return ( + /*active_source*/ + a[32] === "upload" ? 0 : ( + /*active_source*/ + a[32] === "clipboard" ? 1 : 2 + ) + ); + } + return e = r(l), t = s[e] = o[e](l), { + c() { + t.c(), n = Am(); + }, + m(a, f) { + s[e].m(a, f), hr(a, n, f), i = !0; + }, + p(a, f) { + let u = e; + e = r(a), e === u ? s[e].p(a, f) : (Rm(), gt(s[u], 1, 1, () => { + s[u] = null; + }), Mm(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), mt(t, 1), t.m(n.parentNode, n)); + }, + i(a) { + i || (mt(t), i = !0); + }, + o(a) { + gt(t), i = !1; + }, + d(a) { + a && dr(n), s[e].d(a); + } + }; +} +function Um(l) { + let e, t, n, i, o, s; + const r = [ + { + autoscroll: ( + /*gradio*/ + l[30].autoscroll + ) + }, + { i18n: ( + /*gradio*/ + l[30].i18n + ) }, + /*loading_status*/ + l[1] + ]; + let a = {}; + for (let _ = 0; _ < r.length; _ += 1) + a = Em(a, r[_]); + e = new x_({ props: a }); + function f(_) { + l[33](_); + } + function u(_) { + l[34](_); + } + let c = { + selectable: ( + /*_selectable*/ + l[10] + ), + root: ( + /*root*/ + l[7] + ), + sources: ( + /*sources*/ + l[14] + ), + interactive: ( + /*interactive*/ + l[18] + ), + showDownloadButton: ( + /*show_download_button*/ + l[15] + ), + showShareButton: ( + /*show_share_button*/ + l[16] + ), + showClearButton: ( + /*show_clear_button*/ + l[17] + ), + i18n: ( + /*gradio*/ + l[30].i18n + ), + boxesAlpha: ( + /*boxes_alpha*/ + l[19] + ), + height: ( + /*height*/ + l[8] + ), + width: ( + /*width*/ + l[9] + ), + labelList: ( + /*label_list*/ + l[20] + ), + labelColors: ( + /*label_colors*/ + l[21] + ), + boxMinSize: ( + /*box_min_size*/ + l[22] + ), + label: ( + /*label*/ + l[5] + ), + show_label: ( + /*show_label*/ + l[6] + ), + max_file_size: ( + /*gradio*/ + l[30].max_file_size + ), + cli_upload: ( + /*gradio*/ + l[30].client.upload + ), + stream_handler: ( + /*gradio*/ + l[30].client.stream + ), + handleSize: ( + /*handle_size*/ + l[23] + ), + boxThickness: ( + /*box_thickness*/ + l[24] + ), + boxSelectedThickness: ( + /*box_selected_thickness*/ + l[25] + ), + disableEditBoxes: ( + /*disable_edit_boxes*/ + l[26] + ), + singleBox: ( + /*single_box*/ + l[27] + ), + showRemoveButton: ( + /*show_remove_button*/ + l[28] + ), + handlesCursor: ( + /*handles_cursor*/ + l[29] + ), + $$slots: { default: [Nm] }, + $$scope: { ctx: l } + }; + return ( + /*active_source*/ + l[32] !== void 0 && (c.active_source = /*active_source*/ + l[32]), /*value*/ + l[0] !== void 0 && (c.value = /*value*/ + l[0]), n = new km({ props: c }), ia.push(() => la(n, "active_source", f)), ia.push(() => la(n, "value", u)), n.$on( + "change", + /*change_handler*/ + l[35] + ), n.$on( + "edit", + /*edit_handler*/ + l[36] + ), n.$on( + "clear", + /*clear_handler*/ + l[37] + ), n.$on( + "drag", + /*drag_handler*/ + l[38] + ), n.$on( + "upload", + /*upload_handler*/ + l[39] + ), n.$on( + "select", + /*select_handler*/ + l[40] + ), n.$on( + "share", + /*share_handler*/ + l[41] + ), n.$on( + "error", + /*error_handler*/ + l[42] + ), { + c() { + xt(e.$$.fragment), t = jm(), xt(n.$$.fragment); + }, + m(_, d) { + en(e, _, d), hr(_, t, d), en(n, _, d), s = !0; + }, + p(_, d) { + const h = d[0] & /*gradio, loading_status*/ + 1073741826 ? Dm(r, [ + d[0] & /*gradio*/ + 1073741824 && { + autoscroll: ( + /*gradio*/ + _[30].autoscroll + ) + }, + d[0] & /*gradio*/ + 1073741824 && { i18n: ( + /*gradio*/ + _[30].i18n + ) }, + d[0] & /*loading_status*/ + 2 && Lm( + /*loading_status*/ + _[1] + ) + ]) : {}; + e.$set(h); + const m = {}; + d[0] & /*_selectable*/ + 1024 && (m.selectable = /*_selectable*/ + _[10]), d[0] & /*root*/ + 128 && (m.root = /*root*/ + _[7]), d[0] & /*sources*/ + 16384 && (m.sources = /*sources*/ + _[14]), d[0] & /*interactive*/ + 262144 && (m.interactive = /*interactive*/ + _[18]), d[0] & /*show_download_button*/ + 32768 && (m.showDownloadButton = /*show_download_button*/ + _[15]), d[0] & /*show_share_button*/ + 65536 && (m.showShareButton = /*show_share_button*/ + _[16]), d[0] & /*show_clear_button*/ + 131072 && (m.showClearButton = /*show_clear_button*/ + _[17]), d[0] & /*gradio*/ + 1073741824 && (m.i18n = /*gradio*/ + _[30].i18n), d[0] & /*boxes_alpha*/ + 524288 && (m.boxesAlpha = /*boxes_alpha*/ + _[19]), d[0] & /*height*/ + 256 && (m.height = /*height*/ + _[8]), d[0] & /*width*/ + 512 && (m.width = /*width*/ + _[9]), d[0] & /*label_list*/ + 1048576 && (m.labelList = /*label_list*/ + _[20]), d[0] & /*label_colors*/ + 2097152 && (m.labelColors = /*label_colors*/ + _[21]), d[0] & /*box_min_size*/ + 4194304 && (m.boxMinSize = /*box_min_size*/ + _[22]), d[0] & /*label*/ + 32 && (m.label = /*label*/ + _[5]), d[0] & /*show_label*/ + 64 && (m.show_label = /*show_label*/ + _[6]), d[0] & /*gradio*/ + 1073741824 && (m.max_file_size = /*gradio*/ + _[30].max_file_size), d[0] & /*gradio*/ + 1073741824 && (m.cli_upload = /*gradio*/ + _[30].client.upload), d[0] & /*gradio*/ + 1073741824 && (m.stream_handler = /*gradio*/ + _[30].client.stream), d[0] & /*handle_size*/ + 8388608 && (m.handleSize = /*handle_size*/ + _[23]), d[0] & /*box_thickness*/ + 16777216 && (m.boxThickness = /*box_thickness*/ + _[24]), d[0] & /*box_selected_thickness*/ + 33554432 && (m.boxSelectedThickness = /*box_selected_thickness*/ + _[25]), d[0] & /*disable_edit_boxes*/ + 67108864 && (m.disableEditBoxes = /*disable_edit_boxes*/ + _[26]), d[0] & /*single_box*/ + 134217728 && (m.singleBox = /*single_box*/ + _[27]), d[0] & /*show_remove_button*/ + 268435456 && (m.showRemoveButton = /*show_remove_button*/ + _[28]), d[0] & /*handles_cursor*/ + 536870912 && (m.handlesCursor = /*handles_cursor*/ + _[29]), d[0] & /*gradio*/ + 1073741824 | d[1] & /*$$scope, active_source*/ + 4098 && (m.$$scope = { dirty: d, ctx: _ }), !i && d[1] & /*active_source*/ + 2 && (i = !0, m.active_source = /*active_source*/ + _[32], na(() => i = !1)), !o && d[0] & /*value*/ + 1 && (o = !0, m.value = /*value*/ + _[0], na(() => o = !1)), n.$set(m); + }, + i(_) { + s || (mt(e.$$.fragment, _), mt(n.$$.fragment, _), s = !0); + }, + o(_) { + gt(e.$$.fragment, _), gt(n.$$.fragment, _), s = !1; + }, + d(_) { + _ && dr(t), $t(e, _), $t(n, _); + } + } + ); +} +function Om(l) { + let e, t; + return e = new Ar({ + props: { + visible: ( + /*visible*/ + l[4] + ), + variant: "solid", + border_mode: ( + /*dragging*/ + l[31] ? "focus" : "base" + ), + padding: !1, + elem_id: ( + /*elem_id*/ + l[2] + ), + elem_classes: ( + /*elem_classes*/ + l[3] + ), + width: ( + /*width*/ + l[9] + ), + allow_overflow: !1, + container: ( + /*container*/ + l[11] + ), + scale: ( + /*scale*/ + l[12] + ), + min_width: ( + /*min_width*/ + l[13] + ), + $$slots: { default: [Um] }, + $$scope: { ctx: l } + } + }), { + c() { + xt(e.$$.fragment); + }, + m(n, i) { + en(e, n, i), t = !0; + }, + p(n, i) { + const o = {}; + i[0] & /*visible*/ + 16 && (o.visible = /*visible*/ + n[4]), i[1] & /*dragging*/ + 1 && (o.border_mode = /*dragging*/ + n[31] ? "focus" : "base"), i[0] & /*elem_id*/ + 4 && (o.elem_id = /*elem_id*/ + n[2]), i[0] & /*elem_classes*/ + 8 && (o.elem_classes = /*elem_classes*/ + n[3]), i[0] & /*width*/ + 512 && (o.width = /*width*/ + n[9]), i[0] & /*container*/ + 2048 && (o.container = /*container*/ + n[11]), i[0] & /*scale*/ + 4096 && (o.scale = /*scale*/ + n[12]), i[0] & /*min_width*/ + 8192 && (o.min_width = /*min_width*/ + n[13]), i[0] & /*_selectable, root, sources, interactive, show_download_button, show_share_button, show_clear_button, gradio, boxes_alpha, height, width, label_list, label_colors, box_min_size, label, show_label, handle_size, box_thickness, box_selected_thickness, disable_edit_boxes, single_box, show_remove_button, handles_cursor, value, loading_status*/ + 2147469283 | i[1] & /*$$scope, active_source, dragging*/ + 4099 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + }, + i(n) { + t || (mt(e.$$.fragment, n), t = !0); + }, + o(n) { + gt(e.$$.fragment, n), t = !1; + }, + d(n) { + $t(e, n); + } + }; +} +function Wm(l, e, t) { + let { elem_id: n = "" } = e, { elem_classes: i = [] } = e, { visible: o = !0 } = e, { value: s = null } = e, { label: r } = e, { show_label: a } = e, { root: f } = e, { height: u } = e, { width: c } = e, { _selectable: _ = !1 } = e, { container: d = !0 } = e, { scale: h = null } = e, { min_width: m = void 0 } = e, { loading_status: w } = e, { sources: b = ["upload", "webcam", "clipboard"] } = e, { show_download_button: p } = e, { show_share_button: g } = e, { show_clear_button: v } = e, { interactive: E } = e, { boxes_alpha: y } = e, { label_list: C } = e, { label_colors: k } = e, { box_min_size: A } = e, { handle_size: S } = e, { box_thickness: T } = e, { box_selected_thickness: R } = e, { disable_edit_boxes: U } = e, { single_box: Z } = e, { show_remove_button: Q } = e, { handles_cursor: J } = e, { gradio: K } = e, L, F = null; + function D(q) { + F = q, t(32, F); + } + function W(q) { + s = q, t(0, s); + } + const $ = () => K.dispatch("change"), oe = () => K.dispatch("edit"), ge = () => { + K.dispatch("clear"); + }, I = ({ detail: q }) => t(31, L = q), Xe = () => K.dispatch("upload"), M = ({ detail: q }) => K.dispatch("select", q), H = ({ detail: q }) => K.dispatch("share", q), G = ({ detail: q }) => { + t(1, w = w || {}), t(1, w.status = "error", w), K.dispatch("error", q); + }; + return l.$$set = (q) => { + "elem_id" in q && t(2, n = q.elem_id), "elem_classes" in q && t(3, i = q.elem_classes), "visible" in q && t(4, o = q.visible), "value" in q && t(0, s = q.value), "label" in q && t(5, r = q.label), "show_label" in q && t(6, a = q.show_label), "root" in q && t(7, f = q.root), "height" in q && t(8, u = q.height), "width" in q && t(9, c = q.width), "_selectable" in q && t(10, _ = q._selectable), "container" in q && t(11, d = q.container), "scale" in q && t(12, h = q.scale), "min_width" in q && t(13, m = q.min_width), "loading_status" in q && t(1, w = q.loading_status), "sources" in q && t(14, b = q.sources), "show_download_button" in q && t(15, p = q.show_download_button), "show_share_button" in q && t(16, g = q.show_share_button), "show_clear_button" in q && t(17, v = q.show_clear_button), "interactive" in q && t(18, E = q.interactive), "boxes_alpha" in q && t(19, y = q.boxes_alpha), "label_list" in q && t(20, C = q.label_list), "label_colors" in q && t(21, k = q.label_colors), "box_min_size" in q && t(22, A = q.box_min_size), "handle_size" in q && t(23, S = q.handle_size), "box_thickness" in q && t(24, T = q.box_thickness), "box_selected_thickness" in q && t(25, R = q.box_selected_thickness), "disable_edit_boxes" in q && t(26, U = q.disable_edit_boxes), "single_box" in q && t(27, Z = q.single_box), "show_remove_button" in q && t(28, Q = q.show_remove_button), "handles_cursor" in q && t(29, J = q.handles_cursor), "gradio" in q && t(30, K = q.gradio); + }, [ + s, + w, + n, + i, + o, + r, + a, + f, + u, + c, + _, + d, + h, + m, + b, + p, + g, + v, + E, + y, + C, + k, + A, + S, + T, + R, + U, + Z, + Q, + J, + K, + L, + F, + D, + W, + $, + oe, + ge, + I, + Xe, + M, + H, + G + ]; +} +class Qm extends qm { + constructor(e) { + super(), Tm( + this, + e, + Wm, + Om, + Im, + { + elem_id: 2, + elem_classes: 3, + visible: 4, + value: 0, + label: 5, + show_label: 6, + root: 7, + height: 8, + width: 9, + _selectable: 10, + container: 11, + scale: 12, + min_width: 13, + loading_status: 1, + sources: 14, + show_download_button: 15, + show_share_button: 16, + show_clear_button: 17, + interactive: 18, + boxes_alpha: 19, + label_list: 20, + label_colors: 21, + box_min_size: 22, + handle_size: 23, + box_thickness: 24, + box_selected_thickness: 25, + disable_edit_boxes: 26, + single_box: 27, + show_remove_button: 28, + handles_cursor: 29, + gradio: 30 + }, + null, + [-1, -1] + ); + } + get elem_id() { + return this.$$.ctx[2]; + } + set elem_id(e) { + this.$$set({ elem_id: e }), V(); + } + get elem_classes() { + return this.$$.ctx[3]; + } + set elem_classes(e) { + this.$$set({ elem_classes: e }), V(); + } + get visible() { + return this.$$.ctx[4]; + } + set visible(e) { + this.$$set({ visible: e }), V(); + } + get value() { + return this.$$.ctx[0]; + } + set value(e) { + this.$$set({ value: e }), V(); + } + get label() { + return this.$$.ctx[5]; + } + set label(e) { + this.$$set({ label: e }), V(); + } + get show_label() { + return this.$$.ctx[6]; + } + set show_label(e) { + this.$$set({ show_label: e }), V(); + } + get root() { + return this.$$.ctx[7]; + } + set root(e) { + this.$$set({ root: e }), V(); + } + get height() { + return this.$$.ctx[8]; + } + set height(e) { + this.$$set({ height: e }), V(); + } + get width() { + return this.$$.ctx[9]; + } + set width(e) { + this.$$set({ width: e }), V(); + } + get _selectable() { + return this.$$.ctx[10]; + } + set _selectable(e) { + this.$$set({ _selectable: e }), V(); + } + get container() { + return this.$$.ctx[11]; + } + set container(e) { + this.$$set({ container: e }), V(); + } + get scale() { + return this.$$.ctx[12]; + } + set scale(e) { + this.$$set({ scale: e }), V(); + } + get min_width() { + return this.$$.ctx[13]; + } + set min_width(e) { + this.$$set({ min_width: e }), V(); + } + get loading_status() { + return this.$$.ctx[1]; + } + set loading_status(e) { + this.$$set({ loading_status: e }), V(); + } + get sources() { + return this.$$.ctx[14]; + } + set sources(e) { + this.$$set({ sources: e }), V(); + } + get show_download_button() { + return this.$$.ctx[15]; + } + set show_download_button(e) { + this.$$set({ show_download_button: e }), V(); + } + get show_share_button() { + return this.$$.ctx[16]; + } + set show_share_button(e) { + this.$$set({ show_share_button: e }), V(); + } + get show_clear_button() { + return this.$$.ctx[17]; + } + set show_clear_button(e) { + this.$$set({ show_clear_button: e }), V(); + } + get interactive() { + return this.$$.ctx[18]; + } + set interactive(e) { + this.$$set({ interactive: e }), V(); + } + get boxes_alpha() { + return this.$$.ctx[19]; + } + set boxes_alpha(e) { + this.$$set({ boxes_alpha: e }), V(); + } + get label_list() { + return this.$$.ctx[20]; + } + set label_list(e) { + this.$$set({ label_list: e }), V(); + } + get label_colors() { + return this.$$.ctx[21]; + } + set label_colors(e) { + this.$$set({ label_colors: e }), V(); + } + get box_min_size() { + return this.$$.ctx[22]; + } + set box_min_size(e) { + this.$$set({ box_min_size: e }), V(); + } + get handle_size() { + return this.$$.ctx[23]; + } + set handle_size(e) { + this.$$set({ handle_size: e }), V(); + } + get box_thickness() { + return this.$$.ctx[24]; + } + set box_thickness(e) { + this.$$set({ box_thickness: e }), V(); + } + get box_selected_thickness() { + return this.$$.ctx[25]; + } + set box_selected_thickness(e) { + this.$$set({ box_selected_thickness: e }), V(); + } + get disable_edit_boxes() { + return this.$$.ctx[26]; + } + set disable_edit_boxes(e) { + this.$$set({ disable_edit_boxes: e }), V(); + } + get single_box() { + return this.$$.ctx[27]; + } + set single_box(e) { + this.$$set({ single_box: e }), V(); + } + get show_remove_button() { + return this.$$.ctx[28]; + } + set show_remove_button(e) { + this.$$set({ show_remove_button: e }), V(); + } + get handles_cursor() { + return this.$$.ctx[29]; + } + set handles_cursor(e) { + this.$$set({ handles_cursor: e }), V(); + } + get gradio() { + return this.$$.ctx[30]; + } + set gradio(e) { + this.$$set({ gradio: e }), V(); + } +} +export { + Jm as BaseExample, + Qm as default +}; diff --git a/src/backend/gradio_image_annotation/templates/component/style.css b/src/backend/gradio_image_annotation/templates/component/style.css new file mode 100644 index 0000000000000000000000000000000000000000..ff80660188ad550efbff5e57ad7137ef4e85403b --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/style.css @@ -0,0 +1 @@ +.block.svelte-nl1om8{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)}.block.border_focus.svelte-nl1om8{border-color:var(--color-accent)}.block.border_contrast.svelte-nl1om8{border-color:var(--body-text-color)}.padded.svelte-nl1om8{padding:var(--block-padding)}.hidden.svelte-nl1om8{display:none}.hide-container.svelte-nl1om8{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-1lrphxw{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-1lrphxw{opacity:.5;box-shadow:none}button[disabled].svelte-1lrphxw:hover{cursor:not-allowed}.padded.svelte-1lrphxw{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-1lrphxw:hover,button.highlight.svelte-1lrphxw{cursor:pointer;color:var(--color-accent)}.padded.svelte-1lrphxw:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-1lrphxw{padding:0 1px;font-size:10px}div.svelte-1lrphxw{padding:2px;display:flex;align-items:flex-end}.small.svelte-1lrphxw{width:14px;height:14px}.medium.svelte-1lrphxw{width:20px;height:20px}.large.svelte-1lrphxw{width:22px;height:22px}.pending.svelte-1lrphxw{animation:svelte-1lrphxw-flash .5s infinite}@keyframes svelte-1lrphxw-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-1lrphxw{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.dropdown-arrow.svelte-145leq6{fill:currentColor}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-q32hvf{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;align-items:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;color:var(--block-label-text-color);flex-shrink:0}.show_border.svelte-q32hvf{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}.wrap.svelte-16nch4a.svelte-16nch4a{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-2);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden}.wrap.center.svelte-16nch4a.svelte-16nch4a{top:0;right:0;left:0}.wrap.default.svelte-16nch4a.svelte-16nch4a{top:0;right:0;bottom:0;left:0}.hide.svelte-16nch4a.svelte-16nch4a{opacity:0;pointer-events:none}.generating.svelte-16nch4a.svelte-16nch4a{animation:svelte-16nch4a-pulseStart 1s cubic-bezier(.4,0,.6,1),svelte-16nch4a-pulse 2s cubic-bezier(.4,0,.6,1) 1s infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1);pointer-events:none}.translucent.svelte-16nch4a.svelte-16nch4a{background:none}@keyframes svelte-16nch4a-pulseStart{0%{opacity:0}to{opacity:1}}@keyframes svelte-16nch4a-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-16nch4a.svelte-16nch4a{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-16nch4a.svelte-16nch4a{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-16nch4a.svelte-16nch4a{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-16nch4a.svelte-16nch4a{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-16nch4a.svelte-16nch4a{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-16nch4a.svelte-16nch4a{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-16nch4a.svelte-16nch4a{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-16nch4a.svelte-16nch4a{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-16nch4a.svelte-16nch4a{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-16nch4a .progress-text.svelte-16nch4a{background:var(--block-background-fill)}.border.svelte-16nch4a.svelte-16nch4a{border:1px solid var(--border-color-primary)}.clear-status.svelte-16nch4a.svelte-16nch4a{position:absolute;display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.wrap.svelte-cr2edf.svelte-cr2edf{overflow-y:auto;transition:opacity .5s ease-in-out;background:var(--block-background-fill);position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:var(--size-40);width:var(--size-full)}.wrap.svelte-cr2edf.svelte-cr2edf:after{content:"";position:absolute;top:0;left:0;width:var(--upload-progress-width);height:100%;transition:all .5s ease-in-out;z-index:1}.uploading.svelte-cr2edf.svelte-cr2edf{font-size:var(--text-lg);font-family:var(--font);z-index:2}.file-name.svelte-cr2edf.svelte-cr2edf{margin:var(--spacing-md);font-size:var(--text-lg);color:var(--body-text-color-subdued)}.file.svelte-cr2edf.svelte-cr2edf{font-size:var(--text-md);z-index:2;display:flex;align-items:center}.file.svelte-cr2edf progress.svelte-cr2edf{display:inline;height:var(--size-1);width:100%;transition:all .5s ease-in-out;color:var(--color-accent);border:none}.file.svelte-cr2edf progress[value].svelte-cr2edf::-webkit-progress-value{background-color:var(--color-accent);border-radius:20px}.file.svelte-cr2edf progress[value].svelte-cr2edf::-webkit-progress-bar{background-color:var(--border-color-accent);border-radius:20px}.progress-bar.svelte-cr2edf.svelte-cr2edf{width:14px;height:14px;border-radius:50%;background:radial-gradient(closest-side,var(--block-background-fill) 64%,transparent 53% 100%),conic-gradient(var(--color-accent) var(--upload-progress-width),var(--border-color-accent) 0);transition:all .5s ease-in-out}button.svelte-1s26xmt{cursor:pointer;width:var(--size-full)}.hidden.svelte-1s26xmt{display:none;height:0!important;position:absolute;width:0;flex-grow:0}.center.svelte-1s26xmt{display:flex;justify-content:center}.flex.svelte-1s26xmt{display:flex;flex-direction:column;justify-content:center;align-items:center}.disable_click.svelte-1s26xmt{cursor:default}input.svelte-1s26xmt{display:none}div.svelte-1wj0ocy{display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.not-absolute.svelte-1wj0ocy{margin:var(--size-1)}img.svelte-kxeri3{object-fit:cover}.image-container.svelte-n22rtv img,button.svelte-n22rtv{width:var(--size-full);height:var(--size-full);object-fit:contain;display:block;border-radius:var(--radius-lg)}.selectable.svelte-n22rtv{cursor:crosshair}.icon-buttons.svelte-n22rtv{display:flex;position:absolute;top:6px;right:6px;gap:var(--size-1)}button.svelte-fjcd9c{cursor:pointer;width:var(--size-full)}.wrap.svelte-fjcd9c{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);height:100%;padding-top:var(--size-3)}.icon-wrap.svelte-fjcd9c{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-fjcd9c{font-size:var(--text-lg)}}.wrap.svelte-8hqvb6.svelte-8hqvb6{position:relative;width:var(--size-full);height:var(--size-full)}.hide.svelte-8hqvb6.svelte-8hqvb6{display:none}video.svelte-8hqvb6.svelte-8hqvb6{width:var(--size-full);height:var(--size-full);object-fit:cover}.button-wrap.svelte-8hqvb6.svelte-8hqvb6{position:absolute;background-color:var(--block-background-fill);border:1px solid var(--border-color-primary);padding:var(--size-1-5);display:flex;bottom:var(--size-2);left:50%;transform:translate(-50%);box-shadow:var(--shadow-drop-lg);border-radius:var(--radius-xl);line-height:var(--size-3);color:var(--button-secondary-text-color)}@media (--screen-md){button.svelte-8hqvb6.svelte-8hqvb6{bottom:var(--size-4)}}@media (--screen-xl){button.svelte-8hqvb6.svelte-8hqvb6{bottom:var(--size-8)}}.icon.svelte-8hqvb6.svelte-8hqvb6{opacity:.8;width:18px;height:18px;display:flex;justify-content:space-between;align-items:center}.red.svelte-8hqvb6.svelte-8hqvb6{fill:red;stroke:red}.flip.svelte-8hqvb6.svelte-8hqvb6{transform:scaleX(-1)}.select-wrap.svelte-8hqvb6.svelte-8hqvb6{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--button-secondary-text-color);background-color:transparent;width:95%;font-size:var(--text-md);position:absolute;bottom:var(--size-2);background-color:var(--block-background-fill);box-shadow:var(--shadow-drop-lg);border-radius:var(--radius-xl);z-index:var(--layer-top);border:1px solid var(--border-color-primary);text-align:left;line-height:var(--size-4);white-space:nowrap;text-overflow:ellipsis;left:50%;transform:translate(-50%);max-width:var(--size-52)}.select-wrap.svelte-8hqvb6>option.svelte-8hqvb6{padding:.25rem .5rem;border-bottom:1px solid var(--border-color-accent);padding-right:var(--size-8);text-overflow:ellipsis;overflow:hidden}.select-wrap.svelte-8hqvb6>option.svelte-8hqvb6:hover{background-color:var(--color-accent)}.select-wrap.svelte-8hqvb6>option.svelte-8hqvb6:last-child{border:none}.inset-icon.svelte-8hqvb6.svelte-8hqvb6{position:absolute;top:5px;right:-6.5px;width:var(--size-10);height:var(--size-5);opacity:.8}@media (--screen-md){.wrap.svelte-8hqvb6.svelte-8hqvb6{font-size:var(--text-lg)}}div.svelte-1g74h68{display:flex;position:absolute;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-5)}.image-frame.svelte-xgcoa0 img{width:var(--size-full);height:var(--size-full);object-fit:cover}.image-frame.svelte-xgcoa0{object-fit:cover;width:100%;height:100%}.upload-container.svelte-xgcoa0{height:100%;flex-shrink:1;max-height:100%}.image-container.svelte-xgcoa0{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center;max-height:100%}.selectable.svelte-xgcoa0{cursor:crosshair}input.svelte-16l8u73{display:block;position:relative;background:var(--background-fill-primary);line-height:var(--line-sm)}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1yserjw.svelte-1yserjw{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden;pointer-events:none}.wrap.center.svelte-1yserjw.svelte-1yserjw{top:0;right:0;left:0}.wrap.default.svelte-1yserjw.svelte-1yserjw{top:0;right:0;bottom:0;left:0}.hide.svelte-1yserjw.svelte-1yserjw{opacity:0;pointer-events:none}.generating.svelte-1yserjw.svelte-1yserjw{animation:svelte-1yserjw-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1)}.translucent.svelte-1yserjw.svelte-1yserjw{background:none}@keyframes svelte-1yserjw-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1yserjw.svelte-1yserjw{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1yserjw.svelte-1yserjw{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1yserjw.svelte-1yserjw{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1yserjw.svelte-1yserjw{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1yserjw.svelte-1yserjw{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1yserjw.svelte-1yserjw{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1yserjw.svelte-1yserjw{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1yserjw.svelte-1yserjw{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1yserjw.svelte-1yserjw{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1yserjw .progress-text.svelte-1yserjw{background:var(--block-background-fill)}.border.svelte-1yserjw.svelte-1yserjw{border:1px solid var(--border-color-primary)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}div.svelte-1vvnm05{width:var(--size-10);height:var(--size-10)}.table.svelte-1vvnm05{margin:0 auto}button.svelte-8huxfn,a.svelte-8huxfn{display:inline-flex;justify-content:center;align-items:center;transition:var(--button-transition);box-shadow:var(--button-shadow);padding:var(--size-0-5) var(--size-2);text-align:center}button.svelte-8huxfn:hover,button[disabled].svelte-8huxfn,a.svelte-8huxfn:hover,a.disabled.svelte-8huxfn{box-shadow:var(--button-shadow-hover)}button.svelte-8huxfn:active,a.svelte-8huxfn:active{box-shadow:var(--button-shadow-active)}button[disabled].svelte-8huxfn,a.disabled.svelte-8huxfn{opacity:.5;filter:grayscale(30%);cursor:not-allowed}.hidden.svelte-8huxfn{display:none}.primary.svelte-8huxfn{border:var(--button-border-width) solid var(--button-primary-border-color);background:var(--button-primary-background-fill);color:var(--button-primary-text-color)}.primary.svelte-8huxfn:hover,.primary[disabled].svelte-8huxfn{border-color:var(--button-primary-border-color-hover);background:var(--button-primary-background-fill-hover);color:var(--button-primary-text-color-hover)}.secondary.svelte-8huxfn{border:var(--button-border-width) solid var(--button-secondary-border-color);background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color)}.secondary.svelte-8huxfn:hover,.secondary[disabled].svelte-8huxfn{border-color:var(--button-secondary-border-color-hover);background:var(--button-secondary-background-fill-hover);color:var(--button-secondary-text-color-hover)}.stop.svelte-8huxfn{border:var(--button-border-width) solid var(--button-cancel-border-color);background:var(--button-cancel-background-fill);color:var(--button-cancel-text-color)}.stop.svelte-8huxfn:hover,.stop[disabled].svelte-8huxfn{border-color:var(--button-cancel-border-color-hover);background:var(--button-cancel-background-fill-hover);color:var(--button-cancel-text-color-hover)}.sm.svelte-8huxfn{border-radius:var(--button-small-radius);padding:var(--button-small-padding);font-weight:var(--button-small-text-weight);font-size:var(--button-small-text-size)}.lg.svelte-8huxfn{border-radius:var(--button-large-radius);padding:var(--button-large-padding);font-weight:var(--button-large-text-weight);font-size:var(--button-large-text-size)}.button-icon.svelte-8huxfn{width:var(--text-xl);height:var(--text-xl);margin-right:var(--spacing-xl)}.options.svelte-yuohum{--window-padding:var(--size-8);position:fixed;z-index:var(--layer-top);margin-left:0;box-shadow:var(--shadow-drop-lg);border-radius:var(--container-radius);background:var(--background-fill-primary);min-width:fit-content;max-width:inherit;overflow:auto;color:var(--body-text-color);list-style:none}.item.svelte-yuohum{display:flex;cursor:pointer;padding:var(--size-2)}.item.svelte-yuohum:hover,.active.svelte-yuohum{background:var(--background-fill-secondary)}.inner-item.svelte-yuohum{padding-right:var(--size-1)}.hide.svelte-yuohum{visibility:hidden}.icon-wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{color:var(--body-text-color);margin-right:var(--size-2);width:var(--size-5)}label.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg:not(.container),label.svelte-xtjjyg:not(.container) .wrap.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) .wrap-inner.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) .secondary-wrap.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) .token.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) input.svelte-xtjjyg.svelte-xtjjyg{height:100%}.container.svelte-xtjjyg .wrap.svelte-xtjjyg.svelte-xtjjyg{box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--border-color-primary)}.wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{position:relative;border-radius:var(--input-radius);background:var(--input-background-fill)}.wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg:focus-within{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}.wrap-inner.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{display:flex;position:relative;flex-wrap:wrap;align-items:center;gap:var(--checkbox-label-gap);padding:var(--checkbox-label-padding)}.token.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{display:flex;align-items:center;transition:var(--button-transition);cursor:pointer;box-shadow:var(--checkbox-label-shadow);border:var(--checkbox-label-border-width) solid var(--checkbox-label-border-color);border-radius:var(--button-small-radius);background:var(--checkbox-label-background-fill);padding:var(--checkbox-label-padding);color:var(--checkbox-label-text-color);font-weight:var(--checkbox-label-text-weight);font-size:var(--checkbox-label-text-size);line-height:var(--line-md)}.token.svelte-xtjjyg>.svelte-xtjjyg+.svelte-xtjjyg{margin-left:var(--size-2)}.token-remove.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{fill:var(--body-text-color);display:flex;justify-content:center;align-items:center;cursor:pointer;border:var(--checkbox-border-width) solid var(--border-color-primary);border-radius:var(--radius-full);background:var(--background-fill-primary);padding:var(--size-0-5);width:16px;height:16px}.secondary-wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{display:flex;flex:1 1 0%;align-items:center;border:none;min-width:min-content}input.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{margin:var(--spacing-sm);outline:none;border:none;background:inherit;width:var(--size-full);color:var(--body-text-color);font-size:var(--input-text-size)}input.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1;cursor:not-allowed}.remove-all.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{margin-left:var(--size-1);width:20px;height:20px}.subdued.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{color:var(--body-text-color-subdued)}input[readonly].svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{cursor:pointer}.icon-wrap.svelte-1m1zvyj.svelte-1m1zvyj{color:var(--body-text-color);margin-right:var(--size-2);width:var(--size-5)}.container.svelte-1m1zvyj.svelte-1m1zvyj{height:100%}.container.svelte-1m1zvyj .wrap.svelte-1m1zvyj{box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--border-color-primary)}.wrap.svelte-1m1zvyj.svelte-1m1zvyj{position:relative;border-radius:var(--input-radius);background:var(--input-background-fill)}.wrap.svelte-1m1zvyj.svelte-1m1zvyj:focus-within{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}.wrap-inner.svelte-1m1zvyj.svelte-1m1zvyj{display:flex;position:relative;flex-wrap:wrap;align-items:center;gap:var(--checkbox-label-gap);padding:var(--checkbox-label-padding);height:100%}.secondary-wrap.svelte-1m1zvyj.svelte-1m1zvyj{display:flex;flex:1 1 0%;align-items:center;border:none;min-width:min-content;height:100%}input.svelte-1m1zvyj.svelte-1m1zvyj{margin:var(--spacing-sm);outline:none;border:none;background:inherit;width:var(--size-full);color:var(--body-text-color);font-size:var(--input-text-size);height:100%}input.svelte-1m1zvyj.svelte-1m1zvyj:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1;cursor:not-allowed}.subdued.svelte-1m1zvyj.svelte-1m1zvyj{color:var(--body-text-color-subdued)}input[readonly].svelte-1m1zvyj.svelte-1m1zvyj{cursor:pointer}.gallery.svelte-1gecy8w{padding:var(--size-1) var(--size-2)}.modal.svelte-hkn2q1{position:fixed;left:0;top:0;width:100%;height:100%;z-index:var(--layer-top);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.modal-container.svelte-hkn2q1{border-style:solid;border-width:var(--block-border-width);margin-top:10%;padding:20px;box-shadow:var(--block-shadow);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);position:fixed;left:50%;transform:translate(-50%);width:fit-content}.model-content.svelte-hkn2q1{display:flex;align-items:flex-end}.canvas-annotator.svelte-1m8vz1h{border-color:var(--block-border-color);width:100%;height:100%;display:block;touch-action:none}.canvas-control.svelte-1m8vz1h{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto;margin-top:var(--size-2)}.icon.svelte-1m8vz1h{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.icon.svelte-1m8vz1h:hover,.icon.svelte-1m8vz1h:focus{color:var(--color-accent)}.selected.svelte-1m8vz1h{color:var(--color-accent)}.canvas-container.svelte-1m8vz1h{display:flex;justify-content:center;align-items:center}.canvas-container.svelte-1m8vz1h:focus{outline:none}.image-frame.svelte-1gjdske img{width:var(--size-full);height:var(--size-full);object-fit:cover}.image-frame.svelte-1gjdske{object-fit:cover;width:100%}.upload-container.svelte-1gjdske{height:100%;width:100%;flex-shrink:1;max-height:100%}.image-container.svelte-1gjdske{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center;max-height:100%}.selectable.svelte-1gjdske{cursor:crosshair}.icon-buttons.svelte-1gjdske{display:flex;position:absolute;top:6px;right:6px;gap:var(--size-1)}.container.svelte-1sgcyba img{width:100%;height:100%}.container.selected.svelte-1sgcyba{border-color:var(--border-color-accent)}.border.table.svelte-1sgcyba{border:2px solid var(--border-color-primary)}.container.table.svelte-1sgcyba{margin:0 auto;border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-1sgcyba{width:var(--size-20);max-width:var(--size-20);object-fit:cover} diff --git a/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-19fa94bf.js b/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-19fa94bf.js new file mode 100644 index 0000000000000000000000000000000000000000..1ef0e6df97294c20a28fdda045e5142272f160d3 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-19fa94bf.js @@ -0,0 +1,2453 @@ +import S from "./__vite-browser-external-2447137e.js"; +function z(s) { + return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; +} +function gt(s) { + if (s.__esModule) + return s; + var e = s.default; + if (typeof e == "function") { + var t = function r() { + if (this instanceof r) { + var i = [null]; + i.push.apply(i, arguments); + var n = Function.bind.apply(e, i); + return new n(); + } + return e.apply(this, arguments); + }; + t.prototype = e.prototype; + } else + t = {}; + return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(s).forEach(function(r) { + var i = Object.getOwnPropertyDescriptor(s, r); + Object.defineProperty(t, r, i.get ? i : { + enumerable: !0, + get: function() { + return s[r]; + } + }); + }), t; +} +const { Duplex: yt } = S; +function Oe(s) { + s.emit("close"); +} +function vt() { + !this.destroyed && this._writableState.finished && this.destroy(); +} +function Qe(s) { + this.removeListener("error", Qe), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", s); +} +function St(s, e) { + let t = !0; + const r = new yt({ + ...e, + autoDestroy: !1, + emitClose: !1, + objectMode: !1, + writableObjectMode: !1 + }); + return s.on("message", function(n, o) { + const l = !o && r._readableState.objectMode ? n.toString() : n; + r.push(l) || s.pause(); + }), s.once("error", function(n) { + r.destroyed || (t = !1, r.destroy(n)); + }), s.once("close", function() { + r.destroyed || r.push(null); + }), r._destroy = function(i, n) { + if (s.readyState === s.CLOSED) { + n(i), process.nextTick(Oe, r); + return; + } + let o = !1; + s.once("error", function(f) { + o = !0, n(f); + }), s.once("close", function() { + o || n(i), process.nextTick(Oe, r); + }), t && s.terminate(); + }, r._final = function(i) { + if (s.readyState === s.CONNECTING) { + s.once("open", function() { + r._final(i); + }); + return; + } + s._socket !== null && (s._socket._writableState.finished ? (i(), r._readableState.endEmitted && r.destroy()) : (s._socket.once("finish", function() { + i(); + }), s.close())); + }, r._read = function() { + s.isPaused && s.resume(); + }, r._write = function(i, n, o) { + if (s.readyState === s.CONNECTING) { + s.once("open", function() { + r._write(i, n, o); + }); + return; + } + s.send(i, o); + }, r.on("end", vt), r.on("error", Qe), r; +} +var Et = St; +const Vs = /* @__PURE__ */ z(Et); +var te = { exports: {} }, U = { + BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"], + EMPTY_BUFFER: Buffer.alloc(0), + GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", + kForOnEventAttribute: Symbol("kIsForOnEventAttribute"), + kListener: Symbol("kListener"), + kStatusCode: Symbol("status-code"), + kWebSocket: Symbol("websocket"), + NOOP: () => { + } +}, bt, xt; +const { EMPTY_BUFFER: kt } = U, Se = Buffer[Symbol.species]; +function wt(s, e) { + if (s.length === 0) + return kt; + if (s.length === 1) + return s[0]; + const t = Buffer.allocUnsafe(e); + let r = 0; + for (let i = 0; i < s.length; i++) { + const n = s[i]; + t.set(n, r), r += n.length; + } + return r < e ? new Se(t.buffer, t.byteOffset, r) : t; +} +function Je(s, e, t, r, i) { + for (let n = 0; n < i; n++) + t[r + n] = s[n] ^ e[n & 3]; +} +function et(s, e) { + for (let t = 0; t < s.length; t++) + s[t] ^= e[t & 3]; +} +function Ot(s) { + return s.length === s.buffer.byteLength ? s.buffer : s.buffer.slice(s.byteOffset, s.byteOffset + s.length); +} +function Ee(s) { + if (Ee.readOnly = !0, Buffer.isBuffer(s)) + return s; + let e; + return s instanceof ArrayBuffer ? e = new Se(s) : ArrayBuffer.isView(s) ? e = new Se(s.buffer, s.byteOffset, s.byteLength) : (e = Buffer.from(s), Ee.readOnly = !1), e; +} +te.exports = { + concat: wt, + mask: Je, + toArrayBuffer: Ot, + toBuffer: Ee, + unmask: et +}; +if (!process.env.WS_NO_BUFFER_UTIL) + try { + const s = require("bufferutil"); + xt = te.exports.mask = function(e, t, r, i, n) { + n < 48 ? Je(e, t, r, i, n) : s.mask(e, t, r, i, n); + }, bt = te.exports.unmask = function(e, t) { + e.length < 32 ? et(e, t) : s.unmask(e, t); + }; + } catch { + } +var ne = te.exports; +const Ce = Symbol("kDone"), ue = Symbol("kRun"); +let Ct = class { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(e) { + this[Ce] = () => { + this.pending--, this[ue](); + }, this.concurrency = e || 1 / 0, this.jobs = [], this.pending = 0; + } + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(e) { + this.jobs.push(e), this[ue](); + } + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [ue]() { + if (this.pending !== this.concurrency && this.jobs.length) { + const e = this.jobs.shift(); + this.pending++, e(this[Ce]); + } + } +}; +var Tt = Ct; +const W = S, Te = ne, Lt = Tt, { kStatusCode: tt } = U, Nt = Buffer[Symbol.species], Pt = Buffer.from([0, 0, 255, 255]), se = Symbol("permessage-deflate"), w = Symbol("total-length"), V = Symbol("callback"), C = Symbol("buffers"), J = Symbol("error"); +let K, Rt = class { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed if context takeover is disabled + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(e, t, r) { + if (this._maxPayload = r | 0, this._options = e || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._isServer = !!t, this._deflate = null, this._inflate = null, this.params = null, !K) { + const i = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10; + K = new Lt(i); + } + } + /** + * @type {String} + */ + static get extensionName() { + return "permessage-deflate"; + } + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const e = {}; + return this._options.serverNoContextTakeover && (e.server_no_context_takeover = !0), this._options.clientNoContextTakeover && (e.client_no_context_takeover = !0), this._options.serverMaxWindowBits && (e.server_max_window_bits = this._options.serverMaxWindowBits), this._options.clientMaxWindowBits ? e.client_max_window_bits = this._options.clientMaxWindowBits : this._options.clientMaxWindowBits == null && (e.client_max_window_bits = !0), e; + } + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(e) { + return e = this.normalizeParams(e), this.params = this._isServer ? this.acceptAsServer(e) : this.acceptAsClient(e), this.params; + } + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate && (this._inflate.close(), this._inflate = null), this._deflate) { + const e = this._deflate[V]; + this._deflate.close(), this._deflate = null, e && e( + new Error( + "The deflate stream was closed while data was being processed" + ) + ); + } + } + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(e) { + const t = this._options, r = e.find((i) => !(t.serverNoContextTakeover === !1 && i.server_no_context_takeover || i.server_max_window_bits && (t.serverMaxWindowBits === !1 || typeof t.serverMaxWindowBits == "number" && t.serverMaxWindowBits > i.server_max_window_bits) || typeof t.clientMaxWindowBits == "number" && !i.client_max_window_bits)); + if (!r) + throw new Error("None of the extension offers can be accepted"); + return t.serverNoContextTakeover && (r.server_no_context_takeover = !0), t.clientNoContextTakeover && (r.client_no_context_takeover = !0), typeof t.serverMaxWindowBits == "number" && (r.server_max_window_bits = t.serverMaxWindowBits), typeof t.clientMaxWindowBits == "number" ? r.client_max_window_bits = t.clientMaxWindowBits : (r.client_max_window_bits === !0 || t.clientMaxWindowBits === !1) && delete r.client_max_window_bits, r; + } + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(e) { + const t = e[0]; + if (this._options.clientNoContextTakeover === !1 && t.client_no_context_takeover) + throw new Error('Unexpected parameter "client_no_context_takeover"'); + if (!t.client_max_window_bits) + typeof this._options.clientMaxWindowBits == "number" && (t.client_max_window_bits = this._options.clientMaxWindowBits); + else if (this._options.clientMaxWindowBits === !1 || typeof this._options.clientMaxWindowBits == "number" && t.client_max_window_bits > this._options.clientMaxWindowBits) + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + return t; + } + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(e) { + return e.forEach((t) => { + Object.keys(t).forEach((r) => { + let i = t[r]; + if (i.length > 1) + throw new Error(`Parameter "${r}" must have only a single value`); + if (i = i[0], r === "client_max_window_bits") { + if (i !== !0) { + const n = +i; + if (!Number.isInteger(n) || n < 8 || n > 15) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + i = n; + } else if (!this._isServer) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + } else if (r === "server_max_window_bits") { + const n = +i; + if (!Number.isInteger(n) || n < 8 || n > 15) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + i = n; + } else if (r === "client_no_context_takeover" || r === "server_no_context_takeover") { + if (i !== !0) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + } else + throw new Error(`Unknown parameter "${r}"`); + t[r] = i; + }); + }), e; + } + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(e, t, r) { + K.add((i) => { + this._decompress(e, t, (n, o) => { + i(), r(n, o); + }); + }); + } + /** + * Compress data. Concurrency limited. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(e, t, r) { + K.add((i) => { + this._compress(e, t, (n, o) => { + i(), r(n, o); + }); + }); + } + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(e, t, r) { + const i = this._isServer ? "client" : "server"; + if (!this._inflate) { + const n = `${i}_max_window_bits`, o = typeof this.params[n] != "number" ? W.Z_DEFAULT_WINDOWBITS : this.params[n]; + this._inflate = W.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits: o + }), this._inflate[se] = this, this._inflate[w] = 0, this._inflate[C] = [], this._inflate.on("error", Bt), this._inflate.on("data", st); + } + this._inflate[V] = r, this._inflate.write(e), t && this._inflate.write(Pt), this._inflate.flush(() => { + const n = this._inflate[J]; + if (n) { + this._inflate.close(), this._inflate = null, r(n); + return; + } + const o = Te.concat( + this._inflate[C], + this._inflate[w] + ); + this._inflate._readableState.endEmitted ? (this._inflate.close(), this._inflate = null) : (this._inflate[w] = 0, this._inflate[C] = [], t && this.params[`${i}_no_context_takeover`] && this._inflate.reset()), r(null, o); + }); + } + /** + * Compress data. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(e, t, r) { + const i = this._isServer ? "server" : "client"; + if (!this._deflate) { + const n = `${i}_max_window_bits`, o = typeof this.params[n] != "number" ? W.Z_DEFAULT_WINDOWBITS : this.params[n]; + this._deflate = W.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits: o + }), this._deflate[w] = 0, this._deflate[C] = [], this._deflate.on("data", Ut); + } + this._deflate[V] = r, this._deflate.write(e), this._deflate.flush(W.Z_SYNC_FLUSH, () => { + if (!this._deflate) + return; + let n = Te.concat( + this._deflate[C], + this._deflate[w] + ); + t && (n = new Nt(n.buffer, n.byteOffset, n.length - 4)), this._deflate[V] = null, this._deflate[w] = 0, this._deflate[C] = [], t && this.params[`${i}_no_context_takeover`] && this._deflate.reset(), r(null, n); + }); + } +}; +var oe = Rt; +function Ut(s) { + this[C].push(s), this[w] += s.length; +} +function st(s) { + if (this[w] += s.length, this[se]._maxPayload < 1 || this[w] <= this[se]._maxPayload) { + this[C].push(s); + return; + } + this[J] = new RangeError("Max payload size exceeded"), this[J].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[J][tt] = 1009, this.removeListener("data", st), this.reset(); +} +function Bt(s) { + this[se]._inflate = null, s[tt] = 1007, this[V](s); +} +var re = { exports: {} }; +const $t = {}, Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: $t +}, Symbol.toStringTag, { value: "Module" })), It = /* @__PURE__ */ gt(Mt); +var Le; +const { isUtf8: Ne } = S, Dt = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 0 - 15 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 16 - 31 + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + // 32 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + // 48 - 63 + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 64 - 79 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + // 80 - 95 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 96 - 111 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0 + // 112 - 127 +]; +function Wt(s) { + return s >= 1e3 && s <= 1014 && s !== 1004 && s !== 1005 && s !== 1006 || s >= 3e3 && s <= 4999; +} +function be(s) { + const e = s.length; + let t = 0; + for (; t < e; ) + if (!(s[t] & 128)) + t++; + else if ((s[t] & 224) === 192) { + if (t + 1 === e || (s[t + 1] & 192) !== 128 || (s[t] & 254) === 192) + return !1; + t += 2; + } else if ((s[t] & 240) === 224) { + if (t + 2 >= e || (s[t + 1] & 192) !== 128 || (s[t + 2] & 192) !== 128 || s[t] === 224 && (s[t + 1] & 224) === 128 || // Overlong + s[t] === 237 && (s[t + 1] & 224) === 160) + return !1; + t += 3; + } else if ((s[t] & 248) === 240) { + if (t + 3 >= e || (s[t + 1] & 192) !== 128 || (s[t + 2] & 192) !== 128 || (s[t + 3] & 192) !== 128 || s[t] === 240 && (s[t + 1] & 240) === 128 || // Overlong + s[t] === 244 && s[t + 1] > 143 || s[t] > 244) + return !1; + t += 4; + } else + return !1; + return !0; +} +re.exports = { + isValidStatusCode: Wt, + isValidUTF8: be, + tokenChars: Dt +}; +if (Ne) + Le = re.exports.isValidUTF8 = function(s) { + return s.length < 24 ? be(s) : Ne(s); + }; +else if (!process.env.WS_NO_UTF_8_VALIDATE) + try { + const s = It; + Le = re.exports.isValidUTF8 = function(e) { + return e.length < 32 ? be(e) : s(e); + }; + } catch { + } +var ae = re.exports; +const { Writable: At } = S, Pe = oe, { + BINARY_TYPES: Ft, + EMPTY_BUFFER: Re, + kStatusCode: jt, + kWebSocket: Gt +} = U, { concat: de, toArrayBuffer: Vt, unmask: Ht } = ne, { isValidStatusCode: zt, isValidUTF8: Ue } = ae, X = Buffer[Symbol.species], A = 0, Be = 1, $e = 2, Me = 3, _e = 4, Yt = 5; +let qt = class extends At { + /** + * Creates a Receiver instance. + * + * @param {Object} [options] Options object + * @param {String} [options.binaryType=nodebuffer] The type for binary data + * @param {Object} [options.extensions] An object containing the negotiated + * extensions + * @param {Boolean} [options.isServer=false] Specifies whether to operate in + * client or server mode + * @param {Number} [options.maxPayload=0] The maximum allowed message length + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + */ + constructor(e = {}) { + super(), this._binaryType = e.binaryType || Ft[0], this._extensions = e.extensions || {}, this._isServer = !!e.isServer, this._maxPayload = e.maxPayload | 0, this._skipUTF8Validation = !!e.skipUTF8Validation, this[Gt] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._state = A, this._loop = !1; + } + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(e, t, r) { + if (this._opcode === 8 && this._state == A) + return r(); + this._bufferedBytes += e.length, this._buffers.push(e), this.startLoop(r); + } + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(e) { + if (this._bufferedBytes -= e, e === this._buffers[0].length) + return this._buffers.shift(); + if (e < this._buffers[0].length) { + const r = this._buffers[0]; + return this._buffers[0] = new X( + r.buffer, + r.byteOffset + e, + r.length - e + ), new X(r.buffer, r.byteOffset, e); + } + const t = Buffer.allocUnsafe(e); + do { + const r = this._buffers[0], i = t.length - e; + e >= r.length ? t.set(this._buffers.shift(), i) : (t.set(new Uint8Array(r.buffer, r.byteOffset, e), i), this._buffers[0] = new X( + r.buffer, + r.byteOffset + e, + r.length - e + )), e -= r.length; + } while (e > 0); + return t; + } + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(e) { + let t; + this._loop = !0; + do + switch (this._state) { + case A: + t = this.getInfo(); + break; + case Be: + t = this.getPayloadLength16(); + break; + case $e: + t = this.getPayloadLength64(); + break; + case Me: + this.getMask(); + break; + case _e: + t = this.getData(e); + break; + default: + this._loop = !1; + return; + } + while (this._loop); + e(t); + } + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = !1; + return; + } + const e = this.consume(2); + if (e[0] & 48) + return this._loop = !1, g( + RangeError, + "RSV2 and RSV3 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_2_3" + ); + const t = (e[0] & 64) === 64; + if (t && !this._extensions[Pe.extensionName]) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (this._fin = (e[0] & 128) === 128, this._opcode = e[0] & 15, this._payloadLength = e[1] & 127, this._opcode === 0) { + if (t) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (!this._fragmented) + return this._loop = !1, g( + RangeError, + "invalid opcode 0", + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + this._opcode = this._fragmented; + } else if (this._opcode === 1 || this._opcode === 2) { + if (this._fragmented) + return this._loop = !1, g( + RangeError, + `invalid opcode ${this._opcode}`, + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + this._compressed = t; + } else if (this._opcode > 7 && this._opcode < 11) { + if (!this._fin) + return this._loop = !1, g( + RangeError, + "FIN must be set", + !0, + 1002, + "WS_ERR_EXPECTED_FIN" + ); + if (t) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) + return this._loop = !1, g( + RangeError, + `invalid payload length ${this._payloadLength}`, + !0, + 1002, + "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH" + ); + } else + return this._loop = !1, g( + RangeError, + `invalid opcode ${this._opcode}`, + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (e[1] & 128) === 128, this._isServer) { + if (!this._masked) + return this._loop = !1, g( + RangeError, + "MASK must be set", + !0, + 1002, + "WS_ERR_EXPECTED_MASK" + ); + } else if (this._masked) + return this._loop = !1, g( + RangeError, + "MASK must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_MASK" + ); + if (this._payloadLength === 126) + this._state = Be; + else if (this._payloadLength === 127) + this._state = $e; + else + return this.haveLength(); + } + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = !1; + return; + } + return this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(); + } + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = !1; + return; + } + const e = this.consume(8), t = e.readUInt32BE(0); + return t > Math.pow(2, 21) - 1 ? (this._loop = !1, g( + RangeError, + "Unsupported WebSocket frame: payload length > 2^53 - 1", + !1, + 1009, + "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH" + )) : (this._payloadLength = t * Math.pow(2, 32) + e.readUInt32BE(4), this.haveLength()); + } + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0)) + return this._loop = !1, g( + RangeError, + "Max payload size exceeded", + !1, + 1009, + "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" + ); + this._masked ? this._state = Me : this._state = _e; + } + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = !1; + return; + } + this._mask = this.consume(4), this._state = _e; + } + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(e) { + let t = Re; + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = !1; + return; + } + t = this.consume(this._payloadLength), this._masked && this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3] && Ht(t, this._mask); + } + if (this._opcode > 7) + return this.controlMessage(t); + if (this._compressed) { + this._state = Yt, this.decompress(t, e); + return; + } + return t.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(t)), this.dataMessage(); + } + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(e, t) { + this._extensions[Pe.extensionName].decompress(e, this._fin, (i, n) => { + if (i) + return t(i); + if (n.length) { + if (this._messageLength += n.length, this._messageLength > this._maxPayload && this._maxPayload > 0) + return t( + g( + RangeError, + "Max payload size exceeded", + !1, + 1009, + "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" + ) + ); + this._fragments.push(n); + } + const o = this.dataMessage(); + if (o) + return t(o); + this.startLoop(t); + }); + } + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const e = this._messageLength, t = this._fragments; + if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], this._opcode === 2) { + let r; + this._binaryType === "nodebuffer" ? r = de(t, e) : this._binaryType === "arraybuffer" ? r = Vt(de(t, e)) : r = t, this.emit("message", r, !0); + } else { + const r = de(t, e); + if (!this._skipUTF8Validation && !Ue(r)) + return this._loop = !1, g( + Error, + "invalid UTF-8 sequence", + !0, + 1007, + "WS_ERR_INVALID_UTF8" + ); + this.emit("message", r, !1); + } + } + this._state = A; + } + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(e) { + if (this._opcode === 8) + if (this._loop = !1, e.length === 0) + this.emit("conclude", 1005, Re), this.end(); + else { + const t = e.readUInt16BE(0); + if (!zt(t)) + return g( + RangeError, + `invalid status code ${t}`, + !0, + 1002, + "WS_ERR_INVALID_CLOSE_CODE" + ); + const r = new X( + e.buffer, + e.byteOffset + 2, + e.length - 2 + ); + if (!this._skipUTF8Validation && !Ue(r)) + return g( + Error, + "invalid UTF-8 sequence", + !0, + 1007, + "WS_ERR_INVALID_UTF8" + ); + this.emit("conclude", t, r), this.end(); + } + else + this._opcode === 9 ? this.emit("ping", e) : this.emit("pong", e); + this._state = A; + } +}; +var rt = qt; +function g(s, e, t, r, i) { + const n = new s( + t ? `Invalid WebSocket frame: ${e}` : e + ); + return Error.captureStackTrace(n, g), n.code = i, n[jt] = r, n; +} +const qs = /* @__PURE__ */ z(rt), { randomFillSync: Kt } = S, Ie = oe, { EMPTY_BUFFER: Xt } = U, { isValidStatusCode: Zt } = ae, { mask: De, toBuffer: M } = ne, x = Symbol("kByteLength"), Qt = Buffer.alloc(4); +let Jt = class P { + /** + * Creates a Sender instance. + * + * @param {(net.Socket|tls.Socket)} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Function} [generateMask] The function used to generate the masking + * key + */ + constructor(e, t, r) { + this._extensions = t || {}, r && (this._generateMask = r, this._maskBuffer = Buffer.alloc(4)), this._socket = e, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this._deflating = !1, this._queue = []; + } + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {(Buffer|String)} data The data to frame + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {(Buffer|String)[]} The framed data + * @public + */ + static frame(e, t) { + let r, i = !1, n = 2, o = !1; + t.mask && (r = t.maskBuffer || Qt, t.generateMask ? t.generateMask(r) : Kt(r, 0, 4), o = (r[0] | r[1] | r[2] | r[3]) === 0, n = 6); + let l; + typeof e == "string" ? (!t.mask || o) && t[x] !== void 0 ? l = t[x] : (e = Buffer.from(e), l = e.length) : (l = e.length, i = t.mask && t.readOnly && !o); + let f = l; + l >= 65536 ? (n += 8, f = 127) : l > 125 && (n += 2, f = 126); + const a = Buffer.allocUnsafe(i ? l + n : n); + return a[0] = t.fin ? t.opcode | 128 : t.opcode, t.rsv1 && (a[0] |= 64), a[1] = f, f === 126 ? a.writeUInt16BE(l, 2) : f === 127 && (a[2] = a[3] = 0, a.writeUIntBE(l, 4, 6)), t.mask ? (a[1] |= 128, a[n - 4] = r[0], a[n - 3] = r[1], a[n - 2] = r[2], a[n - 1] = r[3], o ? [a, e] : i ? (De(e, r, a, n, l), [a]) : (De(e, r, e, 0, l), [a, e])) : [a, e]; + } + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {(String|Buffer)} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(e, t, r, i) { + let n; + if (e === void 0) + n = Xt; + else { + if (typeof e != "number" || !Zt(e)) + throw new TypeError("First argument must be a valid error code number"); + if (t === void 0 || !t.length) + n = Buffer.allocUnsafe(2), n.writeUInt16BE(e, 0); + else { + const l = Buffer.byteLength(t); + if (l > 123) + throw new RangeError("The message must not be greater than 123 bytes"); + n = Buffer.allocUnsafe(2 + l), n.writeUInt16BE(e, 0), typeof t == "string" ? n.write(t, 2) : n.set(t, 2); + } + } + const o = { + [x]: n.length, + fin: !0, + generateMask: this._generateMask, + mask: r, + maskBuffer: this._maskBuffer, + opcode: 8, + readOnly: !1, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, n, !1, o, i]) : this.sendFrame(P.frame(n, o), i); + } + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(e, t, r) { + let i, n; + if (typeof e == "string" ? (i = Buffer.byteLength(e), n = !1) : (e = M(e), i = e.length, n = M.readOnly), i > 125) + throw new RangeError("The data size must not be greater than 125 bytes"); + const o = { + [x]: i, + fin: !0, + generateMask: this._generateMask, + mask: t, + maskBuffer: this._maskBuffer, + opcode: 9, + readOnly: n, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, e, !1, o, r]) : this.sendFrame(P.frame(e, o), r); + } + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(e, t, r) { + let i, n; + if (typeof e == "string" ? (i = Buffer.byteLength(e), n = !1) : (e = M(e), i = e.length, n = M.readOnly), i > 125) + throw new RangeError("The data size must not be greater than 125 bytes"); + const o = { + [x]: i, + fin: !0, + generateMask: this._generateMask, + mask: t, + maskBuffer: this._maskBuffer, + opcode: 10, + readOnly: n, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, e, !1, o, r]) : this.sendFrame(P.frame(e, o), r); + } + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(e, t, r) { + const i = this._extensions[Ie.extensionName]; + let n = t.binary ? 2 : 1, o = t.compress, l, f; + if (typeof e == "string" ? (l = Buffer.byteLength(e), f = !1) : (e = M(e), l = e.length, f = M.readOnly), this._firstFragment ? (this._firstFragment = !1, o && i && i.params[i._isServer ? "server_no_context_takeover" : "client_no_context_takeover"] && (o = l >= i._threshold), this._compress = o) : (o = !1, n = 0), t.fin && (this._firstFragment = !0), i) { + const a = { + [x]: l, + fin: t.fin, + generateMask: this._generateMask, + mask: t.mask, + maskBuffer: this._maskBuffer, + opcode: n, + readOnly: f, + rsv1: o + }; + this._deflating ? this.enqueue([this.dispatch, e, this._compress, a, r]) : this.dispatch(e, this._compress, a, r); + } else + this.sendFrame( + P.frame(e, { + [x]: l, + fin: t.fin, + generateMask: this._generateMask, + mask: t.mask, + maskBuffer: this._maskBuffer, + opcode: n, + readOnly: f, + rsv1: !1 + }), + r + ); + } + /** + * Dispatches a message. + * + * @param {(Buffer|String)} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(e, t, r, i) { + if (!t) { + this.sendFrame(P.frame(e, r), i); + return; + } + const n = this._extensions[Ie.extensionName]; + this._bufferedBytes += r[x], this._deflating = !0, n.compress(e, r.fin, (o, l) => { + if (this._socket.destroyed) { + const f = new Error( + "The socket was closed while data was being compressed" + ); + typeof i == "function" && i(f); + for (let a = 0; a < this._queue.length; a++) { + const c = this._queue[a], h = c[c.length - 1]; + typeof h == "function" && h(f); + } + return; + } + this._bufferedBytes -= r[x], this._deflating = !1, r.readOnly = !1, this.sendFrame(P.frame(l, r), i), this.dequeue(); + }); + } + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + for (; !this._deflating && this._queue.length; ) { + const e = this._queue.shift(); + this._bufferedBytes -= e[3][x], Reflect.apply(e[0], this, e.slice(1)); + } + } + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(e) { + this._bufferedBytes += e[3][x], this._queue.push(e); + } + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(e, t) { + e.length === 2 ? (this._socket.cork(), this._socket.write(e[0]), this._socket.write(e[1], t), this._socket.uncork()) : this._socket.write(e[0], t); + } +}; +var it = Jt; +const Ks = /* @__PURE__ */ z(it), { kForOnEventAttribute: F, kListener: pe } = U, We = Symbol("kCode"), Ae = Symbol("kData"), Fe = Symbol("kError"), je = Symbol("kMessage"), Ge = Symbol("kReason"), I = Symbol("kTarget"), Ve = Symbol("kType"), He = Symbol("kWasClean"); +class B { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @throws {TypeError} If the `type` argument is not specified + */ + constructor(e) { + this[I] = null, this[Ve] = e; + } + /** + * @type {*} + */ + get target() { + return this[I]; + } + /** + * @type {String} + */ + get type() { + return this[Ve]; + } +} +Object.defineProperty(B.prototype, "target", { enumerable: !0 }); +Object.defineProperty(B.prototype, "type", { enumerable: !0 }); +class Y extends B { + /** + * Create a new `CloseEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {Number} [options.code=0] The status code explaining why the + * connection was closed + * @param {String} [options.reason=''] A human-readable string explaining why + * the connection was closed + * @param {Boolean} [options.wasClean=false] Indicates whether or not the + * connection was cleanly closed + */ + constructor(e, t = {}) { + super(e), this[We] = t.code === void 0 ? 0 : t.code, this[Ge] = t.reason === void 0 ? "" : t.reason, this[He] = t.wasClean === void 0 ? !1 : t.wasClean; + } + /** + * @type {Number} + */ + get code() { + return this[We]; + } + /** + * @type {String} + */ + get reason() { + return this[Ge]; + } + /** + * @type {Boolean} + */ + get wasClean() { + return this[He]; + } +} +Object.defineProperty(Y.prototype, "code", { enumerable: !0 }); +Object.defineProperty(Y.prototype, "reason", { enumerable: !0 }); +Object.defineProperty(Y.prototype, "wasClean", { enumerable: !0 }); +class le extends B { + /** + * Create a new `ErrorEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.error=null] The error that generated this event + * @param {String} [options.message=''] The error message + */ + constructor(e, t = {}) { + super(e), this[Fe] = t.error === void 0 ? null : t.error, this[je] = t.message === void 0 ? "" : t.message; + } + /** + * @type {*} + */ + get error() { + return this[Fe]; + } + /** + * @type {String} + */ + get message() { + return this[je]; + } +} +Object.defineProperty(le.prototype, "error", { enumerable: !0 }); +Object.defineProperty(le.prototype, "message", { enumerable: !0 }); +class xe extends B { + /** + * Create a new `MessageEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.data=null] The message content + */ + constructor(e, t = {}) { + super(e), this[Ae] = t.data === void 0 ? null : t.data; + } + /** + * @type {*} + */ + get data() { + return this[Ae]; + } +} +Object.defineProperty(xe.prototype, "data", { enumerable: !0 }); +const es = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {(Function|Object)} handler The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(s, e, t = {}) { + for (const i of this.listeners(s)) + if (!t[F] && i[pe] === e && !i[F]) + return; + let r; + if (s === "message") + r = function(n, o) { + const l = new xe("message", { + data: o ? n : n.toString() + }); + l[I] = this, Z(e, this, l); + }; + else if (s === "close") + r = function(n, o) { + const l = new Y("close", { + code: n, + reason: o.toString(), + wasClean: this._closeFrameReceived && this._closeFrameSent + }); + l[I] = this, Z(e, this, l); + }; + else if (s === "error") + r = function(n) { + const o = new le("error", { + error: n, + message: n.message + }); + o[I] = this, Z(e, this, o); + }; + else if (s === "open") + r = function() { + const n = new B("open"); + n[I] = this, Z(e, this, n); + }; + else + return; + r[F] = !!t[F], r[pe] = e, t.once ? this.once(s, r) : this.on(s, r); + }, + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {(Function|Object)} handler The listener to remove + * @public + */ + removeEventListener(s, e) { + for (const t of this.listeners(s)) + if (t[pe] === e && !t[F]) { + this.removeListener(s, t); + break; + } + } +}; +var ts = { + CloseEvent: Y, + ErrorEvent: le, + Event: B, + EventTarget: es, + MessageEvent: xe +}; +function Z(s, e, t) { + typeof s == "object" && s.handleEvent ? s.handleEvent.call(s, t) : s.call(e, t); +} +const { tokenChars: j } = ae; +function k(s, e, t) { + s[e] === void 0 ? s[e] = [t] : s[e].push(t); +} +function ss(s) { + const e = /* @__PURE__ */ Object.create(null); + let t = /* @__PURE__ */ Object.create(null), r = !1, i = !1, n = !1, o, l, f = -1, a = -1, c = -1, h = 0; + for (; h < s.length; h++) + if (a = s.charCodeAt(h), o === void 0) + if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (h !== 0 && (a === 32 || a === 9)) + c === -1 && f !== -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h); + const v = s.slice(f, c); + a === 44 ? (k(e, v, t), t = /* @__PURE__ */ Object.create(null)) : o = v, f = c = -1; + } else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (l === void 0) + if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (a === 32 || a === 9) + c === -1 && f !== -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h), k(t, s.slice(f, c), !0), a === 44 && (k(e, o, t), t = /* @__PURE__ */ Object.create(null), o = void 0), f = c = -1; + } else if (a === 61 && f !== -1 && c === -1) + l = s.slice(f, h), f = c = -1; + else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (i) { + if (j[a] !== 1) + throw new SyntaxError(`Unexpected character at index ${h}`); + f === -1 ? f = h : r || (r = !0), i = !1; + } else if (n) + if (j[a] === 1) + f === -1 && (f = h); + else if (a === 34 && f !== -1) + n = !1, c = h; + else if (a === 92) + i = !0; + else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (a === 34 && s.charCodeAt(h - 1) === 61) + n = !0; + else if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (f !== -1 && (a === 32 || a === 9)) + c === -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h); + let v = s.slice(f, c); + r && (v = v.replace(/\\/g, ""), r = !1), k(t, l, v), a === 44 && (k(e, o, t), t = /* @__PURE__ */ Object.create(null), o = void 0), l = void 0, f = c = -1; + } else + throw new SyntaxError(`Unexpected character at index ${h}`); + if (f === -1 || n || a === 32 || a === 9) + throw new SyntaxError("Unexpected end of input"); + c === -1 && (c = h); + const p = s.slice(f, c); + return o === void 0 ? k(e, p, t) : (l === void 0 ? k(t, p, !0) : r ? k(t, l, p.replace(/\\/g, "")) : k(t, l, p), k(e, o, t)), e; +} +function rs(s) { + return Object.keys(s).map((e) => { + let t = s[e]; + return Array.isArray(t) || (t = [t]), t.map((r) => [e].concat( + Object.keys(r).map((i) => { + let n = r[i]; + return Array.isArray(n) || (n = [n]), n.map((o) => o === !0 ? i : `${i}=${o}`).join("; "); + }) + ).join("; ")).join(", "); + }).join(", "); +} +var nt = { format: rs, parse: ss }; +const is = S, ns = S, os = S, ot = S, as = S, { randomBytes: ls, createHash: fs } = S, { URL: me } = S, T = oe, hs = rt, cs = it, { + BINARY_TYPES: ze, + EMPTY_BUFFER: Q, + GUID: us, + kForOnEventAttribute: ge, + kListener: ds, + kStatusCode: _s, + kWebSocket: y, + NOOP: at +} = U, { + EventTarget: { addEventListener: ps, removeEventListener: ms } +} = ts, { format: gs, parse: ys } = nt, { toBuffer: vs } = ne, Ss = 30 * 1e3, lt = Symbol("kAborted"), ye = [8, 13], O = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"], Es = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; +let m = class d extends is { + /** + * Create a new `WebSocket`. + * + * @param {(String|URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(e, t, r) { + super(), this._binaryType = ze[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = Q, this._closeTimer = null, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = d.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, e !== null ? (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, t === void 0 ? t = [] : Array.isArray(t) || (typeof t == "object" && t !== null ? (r = t, t = []) : t = [t]), ht(this, e, t, r)) : this._isServer = !0; + } + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + set binaryType(e) { + ze.includes(e) && (this._binaryType = e, this._receiver && (this._receiver._binaryType = e)); + } + /** + * @type {Number} + */ + get bufferedAmount() { + return this._socket ? this._socket._writableState.length + this._sender._bufferedBytes : this._bufferedAmount; + } + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + /** + * @type {Boolean} + */ + get isPaused() { + return this._paused; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onclose() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onerror() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onopen() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onmessage() { + return null; + } + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + /** + * @type {String} + */ + get url() { + return this._url; + } + /** + * Set up the socket and the internal resources. + * + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Object} options Options object + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.maxPayload=0] The maximum allowed message size + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ + setSocket(e, t, r) { + const i = new hs({ + binaryType: this.binaryType, + extensions: this._extensions, + isServer: this._isServer, + maxPayload: r.maxPayload, + skipUTF8Validation: r.skipUTF8Validation + }); + this._sender = new cs(e, this._extensions, r.generateMask), this._receiver = i, this._socket = e, i[y] = this, e[y] = this, i.on("conclude", ks), i.on("drain", ws), i.on("error", Os), i.on("message", Cs), i.on("ping", Ts), i.on("pong", Ls), e.setTimeout(0), e.setNoDelay(), t.length > 0 && e.unshift(t), e.on("close", ut), e.on("data", fe), e.on("end", dt), e.on("error", _t), this._readyState = d.OPEN, this.emit("open"); + } + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = d.CLOSED, this.emit("close", this._closeCode, this._closeMessage); + return; + } + this._extensions[T.extensionName] && this._extensions[T.extensionName].cleanup(), this._receiver.removeAllListeners(), this._readyState = d.CLOSED, this.emit("close", this._closeCode, this._closeMessage); + } + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {(String|Buffer)} [data] The reason why the connection is + * closing + * @public + */ + close(e, t) { + if (this.readyState !== d.CLOSED) { + if (this.readyState === d.CONNECTING) { + b(this, this._req, "WebSocket was closed before the connection was established"); + return; + } + if (this.readyState === d.CLOSING) { + this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end(); + return; + } + this._readyState = d.CLOSING, this._sender.close(e, t, !this._isServer, (r) => { + r || (this._closeFrameSent = !0, (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end()); + }), this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + Ss + ); + } + } + /** + * Pause the socket. + * + * @public + */ + pause() { + this.readyState === d.CONNECTING || this.readyState === d.CLOSED || (this._paused = !0, this._socket.pause()); + } + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof e == "function" ? (r = e, e = t = void 0) : typeof t == "function" && (r = t, t = void 0), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + t === void 0 && (t = !this._isServer), this._sender.ping(e || Q, t, r); + } + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof e == "function" ? (r = e, e = t = void 0) : typeof t == "function" && (r = t, t = void 0), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + t === void 0 && (t = !this._isServer), this._sender.pong(e || Q, t, r); + } + /** + * Resume the socket. + * + * @public + */ + resume() { + this.readyState === d.CONNECTING || this.readyState === d.CLOSED || (this._paused = !1, this._receiver._writableState.needDrain || this._socket.resume()); + } + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof t == "function" && (r = t, t = {}), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + const i = { + binary: typeof e != "string", + mask: !this._isServer, + compress: !0, + fin: !0, + ...t + }; + this._extensions[T.extensionName] || (i.compress = !1), this._sender.send(e || Q, i, r); + } + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState !== d.CLOSED) { + if (this.readyState === d.CONNECTING) { + b(this, this._req, "WebSocket was closed before the connection was established"); + return; + } + this._socket && (this._readyState = d.CLOSING, this._socket.destroy()); + } + } +}; +Object.defineProperty(m, "CONNECTING", { + enumerable: !0, + value: O.indexOf("CONNECTING") +}); +Object.defineProperty(m.prototype, "CONNECTING", { + enumerable: !0, + value: O.indexOf("CONNECTING") +}); +Object.defineProperty(m, "OPEN", { + enumerable: !0, + value: O.indexOf("OPEN") +}); +Object.defineProperty(m.prototype, "OPEN", { + enumerable: !0, + value: O.indexOf("OPEN") +}); +Object.defineProperty(m, "CLOSING", { + enumerable: !0, + value: O.indexOf("CLOSING") +}); +Object.defineProperty(m.prototype, "CLOSING", { + enumerable: !0, + value: O.indexOf("CLOSING") +}); +Object.defineProperty(m, "CLOSED", { + enumerable: !0, + value: O.indexOf("CLOSED") +}); +Object.defineProperty(m.prototype, "CLOSED", { + enumerable: !0, + value: O.indexOf("CLOSED") +}); +[ + "binaryType", + "bufferedAmount", + "extensions", + "isPaused", + "protocol", + "readyState", + "url" +].forEach((s) => { + Object.defineProperty(m.prototype, s, { enumerable: !0 }); +}); +["open", "error", "close", "message"].forEach((s) => { + Object.defineProperty(m.prototype, `on${s}`, { + enumerable: !0, + get() { + for (const e of this.listeners(s)) + if (e[ge]) + return e[ds]; + return null; + }, + set(e) { + for (const t of this.listeners(s)) + if (t[ge]) { + this.removeListener(s, t); + break; + } + typeof e == "function" && this.addEventListener(s, e, { + [ge]: !0 + }); + } + }); +}); +m.prototype.addEventListener = ps; +m.prototype.removeEventListener = ms; +var ft = m; +function ht(s, e, t, r) { + const i = { + protocolVersion: ye[1], + maxPayload: 104857600, + skipUTF8Validation: !1, + perMessageDeflate: !0, + followRedirects: !1, + maxRedirects: 10, + ...r, + createConnection: void 0, + socketPath: void 0, + hostname: void 0, + protocol: void 0, + timeout: void 0, + method: "GET", + host: void 0, + path: void 0, + port: void 0 + }; + if (!ye.includes(i.protocolVersion)) + throw new RangeError( + `Unsupported protocol version: ${i.protocolVersion} (supported versions: ${ye.join(", ")})` + ); + let n; + if (e instanceof me) + n = e, s._url = e.href; + else { + try { + n = new me(e); + } catch { + throw new SyntaxError(`Invalid URL: ${e}`); + } + s._url = e; + } + const o = n.protocol === "wss:", l = n.protocol === "ws+unix:"; + let f; + if (n.protocol !== "ws:" && !o && !l ? f = `The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"` : l && !n.pathname ? f = "The URL's pathname is empty" : n.hash && (f = "The URL contains a fragment identifier"), f) { + const u = new SyntaxError(f); + if (s._redirects === 0) + throw u; + ee(s, u); + return; + } + const a = o ? 443 : 80, c = ls(16).toString("base64"), h = o ? ns.request : os.request, p = /* @__PURE__ */ new Set(); + let v; + if (i.createConnection = o ? xs : bs, i.defaultPort = i.defaultPort || a, i.port = n.port || a, i.host = n.hostname.startsWith("[") ? n.hostname.slice(1, -1) : n.hostname, i.headers = { + ...i.headers, + "Sec-WebSocket-Version": i.protocolVersion, + "Sec-WebSocket-Key": c, + Connection: "Upgrade", + Upgrade: "websocket" + }, i.path = n.pathname + n.search, i.timeout = i.handshakeTimeout, i.perMessageDeflate && (v = new T( + i.perMessageDeflate !== !0 ? i.perMessageDeflate : {}, + !1, + i.maxPayload + ), i.headers["Sec-WebSocket-Extensions"] = gs({ + [T.extensionName]: v.offer() + })), t.length) { + for (const u of t) { + if (typeof u != "string" || !Es.test(u) || p.has(u)) + throw new SyntaxError( + "An invalid or duplicated subprotocol was specified" + ); + p.add(u); + } + i.headers["Sec-WebSocket-Protocol"] = t.join(","); + } + if (i.origin && (i.protocolVersion < 13 ? i.headers["Sec-WebSocket-Origin"] = i.origin : i.headers.Origin = i.origin), (n.username || n.password) && (i.auth = `${n.username}:${n.password}`), l) { + const u = i.path.split(":"); + i.socketPath = u[0], i.path = u[1]; + } + let _; + if (i.followRedirects) { + if (s._redirects === 0) { + s._originalIpc = l, s._originalSecure = o, s._originalHostOrSocketPath = l ? i.socketPath : n.host; + const u = r && r.headers; + if (r = { ...r, headers: {} }, u) + for (const [E, $] of Object.entries(u)) + r.headers[E.toLowerCase()] = $; + } else if (s.listenerCount("redirect") === 0) { + const u = l ? s._originalIpc ? i.socketPath === s._originalHostOrSocketPath : !1 : s._originalIpc ? !1 : n.host === s._originalHostOrSocketPath; + (!u || s._originalSecure && !o) && (delete i.headers.authorization, delete i.headers.cookie, u || delete i.headers.host, i.auth = void 0); + } + i.auth && !r.headers.authorization && (r.headers.authorization = "Basic " + Buffer.from(i.auth).toString("base64")), _ = s._req = h(i), s._redirects && s.emit("redirect", s.url, _); + } else + _ = s._req = h(i); + i.timeout && _.on("timeout", () => { + b(s, _, "Opening handshake has timed out"); + }), _.on("error", (u) => { + _ === null || _[lt] || (_ = s._req = null, ee(s, u)); + }), _.on("response", (u) => { + const E = u.headers.location, $ = u.statusCode; + if (E && i.followRedirects && $ >= 300 && $ < 400) { + if (++s._redirects > i.maxRedirects) { + b(s, _, "Maximum redirects exceeded"); + return; + } + _.abort(); + let q; + try { + q = new me(E, e); + } catch { + const L = new SyntaxError(`Invalid URL: ${E}`); + ee(s, L); + return; + } + ht(s, q, t, r); + } else + s.emit("unexpected-response", _, u) || b( + s, + _, + `Unexpected server response: ${u.statusCode}` + ); + }), _.on("upgrade", (u, E, $) => { + if (s.emit("upgrade", u), s.readyState !== m.CONNECTING) + return; + if (_ = s._req = null, u.headers.upgrade.toLowerCase() !== "websocket") { + b(s, E, "Invalid Upgrade header"); + return; + } + const q = fs("sha1").update(c + us).digest("base64"); + if (u.headers["sec-websocket-accept"] !== q) { + b(s, E, "Invalid Sec-WebSocket-Accept header"); + return; + } + const D = u.headers["sec-websocket-protocol"]; + let L; + if (D !== void 0 ? p.size ? p.has(D) || (L = "Server sent an invalid subprotocol") : L = "Server sent a subprotocol but none was requested" : p.size && (L = "Server sent no subprotocol"), L) { + b(s, E, L); + return; + } + D && (s._protocol = D); + const ke = u.headers["sec-websocket-extensions"]; + if (ke !== void 0) { + if (!v) { + b(s, E, "Server sent a Sec-WebSocket-Extensions header but no extension was requested"); + return; + } + let he; + try { + he = ys(ke); + } catch { + b(s, E, "Invalid Sec-WebSocket-Extensions header"); + return; + } + const we = Object.keys(he); + if (we.length !== 1 || we[0] !== T.extensionName) { + b(s, E, "Server indicated an extension that was not requested"); + return; + } + try { + v.accept(he[T.extensionName]); + } catch { + b(s, E, "Invalid Sec-WebSocket-Extensions header"); + return; + } + s._extensions[T.extensionName] = v; + } + s.setSocket(E, $, { + generateMask: i.generateMask, + maxPayload: i.maxPayload, + skipUTF8Validation: i.skipUTF8Validation + }); + }), i.finishRequest ? i.finishRequest(_, s) : _.end(); +} +function ee(s, e) { + s._readyState = m.CLOSING, s.emit("error", e), s.emitClose(); +} +function bs(s) { + return s.path = s.socketPath, ot.connect(s); +} +function xs(s) { + return s.path = void 0, !s.servername && s.servername !== "" && (s.servername = ot.isIP(s.host) ? "" : s.host), as.connect(s); +} +function b(s, e, t) { + s._readyState = m.CLOSING; + const r = new Error(t); + Error.captureStackTrace(r, b), e.setHeader ? (e[lt] = !0, e.abort(), e.socket && !e.socket.destroyed && e.socket.destroy(), process.nextTick(ee, s, r)) : (e.destroy(r), e.once("error", s.emit.bind(s, "error")), e.once("close", s.emitClose.bind(s))); +} +function ve(s, e, t) { + if (e) { + const r = vs(e).length; + s._socket ? s._sender._bufferedBytes += r : s._bufferedAmount += r; + } + if (t) { + const r = new Error( + `WebSocket is not open: readyState ${s.readyState} (${O[s.readyState]})` + ); + process.nextTick(t, r); + } +} +function ks(s, e) { + const t = this[y]; + t._closeFrameReceived = !0, t._closeMessage = e, t._closeCode = s, t._socket[y] !== void 0 && (t._socket.removeListener("data", fe), process.nextTick(ct, t._socket), s === 1005 ? t.close() : t.close(s, e)); +} +function ws() { + const s = this[y]; + s.isPaused || s._socket.resume(); +} +function Os(s) { + const e = this[y]; + e._socket[y] !== void 0 && (e._socket.removeListener("data", fe), process.nextTick(ct, e._socket), e.close(s[_s])), e.emit("error", s); +} +function Ye() { + this[y].emitClose(); +} +function Cs(s, e) { + this[y].emit("message", s, e); +} +function Ts(s) { + const e = this[y]; + e.pong(s, !e._isServer, at), e.emit("ping", s); +} +function Ls(s) { + this[y].emit("pong", s); +} +function ct(s) { + s.resume(); +} +function ut() { + const s = this[y]; + this.removeListener("close", ut), this.removeListener("data", fe), this.removeListener("end", dt), s._readyState = m.CLOSING; + let e; + !this._readableState.endEmitted && !s._closeFrameReceived && !s._receiver._writableState.errorEmitted && (e = s._socket.read()) !== null && s._receiver.write(e), s._receiver.end(), this[y] = void 0, clearTimeout(s._closeTimer), s._receiver._writableState.finished || s._receiver._writableState.errorEmitted ? s.emitClose() : (s._receiver.on("error", Ye), s._receiver.on("finish", Ye)); +} +function fe(s) { + this[y]._receiver.write(s) || this.pause(); +} +function dt() { + const s = this[y]; + s._readyState = m.CLOSING, s._receiver.end(), this.end(); +} +function _t() { + const s = this[y]; + this.removeListener("error", _t), this.on("error", at), s && (s._readyState = m.CLOSING, this.destroy()); +} +const Xs = /* @__PURE__ */ z(ft), { tokenChars: Ns } = ae; +function Ps(s) { + const e = /* @__PURE__ */ new Set(); + let t = -1, r = -1, i = 0; + for (i; i < s.length; i++) { + const o = s.charCodeAt(i); + if (r === -1 && Ns[o] === 1) + t === -1 && (t = i); + else if (i !== 0 && (o === 32 || o === 9)) + r === -1 && t !== -1 && (r = i); + else if (o === 44) { + if (t === -1) + throw new SyntaxError(`Unexpected character at index ${i}`); + r === -1 && (r = i); + const l = s.slice(t, r); + if (e.has(l)) + throw new SyntaxError(`The "${l}" subprotocol is duplicated`); + e.add(l), t = r = -1; + } else + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (t === -1 || r !== -1) + throw new SyntaxError("Unexpected end of input"); + const n = s.slice(t, i); + if (e.has(n)) + throw new SyntaxError(`The "${n}" subprotocol is duplicated`); + return e.add(n), e; +} +var Rs = { parse: Ps }; +const Us = S, ie = S, { createHash: Bs } = S, qe = nt, N = oe, $s = Rs, Ms = ft, { GUID: Is, kWebSocket: Ds } = U, Ws = /^[+/0-9A-Za-z]{22}==$/, Ke = 0, Xe = 1, pt = 2; +class As extends Us { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S + * server to use + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` + * class to use. It must be the `WebSocket` class or class that extends it + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(e, t) { + if (super(), e = { + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: !1, + perMessageDeflate: !1, + handleProtocols: null, + clientTracking: !0, + verifyClient: null, + noServer: !1, + backlog: null, + // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + WebSocket: Ms, + ...e + }, e.port == null && !e.server && !e.noServer || e.port != null && (e.server || e.noServer) || e.server && e.noServer) + throw new TypeError( + 'One and only one of the "port", "server", or "noServer" options must be specified' + ); + if (e.port != null ? (this._server = ie.createServer((r, i) => { + const n = ie.STATUS_CODES[426]; + i.writeHead(426, { + "Content-Length": n.length, + "Content-Type": "text/plain" + }), i.end(n); + }), this._server.listen( + e.port, + e.host, + e.backlog, + t + )) : e.server && (this._server = e.server), this._server) { + const r = this.emit.bind(this, "connection"); + this._removeListeners = js(this._server, { + listening: this.emit.bind(this, "listening"), + error: this.emit.bind(this, "error"), + upgrade: (i, n, o) => { + this.handleUpgrade(i, n, o, r); + } + }); + } + e.perMessageDeflate === !0 && (e.perMessageDeflate = {}), e.clientTracking && (this.clients = /* @__PURE__ */ new Set(), this._shouldEmitClose = !1), this.options = e, this._state = Ke; + } + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) + throw new Error('The server is operating in "noServer" mode'); + return this._server ? this._server.address() : null; + } + /** + * Stop the server from accepting new connections and emit the `'close'` event + * when all existing connections are closed. + * + * @param {Function} [cb] A one-time listener for the `'close'` event + * @public + */ + close(e) { + if (this._state === pt) { + e && this.once("close", () => { + e(new Error("The server is not running")); + }), process.nextTick(G, this); + return; + } + if (e && this.once("close", e), this._state !== Xe) + if (this._state = Xe, this.options.noServer || this.options.server) + this._server && (this._removeListeners(), this._removeListeners = this._server = null), this.clients ? this.clients.size ? this._shouldEmitClose = !0 : process.nextTick(G, this) : process.nextTick(G, this); + else { + const t = this._server; + this._removeListeners(), this._removeListeners = this._server = null, t.close(() => { + G(this); + }); + } + } + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(e) { + if (this.options.path) { + const t = e.url.indexOf("?"); + if ((t !== -1 ? e.url.slice(0, t) : e.url) !== this.options.path) + return !1; + } + return !0; + } + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(e, t, r, i) { + t.on("error", Ze); + const n = e.headers["sec-websocket-key"], o = +e.headers["sec-websocket-version"]; + if (e.method !== "GET") { + R(this, e, t, 405, "Invalid HTTP method"); + return; + } + if (e.headers.upgrade.toLowerCase() !== "websocket") { + R(this, e, t, 400, "Invalid Upgrade header"); + return; + } + if (!n || !Ws.test(n)) { + R(this, e, t, 400, "Missing or invalid Sec-WebSocket-Key header"); + return; + } + if (o !== 8 && o !== 13) { + R(this, e, t, 400, "Missing or invalid Sec-WebSocket-Version header"); + return; + } + if (!this.shouldHandle(e)) { + H(t, 400); + return; + } + const l = e.headers["sec-websocket-protocol"]; + let f = /* @__PURE__ */ new Set(); + if (l !== void 0) + try { + f = $s.parse(l); + } catch { + R(this, e, t, 400, "Invalid Sec-WebSocket-Protocol header"); + return; + } + const a = e.headers["sec-websocket-extensions"], c = {}; + if (this.options.perMessageDeflate && a !== void 0) { + const h = new N( + this.options.perMessageDeflate, + !0, + this.options.maxPayload + ); + try { + const p = qe.parse(a); + p[N.extensionName] && (h.accept(p[N.extensionName]), c[N.extensionName] = h); + } catch { + R(this, e, t, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header"); + return; + } + } + if (this.options.verifyClient) { + const h = { + origin: e.headers[`${o === 8 ? "sec-websocket-origin" : "origin"}`], + secure: !!(e.socket.authorized || e.socket.encrypted), + req: e + }; + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(h, (p, v, _, u) => { + if (!p) + return H(t, v || 401, _, u); + this.completeUpgrade( + c, + n, + f, + e, + t, + r, + i + ); + }); + return; + } + if (!this.options.verifyClient(h)) + return H(t, 401); + } + this.completeUpgrade(c, n, f, e, t, r, i); + } + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Set} protocols The subprotocols + * @param {http.IncomingMessage} req The request object + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(e, t, r, i, n, o, l) { + if (!n.readable || !n.writable) + return n.destroy(); + if (n[Ds]) + throw new Error( + "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration" + ); + if (this._state > Ke) + return H(n, 503); + const a = [ + "HTTP/1.1 101 Switching Protocols", + "Upgrade: websocket", + "Connection: Upgrade", + `Sec-WebSocket-Accept: ${Bs("sha1").update(t + Is).digest("base64")}` + ], c = new this.options.WebSocket(null); + if (r.size) { + const h = this.options.handleProtocols ? this.options.handleProtocols(r, i) : r.values().next().value; + h && (a.push(`Sec-WebSocket-Protocol: ${h}`), c._protocol = h); + } + if (e[N.extensionName]) { + const h = e[N.extensionName].params, p = qe.format({ + [N.extensionName]: [h] + }); + a.push(`Sec-WebSocket-Extensions: ${p}`), c._extensions = e; + } + this.emit("headers", a, i), n.write(a.concat(`\r +`).join(`\r +`)), n.removeListener("error", Ze), c.setSocket(n, o, { + maxPayload: this.options.maxPayload, + skipUTF8Validation: this.options.skipUTF8Validation + }), this.clients && (this.clients.add(c), c.on("close", () => { + this.clients.delete(c), this._shouldEmitClose && !this.clients.size && process.nextTick(G, this); + })), l(c, i); + } +} +var Fs = As; +function js(s, e) { + for (const t of Object.keys(e)) + s.on(t, e[t]); + return function() { + for (const r of Object.keys(e)) + s.removeListener(r, e[r]); + }; +} +function G(s) { + s._state = pt, s.emit("close"); +} +function Ze() { + this.destroy(); +} +function H(s, e, t, r) { + t = t || ie.STATUS_CODES[e], r = { + Connection: "close", + "Content-Type": "text/html", + "Content-Length": Buffer.byteLength(t), + ...r + }, s.once("finish", s.destroy), s.end( + `HTTP/1.1 ${e} ${ie.STATUS_CODES[e]}\r +` + Object.keys(r).map((i) => `${i}: ${r[i]}`).join(`\r +`) + `\r +\r +` + t + ); +} +function R(s, e, t, r, i) { + if (s.listenerCount("wsClientError")) { + const n = new Error(i); + Error.captureStackTrace(n, R), s.emit("wsClientError", n, t, e); + } else + H(t, r, i); +} +const Zs = /* @__PURE__ */ z(Fs); +export { + qs as Receiver, + Ks as Sender, + Xs as WebSocket, + Zs as WebSocketServer, + Vs as createWebSocketStream, + Xs as default +}; diff --git a/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-DjpFDl6n.js b/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-DjpFDl6n.js new file mode 100644 index 0000000000000000000000000000000000000000..d6d2e02bcbeb84bb63070d308fb6005b4c79d125 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-DjpFDl6n.js @@ -0,0 +1,2453 @@ +import S from "./__vite-browser-external-DYxpcVy9.js"; +function z(s) { + return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; +} +function gt(s) { + if (s.__esModule) + return s; + var e = s.default; + if (typeof e == "function") { + var t = function r() { + if (this instanceof r) { + var i = [null]; + i.push.apply(i, arguments); + var n = Function.bind.apply(e, i); + return new n(); + } + return e.apply(this, arguments); + }; + t.prototype = e.prototype; + } else + t = {}; + return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(s).forEach(function(r) { + var i = Object.getOwnPropertyDescriptor(s, r); + Object.defineProperty(t, r, i.get ? i : { + enumerable: !0, + get: function() { + return s[r]; + } + }); + }), t; +} +const { Duplex: yt } = S; +function Oe(s) { + s.emit("close"); +} +function vt() { + !this.destroyed && this._writableState.finished && this.destroy(); +} +function Qe(s) { + this.removeListener("error", Qe), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", s); +} +function St(s, e) { + let t = !0; + const r = new yt({ + ...e, + autoDestroy: !1, + emitClose: !1, + objectMode: !1, + writableObjectMode: !1 + }); + return s.on("message", function(n, o) { + const l = !o && r._readableState.objectMode ? n.toString() : n; + r.push(l) || s.pause(); + }), s.once("error", function(n) { + r.destroyed || (t = !1, r.destroy(n)); + }), s.once("close", function() { + r.destroyed || r.push(null); + }), r._destroy = function(i, n) { + if (s.readyState === s.CLOSED) { + n(i), process.nextTick(Oe, r); + return; + } + let o = !1; + s.once("error", function(f) { + o = !0, n(f); + }), s.once("close", function() { + o || n(i), process.nextTick(Oe, r); + }), t && s.terminate(); + }, r._final = function(i) { + if (s.readyState === s.CONNECTING) { + s.once("open", function() { + r._final(i); + }); + return; + } + s._socket !== null && (s._socket._writableState.finished ? (i(), r._readableState.endEmitted && r.destroy()) : (s._socket.once("finish", function() { + i(); + }), s.close())); + }, r._read = function() { + s.isPaused && s.resume(); + }, r._write = function(i, n, o) { + if (s.readyState === s.CONNECTING) { + s.once("open", function() { + r._write(i, n, o); + }); + return; + } + s.send(i, o); + }, r.on("end", vt), r.on("error", Qe), r; +} +var Et = St; +const Vs = /* @__PURE__ */ z(Et); +var te = { exports: {} }, U = { + BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"], + EMPTY_BUFFER: Buffer.alloc(0), + GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", + kForOnEventAttribute: Symbol("kIsForOnEventAttribute"), + kListener: Symbol("kListener"), + kStatusCode: Symbol("status-code"), + kWebSocket: Symbol("websocket"), + NOOP: () => { + } +}, bt, xt; +const { EMPTY_BUFFER: kt } = U, Se = Buffer[Symbol.species]; +function wt(s, e) { + if (s.length === 0) + return kt; + if (s.length === 1) + return s[0]; + const t = Buffer.allocUnsafe(e); + let r = 0; + for (let i = 0; i < s.length; i++) { + const n = s[i]; + t.set(n, r), r += n.length; + } + return r < e ? new Se(t.buffer, t.byteOffset, r) : t; +} +function Je(s, e, t, r, i) { + for (let n = 0; n < i; n++) + t[r + n] = s[n] ^ e[n & 3]; +} +function et(s, e) { + for (let t = 0; t < s.length; t++) + s[t] ^= e[t & 3]; +} +function Ot(s) { + return s.length === s.buffer.byteLength ? s.buffer : s.buffer.slice(s.byteOffset, s.byteOffset + s.length); +} +function Ee(s) { + if (Ee.readOnly = !0, Buffer.isBuffer(s)) + return s; + let e; + return s instanceof ArrayBuffer ? e = new Se(s) : ArrayBuffer.isView(s) ? e = new Se(s.buffer, s.byteOffset, s.byteLength) : (e = Buffer.from(s), Ee.readOnly = !1), e; +} +te.exports = { + concat: wt, + mask: Je, + toArrayBuffer: Ot, + toBuffer: Ee, + unmask: et +}; +if (!process.env.WS_NO_BUFFER_UTIL) + try { + const s = require("bufferutil"); + xt = te.exports.mask = function(e, t, r, i, n) { + n < 48 ? Je(e, t, r, i, n) : s.mask(e, t, r, i, n); + }, bt = te.exports.unmask = function(e, t) { + e.length < 32 ? et(e, t) : s.unmask(e, t); + }; + } catch { + } +var ne = te.exports; +const Ce = Symbol("kDone"), ue = Symbol("kRun"); +let Ct = class { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(e) { + this[Ce] = () => { + this.pending--, this[ue](); + }, this.concurrency = e || 1 / 0, this.jobs = [], this.pending = 0; + } + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(e) { + this.jobs.push(e), this[ue](); + } + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [ue]() { + if (this.pending !== this.concurrency && this.jobs.length) { + const e = this.jobs.shift(); + this.pending++, e(this[Ce]); + } + } +}; +var Tt = Ct; +const W = S, Te = ne, Lt = Tt, { kStatusCode: tt } = U, Nt = Buffer[Symbol.species], Pt = Buffer.from([0, 0, 255, 255]), se = Symbol("permessage-deflate"), w = Symbol("total-length"), V = Symbol("callback"), C = Symbol("buffers"), J = Symbol("error"); +let K, Rt = class { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed if context takeover is disabled + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(e, t, r) { + if (this._maxPayload = r | 0, this._options = e || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._isServer = !!t, this._deflate = null, this._inflate = null, this.params = null, !K) { + const i = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10; + K = new Lt(i); + } + } + /** + * @type {String} + */ + static get extensionName() { + return "permessage-deflate"; + } + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const e = {}; + return this._options.serverNoContextTakeover && (e.server_no_context_takeover = !0), this._options.clientNoContextTakeover && (e.client_no_context_takeover = !0), this._options.serverMaxWindowBits && (e.server_max_window_bits = this._options.serverMaxWindowBits), this._options.clientMaxWindowBits ? e.client_max_window_bits = this._options.clientMaxWindowBits : this._options.clientMaxWindowBits == null && (e.client_max_window_bits = !0), e; + } + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(e) { + return e = this.normalizeParams(e), this.params = this._isServer ? this.acceptAsServer(e) : this.acceptAsClient(e), this.params; + } + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate && (this._inflate.close(), this._inflate = null), this._deflate) { + const e = this._deflate[V]; + this._deflate.close(), this._deflate = null, e && e( + new Error( + "The deflate stream was closed while data was being processed" + ) + ); + } + } + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(e) { + const t = this._options, r = e.find((i) => !(t.serverNoContextTakeover === !1 && i.server_no_context_takeover || i.server_max_window_bits && (t.serverMaxWindowBits === !1 || typeof t.serverMaxWindowBits == "number" && t.serverMaxWindowBits > i.server_max_window_bits) || typeof t.clientMaxWindowBits == "number" && !i.client_max_window_bits)); + if (!r) + throw new Error("None of the extension offers can be accepted"); + return t.serverNoContextTakeover && (r.server_no_context_takeover = !0), t.clientNoContextTakeover && (r.client_no_context_takeover = !0), typeof t.serverMaxWindowBits == "number" && (r.server_max_window_bits = t.serverMaxWindowBits), typeof t.clientMaxWindowBits == "number" ? r.client_max_window_bits = t.clientMaxWindowBits : (r.client_max_window_bits === !0 || t.clientMaxWindowBits === !1) && delete r.client_max_window_bits, r; + } + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(e) { + const t = e[0]; + if (this._options.clientNoContextTakeover === !1 && t.client_no_context_takeover) + throw new Error('Unexpected parameter "client_no_context_takeover"'); + if (!t.client_max_window_bits) + typeof this._options.clientMaxWindowBits == "number" && (t.client_max_window_bits = this._options.clientMaxWindowBits); + else if (this._options.clientMaxWindowBits === !1 || typeof this._options.clientMaxWindowBits == "number" && t.client_max_window_bits > this._options.clientMaxWindowBits) + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + return t; + } + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(e) { + return e.forEach((t) => { + Object.keys(t).forEach((r) => { + let i = t[r]; + if (i.length > 1) + throw new Error(`Parameter "${r}" must have only a single value`); + if (i = i[0], r === "client_max_window_bits") { + if (i !== !0) { + const n = +i; + if (!Number.isInteger(n) || n < 8 || n > 15) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + i = n; + } else if (!this._isServer) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + } else if (r === "server_max_window_bits") { + const n = +i; + if (!Number.isInteger(n) || n < 8 || n > 15) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + i = n; + } else if (r === "client_no_context_takeover" || r === "server_no_context_takeover") { + if (i !== !0) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + } else + throw new Error(`Unknown parameter "${r}"`); + t[r] = i; + }); + }), e; + } + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(e, t, r) { + K.add((i) => { + this._decompress(e, t, (n, o) => { + i(), r(n, o); + }); + }); + } + /** + * Compress data. Concurrency limited. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(e, t, r) { + K.add((i) => { + this._compress(e, t, (n, o) => { + i(), r(n, o); + }); + }); + } + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(e, t, r) { + const i = this._isServer ? "client" : "server"; + if (!this._inflate) { + const n = `${i}_max_window_bits`, o = typeof this.params[n] != "number" ? W.Z_DEFAULT_WINDOWBITS : this.params[n]; + this._inflate = W.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits: o + }), this._inflate[se] = this, this._inflate[w] = 0, this._inflate[C] = [], this._inflate.on("error", Bt), this._inflate.on("data", st); + } + this._inflate[V] = r, this._inflate.write(e), t && this._inflate.write(Pt), this._inflate.flush(() => { + const n = this._inflate[J]; + if (n) { + this._inflate.close(), this._inflate = null, r(n); + return; + } + const o = Te.concat( + this._inflate[C], + this._inflate[w] + ); + this._inflate._readableState.endEmitted ? (this._inflate.close(), this._inflate = null) : (this._inflate[w] = 0, this._inflate[C] = [], t && this.params[`${i}_no_context_takeover`] && this._inflate.reset()), r(null, o); + }); + } + /** + * Compress data. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(e, t, r) { + const i = this._isServer ? "server" : "client"; + if (!this._deflate) { + const n = `${i}_max_window_bits`, o = typeof this.params[n] != "number" ? W.Z_DEFAULT_WINDOWBITS : this.params[n]; + this._deflate = W.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits: o + }), this._deflate[w] = 0, this._deflate[C] = [], this._deflate.on("data", Ut); + } + this._deflate[V] = r, this._deflate.write(e), this._deflate.flush(W.Z_SYNC_FLUSH, () => { + if (!this._deflate) + return; + let n = Te.concat( + this._deflate[C], + this._deflate[w] + ); + t && (n = new Nt(n.buffer, n.byteOffset, n.length - 4)), this._deflate[V] = null, this._deflate[w] = 0, this._deflate[C] = [], t && this.params[`${i}_no_context_takeover`] && this._deflate.reset(), r(null, n); + }); + } +}; +var oe = Rt; +function Ut(s) { + this[C].push(s), this[w] += s.length; +} +function st(s) { + if (this[w] += s.length, this[se]._maxPayload < 1 || this[w] <= this[se]._maxPayload) { + this[C].push(s); + return; + } + this[J] = new RangeError("Max payload size exceeded"), this[J].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[J][tt] = 1009, this.removeListener("data", st), this.reset(); +} +function Bt(s) { + this[se]._inflate = null, s[tt] = 1007, this[V](s); +} +var re = { exports: {} }; +const $t = {}, Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: $t +}, Symbol.toStringTag, { value: "Module" })), It = /* @__PURE__ */ gt(Mt); +var Le; +const { isUtf8: Ne } = S, Dt = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 0 - 15 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 16 - 31 + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + // 32 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + // 48 - 63 + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 64 - 79 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + // 80 - 95 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 96 - 111 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0 + // 112 - 127 +]; +function Wt(s) { + return s >= 1e3 && s <= 1014 && s !== 1004 && s !== 1005 && s !== 1006 || s >= 3e3 && s <= 4999; +} +function be(s) { + const e = s.length; + let t = 0; + for (; t < e; ) + if (!(s[t] & 128)) + t++; + else if ((s[t] & 224) === 192) { + if (t + 1 === e || (s[t + 1] & 192) !== 128 || (s[t] & 254) === 192) + return !1; + t += 2; + } else if ((s[t] & 240) === 224) { + if (t + 2 >= e || (s[t + 1] & 192) !== 128 || (s[t + 2] & 192) !== 128 || s[t] === 224 && (s[t + 1] & 224) === 128 || // Overlong + s[t] === 237 && (s[t + 1] & 224) === 160) + return !1; + t += 3; + } else if ((s[t] & 248) === 240) { + if (t + 3 >= e || (s[t + 1] & 192) !== 128 || (s[t + 2] & 192) !== 128 || (s[t + 3] & 192) !== 128 || s[t] === 240 && (s[t + 1] & 240) === 128 || // Overlong + s[t] === 244 && s[t + 1] > 143 || s[t] > 244) + return !1; + t += 4; + } else + return !1; + return !0; +} +re.exports = { + isValidStatusCode: Wt, + isValidUTF8: be, + tokenChars: Dt +}; +if (Ne) + Le = re.exports.isValidUTF8 = function(s) { + return s.length < 24 ? be(s) : Ne(s); + }; +else if (!process.env.WS_NO_UTF_8_VALIDATE) + try { + const s = It; + Le = re.exports.isValidUTF8 = function(e) { + return e.length < 32 ? be(e) : s(e); + }; + } catch { + } +var ae = re.exports; +const { Writable: At } = S, Pe = oe, { + BINARY_TYPES: Ft, + EMPTY_BUFFER: Re, + kStatusCode: jt, + kWebSocket: Gt +} = U, { concat: de, toArrayBuffer: Vt, unmask: Ht } = ne, { isValidStatusCode: zt, isValidUTF8: Ue } = ae, X = Buffer[Symbol.species], A = 0, Be = 1, $e = 2, Me = 3, _e = 4, Yt = 5; +let qt = class extends At { + /** + * Creates a Receiver instance. + * + * @param {Object} [options] Options object + * @param {String} [options.binaryType=nodebuffer] The type for binary data + * @param {Object} [options.extensions] An object containing the negotiated + * extensions + * @param {Boolean} [options.isServer=false] Specifies whether to operate in + * client or server mode + * @param {Number} [options.maxPayload=0] The maximum allowed message length + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + */ + constructor(e = {}) { + super(), this._binaryType = e.binaryType || Ft[0], this._extensions = e.extensions || {}, this._isServer = !!e.isServer, this._maxPayload = e.maxPayload | 0, this._skipUTF8Validation = !!e.skipUTF8Validation, this[Gt] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._state = A, this._loop = !1; + } + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(e, t, r) { + if (this._opcode === 8 && this._state == A) + return r(); + this._bufferedBytes += e.length, this._buffers.push(e), this.startLoop(r); + } + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(e) { + if (this._bufferedBytes -= e, e === this._buffers[0].length) + return this._buffers.shift(); + if (e < this._buffers[0].length) { + const r = this._buffers[0]; + return this._buffers[0] = new X( + r.buffer, + r.byteOffset + e, + r.length - e + ), new X(r.buffer, r.byteOffset, e); + } + const t = Buffer.allocUnsafe(e); + do { + const r = this._buffers[0], i = t.length - e; + e >= r.length ? t.set(this._buffers.shift(), i) : (t.set(new Uint8Array(r.buffer, r.byteOffset, e), i), this._buffers[0] = new X( + r.buffer, + r.byteOffset + e, + r.length - e + )), e -= r.length; + } while (e > 0); + return t; + } + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(e) { + let t; + this._loop = !0; + do + switch (this._state) { + case A: + t = this.getInfo(); + break; + case Be: + t = this.getPayloadLength16(); + break; + case $e: + t = this.getPayloadLength64(); + break; + case Me: + this.getMask(); + break; + case _e: + t = this.getData(e); + break; + default: + this._loop = !1; + return; + } + while (this._loop); + e(t); + } + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = !1; + return; + } + const e = this.consume(2); + if (e[0] & 48) + return this._loop = !1, g( + RangeError, + "RSV2 and RSV3 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_2_3" + ); + const t = (e[0] & 64) === 64; + if (t && !this._extensions[Pe.extensionName]) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (this._fin = (e[0] & 128) === 128, this._opcode = e[0] & 15, this._payloadLength = e[1] & 127, this._opcode === 0) { + if (t) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (!this._fragmented) + return this._loop = !1, g( + RangeError, + "invalid opcode 0", + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + this._opcode = this._fragmented; + } else if (this._opcode === 1 || this._opcode === 2) { + if (this._fragmented) + return this._loop = !1, g( + RangeError, + `invalid opcode ${this._opcode}`, + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + this._compressed = t; + } else if (this._opcode > 7 && this._opcode < 11) { + if (!this._fin) + return this._loop = !1, g( + RangeError, + "FIN must be set", + !0, + 1002, + "WS_ERR_EXPECTED_FIN" + ); + if (t) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) + return this._loop = !1, g( + RangeError, + `invalid payload length ${this._payloadLength}`, + !0, + 1002, + "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH" + ); + } else + return this._loop = !1, g( + RangeError, + `invalid opcode ${this._opcode}`, + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (e[1] & 128) === 128, this._isServer) { + if (!this._masked) + return this._loop = !1, g( + RangeError, + "MASK must be set", + !0, + 1002, + "WS_ERR_EXPECTED_MASK" + ); + } else if (this._masked) + return this._loop = !1, g( + RangeError, + "MASK must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_MASK" + ); + if (this._payloadLength === 126) + this._state = Be; + else if (this._payloadLength === 127) + this._state = $e; + else + return this.haveLength(); + } + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = !1; + return; + } + return this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(); + } + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = !1; + return; + } + const e = this.consume(8), t = e.readUInt32BE(0); + return t > Math.pow(2, 21) - 1 ? (this._loop = !1, g( + RangeError, + "Unsupported WebSocket frame: payload length > 2^53 - 1", + !1, + 1009, + "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH" + )) : (this._payloadLength = t * Math.pow(2, 32) + e.readUInt32BE(4), this.haveLength()); + } + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0)) + return this._loop = !1, g( + RangeError, + "Max payload size exceeded", + !1, + 1009, + "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" + ); + this._masked ? this._state = Me : this._state = _e; + } + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = !1; + return; + } + this._mask = this.consume(4), this._state = _e; + } + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(e) { + let t = Re; + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = !1; + return; + } + t = this.consume(this._payloadLength), this._masked && this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3] && Ht(t, this._mask); + } + if (this._opcode > 7) + return this.controlMessage(t); + if (this._compressed) { + this._state = Yt, this.decompress(t, e); + return; + } + return t.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(t)), this.dataMessage(); + } + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(e, t) { + this._extensions[Pe.extensionName].decompress(e, this._fin, (i, n) => { + if (i) + return t(i); + if (n.length) { + if (this._messageLength += n.length, this._messageLength > this._maxPayload && this._maxPayload > 0) + return t( + g( + RangeError, + "Max payload size exceeded", + !1, + 1009, + "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" + ) + ); + this._fragments.push(n); + } + const o = this.dataMessage(); + if (o) + return t(o); + this.startLoop(t); + }); + } + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const e = this._messageLength, t = this._fragments; + if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], this._opcode === 2) { + let r; + this._binaryType === "nodebuffer" ? r = de(t, e) : this._binaryType === "arraybuffer" ? r = Vt(de(t, e)) : r = t, this.emit("message", r, !0); + } else { + const r = de(t, e); + if (!this._skipUTF8Validation && !Ue(r)) + return this._loop = !1, g( + Error, + "invalid UTF-8 sequence", + !0, + 1007, + "WS_ERR_INVALID_UTF8" + ); + this.emit("message", r, !1); + } + } + this._state = A; + } + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(e) { + if (this._opcode === 8) + if (this._loop = !1, e.length === 0) + this.emit("conclude", 1005, Re), this.end(); + else { + const t = e.readUInt16BE(0); + if (!zt(t)) + return g( + RangeError, + `invalid status code ${t}`, + !0, + 1002, + "WS_ERR_INVALID_CLOSE_CODE" + ); + const r = new X( + e.buffer, + e.byteOffset + 2, + e.length - 2 + ); + if (!this._skipUTF8Validation && !Ue(r)) + return g( + Error, + "invalid UTF-8 sequence", + !0, + 1007, + "WS_ERR_INVALID_UTF8" + ); + this.emit("conclude", t, r), this.end(); + } + else + this._opcode === 9 ? this.emit("ping", e) : this.emit("pong", e); + this._state = A; + } +}; +var rt = qt; +function g(s, e, t, r, i) { + const n = new s( + t ? `Invalid WebSocket frame: ${e}` : e + ); + return Error.captureStackTrace(n, g), n.code = i, n[jt] = r, n; +} +const qs = /* @__PURE__ */ z(rt), { randomFillSync: Kt } = S, Ie = oe, { EMPTY_BUFFER: Xt } = U, { isValidStatusCode: Zt } = ae, { mask: De, toBuffer: M } = ne, x = Symbol("kByteLength"), Qt = Buffer.alloc(4); +let Jt = class P { + /** + * Creates a Sender instance. + * + * @param {(net.Socket|tls.Socket)} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Function} [generateMask] The function used to generate the masking + * key + */ + constructor(e, t, r) { + this._extensions = t || {}, r && (this._generateMask = r, this._maskBuffer = Buffer.alloc(4)), this._socket = e, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this._deflating = !1, this._queue = []; + } + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {(Buffer|String)} data The data to frame + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {(Buffer|String)[]} The framed data + * @public + */ + static frame(e, t) { + let r, i = !1, n = 2, o = !1; + t.mask && (r = t.maskBuffer || Qt, t.generateMask ? t.generateMask(r) : Kt(r, 0, 4), o = (r[0] | r[1] | r[2] | r[3]) === 0, n = 6); + let l; + typeof e == "string" ? (!t.mask || o) && t[x] !== void 0 ? l = t[x] : (e = Buffer.from(e), l = e.length) : (l = e.length, i = t.mask && t.readOnly && !o); + let f = l; + l >= 65536 ? (n += 8, f = 127) : l > 125 && (n += 2, f = 126); + const a = Buffer.allocUnsafe(i ? l + n : n); + return a[0] = t.fin ? t.opcode | 128 : t.opcode, t.rsv1 && (a[0] |= 64), a[1] = f, f === 126 ? a.writeUInt16BE(l, 2) : f === 127 && (a[2] = a[3] = 0, a.writeUIntBE(l, 4, 6)), t.mask ? (a[1] |= 128, a[n - 4] = r[0], a[n - 3] = r[1], a[n - 2] = r[2], a[n - 1] = r[3], o ? [a, e] : i ? (De(e, r, a, n, l), [a]) : (De(e, r, e, 0, l), [a, e])) : [a, e]; + } + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {(String|Buffer)} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(e, t, r, i) { + let n; + if (e === void 0) + n = Xt; + else { + if (typeof e != "number" || !Zt(e)) + throw new TypeError("First argument must be a valid error code number"); + if (t === void 0 || !t.length) + n = Buffer.allocUnsafe(2), n.writeUInt16BE(e, 0); + else { + const l = Buffer.byteLength(t); + if (l > 123) + throw new RangeError("The message must not be greater than 123 bytes"); + n = Buffer.allocUnsafe(2 + l), n.writeUInt16BE(e, 0), typeof t == "string" ? n.write(t, 2) : n.set(t, 2); + } + } + const o = { + [x]: n.length, + fin: !0, + generateMask: this._generateMask, + mask: r, + maskBuffer: this._maskBuffer, + opcode: 8, + readOnly: !1, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, n, !1, o, i]) : this.sendFrame(P.frame(n, o), i); + } + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(e, t, r) { + let i, n; + if (typeof e == "string" ? (i = Buffer.byteLength(e), n = !1) : (e = M(e), i = e.length, n = M.readOnly), i > 125) + throw new RangeError("The data size must not be greater than 125 bytes"); + const o = { + [x]: i, + fin: !0, + generateMask: this._generateMask, + mask: t, + maskBuffer: this._maskBuffer, + opcode: 9, + readOnly: n, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, e, !1, o, r]) : this.sendFrame(P.frame(e, o), r); + } + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(e, t, r) { + let i, n; + if (typeof e == "string" ? (i = Buffer.byteLength(e), n = !1) : (e = M(e), i = e.length, n = M.readOnly), i > 125) + throw new RangeError("The data size must not be greater than 125 bytes"); + const o = { + [x]: i, + fin: !0, + generateMask: this._generateMask, + mask: t, + maskBuffer: this._maskBuffer, + opcode: 10, + readOnly: n, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, e, !1, o, r]) : this.sendFrame(P.frame(e, o), r); + } + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(e, t, r) { + const i = this._extensions[Ie.extensionName]; + let n = t.binary ? 2 : 1, o = t.compress, l, f; + if (typeof e == "string" ? (l = Buffer.byteLength(e), f = !1) : (e = M(e), l = e.length, f = M.readOnly), this._firstFragment ? (this._firstFragment = !1, o && i && i.params[i._isServer ? "server_no_context_takeover" : "client_no_context_takeover"] && (o = l >= i._threshold), this._compress = o) : (o = !1, n = 0), t.fin && (this._firstFragment = !0), i) { + const a = { + [x]: l, + fin: t.fin, + generateMask: this._generateMask, + mask: t.mask, + maskBuffer: this._maskBuffer, + opcode: n, + readOnly: f, + rsv1: o + }; + this._deflating ? this.enqueue([this.dispatch, e, this._compress, a, r]) : this.dispatch(e, this._compress, a, r); + } else + this.sendFrame( + P.frame(e, { + [x]: l, + fin: t.fin, + generateMask: this._generateMask, + mask: t.mask, + maskBuffer: this._maskBuffer, + opcode: n, + readOnly: f, + rsv1: !1 + }), + r + ); + } + /** + * Dispatches a message. + * + * @param {(Buffer|String)} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(e, t, r, i) { + if (!t) { + this.sendFrame(P.frame(e, r), i); + return; + } + const n = this._extensions[Ie.extensionName]; + this._bufferedBytes += r[x], this._deflating = !0, n.compress(e, r.fin, (o, l) => { + if (this._socket.destroyed) { + const f = new Error( + "The socket was closed while data was being compressed" + ); + typeof i == "function" && i(f); + for (let a = 0; a < this._queue.length; a++) { + const c = this._queue[a], h = c[c.length - 1]; + typeof h == "function" && h(f); + } + return; + } + this._bufferedBytes -= r[x], this._deflating = !1, r.readOnly = !1, this.sendFrame(P.frame(l, r), i), this.dequeue(); + }); + } + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + for (; !this._deflating && this._queue.length; ) { + const e = this._queue.shift(); + this._bufferedBytes -= e[3][x], Reflect.apply(e[0], this, e.slice(1)); + } + } + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(e) { + this._bufferedBytes += e[3][x], this._queue.push(e); + } + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(e, t) { + e.length === 2 ? (this._socket.cork(), this._socket.write(e[0]), this._socket.write(e[1], t), this._socket.uncork()) : this._socket.write(e[0], t); + } +}; +var it = Jt; +const Ks = /* @__PURE__ */ z(it), { kForOnEventAttribute: F, kListener: pe } = U, We = Symbol("kCode"), Ae = Symbol("kData"), Fe = Symbol("kError"), je = Symbol("kMessage"), Ge = Symbol("kReason"), I = Symbol("kTarget"), Ve = Symbol("kType"), He = Symbol("kWasClean"); +class B { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @throws {TypeError} If the `type` argument is not specified + */ + constructor(e) { + this[I] = null, this[Ve] = e; + } + /** + * @type {*} + */ + get target() { + return this[I]; + } + /** + * @type {String} + */ + get type() { + return this[Ve]; + } +} +Object.defineProperty(B.prototype, "target", { enumerable: !0 }); +Object.defineProperty(B.prototype, "type", { enumerable: !0 }); +class Y extends B { + /** + * Create a new `CloseEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {Number} [options.code=0] The status code explaining why the + * connection was closed + * @param {String} [options.reason=''] A human-readable string explaining why + * the connection was closed + * @param {Boolean} [options.wasClean=false] Indicates whether or not the + * connection was cleanly closed + */ + constructor(e, t = {}) { + super(e), this[We] = t.code === void 0 ? 0 : t.code, this[Ge] = t.reason === void 0 ? "" : t.reason, this[He] = t.wasClean === void 0 ? !1 : t.wasClean; + } + /** + * @type {Number} + */ + get code() { + return this[We]; + } + /** + * @type {String} + */ + get reason() { + return this[Ge]; + } + /** + * @type {Boolean} + */ + get wasClean() { + return this[He]; + } +} +Object.defineProperty(Y.prototype, "code", { enumerable: !0 }); +Object.defineProperty(Y.prototype, "reason", { enumerable: !0 }); +Object.defineProperty(Y.prototype, "wasClean", { enumerable: !0 }); +class le extends B { + /** + * Create a new `ErrorEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.error=null] The error that generated this event + * @param {String} [options.message=''] The error message + */ + constructor(e, t = {}) { + super(e), this[Fe] = t.error === void 0 ? null : t.error, this[je] = t.message === void 0 ? "" : t.message; + } + /** + * @type {*} + */ + get error() { + return this[Fe]; + } + /** + * @type {String} + */ + get message() { + return this[je]; + } +} +Object.defineProperty(le.prototype, "error", { enumerable: !0 }); +Object.defineProperty(le.prototype, "message", { enumerable: !0 }); +class xe extends B { + /** + * Create a new `MessageEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.data=null] The message content + */ + constructor(e, t = {}) { + super(e), this[Ae] = t.data === void 0 ? null : t.data; + } + /** + * @type {*} + */ + get data() { + return this[Ae]; + } +} +Object.defineProperty(xe.prototype, "data", { enumerable: !0 }); +const es = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {(Function|Object)} handler The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(s, e, t = {}) { + for (const i of this.listeners(s)) + if (!t[F] && i[pe] === e && !i[F]) + return; + let r; + if (s === "message") + r = function(n, o) { + const l = new xe("message", { + data: o ? n : n.toString() + }); + l[I] = this, Z(e, this, l); + }; + else if (s === "close") + r = function(n, o) { + const l = new Y("close", { + code: n, + reason: o.toString(), + wasClean: this._closeFrameReceived && this._closeFrameSent + }); + l[I] = this, Z(e, this, l); + }; + else if (s === "error") + r = function(n) { + const o = new le("error", { + error: n, + message: n.message + }); + o[I] = this, Z(e, this, o); + }; + else if (s === "open") + r = function() { + const n = new B("open"); + n[I] = this, Z(e, this, n); + }; + else + return; + r[F] = !!t[F], r[pe] = e, t.once ? this.once(s, r) : this.on(s, r); + }, + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {(Function|Object)} handler The listener to remove + * @public + */ + removeEventListener(s, e) { + for (const t of this.listeners(s)) + if (t[pe] === e && !t[F]) { + this.removeListener(s, t); + break; + } + } +}; +var ts = { + CloseEvent: Y, + ErrorEvent: le, + Event: B, + EventTarget: es, + MessageEvent: xe +}; +function Z(s, e, t) { + typeof s == "object" && s.handleEvent ? s.handleEvent.call(s, t) : s.call(e, t); +} +const { tokenChars: j } = ae; +function k(s, e, t) { + s[e] === void 0 ? s[e] = [t] : s[e].push(t); +} +function ss(s) { + const e = /* @__PURE__ */ Object.create(null); + let t = /* @__PURE__ */ Object.create(null), r = !1, i = !1, n = !1, o, l, f = -1, a = -1, c = -1, h = 0; + for (; h < s.length; h++) + if (a = s.charCodeAt(h), o === void 0) + if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (h !== 0 && (a === 32 || a === 9)) + c === -1 && f !== -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h); + const v = s.slice(f, c); + a === 44 ? (k(e, v, t), t = /* @__PURE__ */ Object.create(null)) : o = v, f = c = -1; + } else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (l === void 0) + if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (a === 32 || a === 9) + c === -1 && f !== -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h), k(t, s.slice(f, c), !0), a === 44 && (k(e, o, t), t = /* @__PURE__ */ Object.create(null), o = void 0), f = c = -1; + } else if (a === 61 && f !== -1 && c === -1) + l = s.slice(f, h), f = c = -1; + else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (i) { + if (j[a] !== 1) + throw new SyntaxError(`Unexpected character at index ${h}`); + f === -1 ? f = h : r || (r = !0), i = !1; + } else if (n) + if (j[a] === 1) + f === -1 && (f = h); + else if (a === 34 && f !== -1) + n = !1, c = h; + else if (a === 92) + i = !0; + else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (a === 34 && s.charCodeAt(h - 1) === 61) + n = !0; + else if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (f !== -1 && (a === 32 || a === 9)) + c === -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h); + let v = s.slice(f, c); + r && (v = v.replace(/\\/g, ""), r = !1), k(t, l, v), a === 44 && (k(e, o, t), t = /* @__PURE__ */ Object.create(null), o = void 0), l = void 0, f = c = -1; + } else + throw new SyntaxError(`Unexpected character at index ${h}`); + if (f === -1 || n || a === 32 || a === 9) + throw new SyntaxError("Unexpected end of input"); + c === -1 && (c = h); + const p = s.slice(f, c); + return o === void 0 ? k(e, p, t) : (l === void 0 ? k(t, p, !0) : r ? k(t, l, p.replace(/\\/g, "")) : k(t, l, p), k(e, o, t)), e; +} +function rs(s) { + return Object.keys(s).map((e) => { + let t = s[e]; + return Array.isArray(t) || (t = [t]), t.map((r) => [e].concat( + Object.keys(r).map((i) => { + let n = r[i]; + return Array.isArray(n) || (n = [n]), n.map((o) => o === !0 ? i : `${i}=${o}`).join("; "); + }) + ).join("; ")).join(", "); + }).join(", "); +} +var nt = { format: rs, parse: ss }; +const is = S, ns = S, os = S, ot = S, as = S, { randomBytes: ls, createHash: fs } = S, { URL: me } = S, T = oe, hs = rt, cs = it, { + BINARY_TYPES: ze, + EMPTY_BUFFER: Q, + GUID: us, + kForOnEventAttribute: ge, + kListener: ds, + kStatusCode: _s, + kWebSocket: y, + NOOP: at +} = U, { + EventTarget: { addEventListener: ps, removeEventListener: ms } +} = ts, { format: gs, parse: ys } = nt, { toBuffer: vs } = ne, Ss = 30 * 1e3, lt = Symbol("kAborted"), ye = [8, 13], O = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"], Es = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; +let m = class d extends is { + /** + * Create a new `WebSocket`. + * + * @param {(String|URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(e, t, r) { + super(), this._binaryType = ze[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = Q, this._closeTimer = null, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = d.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, e !== null ? (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, t === void 0 ? t = [] : Array.isArray(t) || (typeof t == "object" && t !== null ? (r = t, t = []) : t = [t]), ht(this, e, t, r)) : this._isServer = !0; + } + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + set binaryType(e) { + ze.includes(e) && (this._binaryType = e, this._receiver && (this._receiver._binaryType = e)); + } + /** + * @type {Number} + */ + get bufferedAmount() { + return this._socket ? this._socket._writableState.length + this._sender._bufferedBytes : this._bufferedAmount; + } + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + /** + * @type {Boolean} + */ + get isPaused() { + return this._paused; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onclose() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onerror() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onopen() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onmessage() { + return null; + } + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + /** + * @type {String} + */ + get url() { + return this._url; + } + /** + * Set up the socket and the internal resources. + * + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Object} options Options object + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.maxPayload=0] The maximum allowed message size + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ + setSocket(e, t, r) { + const i = new hs({ + binaryType: this.binaryType, + extensions: this._extensions, + isServer: this._isServer, + maxPayload: r.maxPayload, + skipUTF8Validation: r.skipUTF8Validation + }); + this._sender = new cs(e, this._extensions, r.generateMask), this._receiver = i, this._socket = e, i[y] = this, e[y] = this, i.on("conclude", ks), i.on("drain", ws), i.on("error", Os), i.on("message", Cs), i.on("ping", Ts), i.on("pong", Ls), e.setTimeout(0), e.setNoDelay(), t.length > 0 && e.unshift(t), e.on("close", ut), e.on("data", fe), e.on("end", dt), e.on("error", _t), this._readyState = d.OPEN, this.emit("open"); + } + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = d.CLOSED, this.emit("close", this._closeCode, this._closeMessage); + return; + } + this._extensions[T.extensionName] && this._extensions[T.extensionName].cleanup(), this._receiver.removeAllListeners(), this._readyState = d.CLOSED, this.emit("close", this._closeCode, this._closeMessage); + } + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {(String|Buffer)} [data] The reason why the connection is + * closing + * @public + */ + close(e, t) { + if (this.readyState !== d.CLOSED) { + if (this.readyState === d.CONNECTING) { + b(this, this._req, "WebSocket was closed before the connection was established"); + return; + } + if (this.readyState === d.CLOSING) { + this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end(); + return; + } + this._readyState = d.CLOSING, this._sender.close(e, t, !this._isServer, (r) => { + r || (this._closeFrameSent = !0, (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end()); + }), this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + Ss + ); + } + } + /** + * Pause the socket. + * + * @public + */ + pause() { + this.readyState === d.CONNECTING || this.readyState === d.CLOSED || (this._paused = !0, this._socket.pause()); + } + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof e == "function" ? (r = e, e = t = void 0) : typeof t == "function" && (r = t, t = void 0), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + t === void 0 && (t = !this._isServer), this._sender.ping(e || Q, t, r); + } + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof e == "function" ? (r = e, e = t = void 0) : typeof t == "function" && (r = t, t = void 0), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + t === void 0 && (t = !this._isServer), this._sender.pong(e || Q, t, r); + } + /** + * Resume the socket. + * + * @public + */ + resume() { + this.readyState === d.CONNECTING || this.readyState === d.CLOSED || (this._paused = !1, this._receiver._writableState.needDrain || this._socket.resume()); + } + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof t == "function" && (r = t, t = {}), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + const i = { + binary: typeof e != "string", + mask: !this._isServer, + compress: !0, + fin: !0, + ...t + }; + this._extensions[T.extensionName] || (i.compress = !1), this._sender.send(e || Q, i, r); + } + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState !== d.CLOSED) { + if (this.readyState === d.CONNECTING) { + b(this, this._req, "WebSocket was closed before the connection was established"); + return; + } + this._socket && (this._readyState = d.CLOSING, this._socket.destroy()); + } + } +}; +Object.defineProperty(m, "CONNECTING", { + enumerable: !0, + value: O.indexOf("CONNECTING") +}); +Object.defineProperty(m.prototype, "CONNECTING", { + enumerable: !0, + value: O.indexOf("CONNECTING") +}); +Object.defineProperty(m, "OPEN", { + enumerable: !0, + value: O.indexOf("OPEN") +}); +Object.defineProperty(m.prototype, "OPEN", { + enumerable: !0, + value: O.indexOf("OPEN") +}); +Object.defineProperty(m, "CLOSING", { + enumerable: !0, + value: O.indexOf("CLOSING") +}); +Object.defineProperty(m.prototype, "CLOSING", { + enumerable: !0, + value: O.indexOf("CLOSING") +}); +Object.defineProperty(m, "CLOSED", { + enumerable: !0, + value: O.indexOf("CLOSED") +}); +Object.defineProperty(m.prototype, "CLOSED", { + enumerable: !0, + value: O.indexOf("CLOSED") +}); +[ + "binaryType", + "bufferedAmount", + "extensions", + "isPaused", + "protocol", + "readyState", + "url" +].forEach((s) => { + Object.defineProperty(m.prototype, s, { enumerable: !0 }); +}); +["open", "error", "close", "message"].forEach((s) => { + Object.defineProperty(m.prototype, `on${s}`, { + enumerable: !0, + get() { + for (const e of this.listeners(s)) + if (e[ge]) + return e[ds]; + return null; + }, + set(e) { + for (const t of this.listeners(s)) + if (t[ge]) { + this.removeListener(s, t); + break; + } + typeof e == "function" && this.addEventListener(s, e, { + [ge]: !0 + }); + } + }); +}); +m.prototype.addEventListener = ps; +m.prototype.removeEventListener = ms; +var ft = m; +function ht(s, e, t, r) { + const i = { + protocolVersion: ye[1], + maxPayload: 104857600, + skipUTF8Validation: !1, + perMessageDeflate: !0, + followRedirects: !1, + maxRedirects: 10, + ...r, + createConnection: void 0, + socketPath: void 0, + hostname: void 0, + protocol: void 0, + timeout: void 0, + method: "GET", + host: void 0, + path: void 0, + port: void 0 + }; + if (!ye.includes(i.protocolVersion)) + throw new RangeError( + `Unsupported protocol version: ${i.protocolVersion} (supported versions: ${ye.join(", ")})` + ); + let n; + if (e instanceof me) + n = e, s._url = e.href; + else { + try { + n = new me(e); + } catch { + throw new SyntaxError(`Invalid URL: ${e}`); + } + s._url = e; + } + const o = n.protocol === "wss:", l = n.protocol === "ws+unix:"; + let f; + if (n.protocol !== "ws:" && !o && !l ? f = `The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"` : l && !n.pathname ? f = "The URL's pathname is empty" : n.hash && (f = "The URL contains a fragment identifier"), f) { + const u = new SyntaxError(f); + if (s._redirects === 0) + throw u; + ee(s, u); + return; + } + const a = o ? 443 : 80, c = ls(16).toString("base64"), h = o ? ns.request : os.request, p = /* @__PURE__ */ new Set(); + let v; + if (i.createConnection = o ? xs : bs, i.defaultPort = i.defaultPort || a, i.port = n.port || a, i.host = n.hostname.startsWith("[") ? n.hostname.slice(1, -1) : n.hostname, i.headers = { + ...i.headers, + "Sec-WebSocket-Version": i.protocolVersion, + "Sec-WebSocket-Key": c, + Connection: "Upgrade", + Upgrade: "websocket" + }, i.path = n.pathname + n.search, i.timeout = i.handshakeTimeout, i.perMessageDeflate && (v = new T( + i.perMessageDeflate !== !0 ? i.perMessageDeflate : {}, + !1, + i.maxPayload + ), i.headers["Sec-WebSocket-Extensions"] = gs({ + [T.extensionName]: v.offer() + })), t.length) { + for (const u of t) { + if (typeof u != "string" || !Es.test(u) || p.has(u)) + throw new SyntaxError( + "An invalid or duplicated subprotocol was specified" + ); + p.add(u); + } + i.headers["Sec-WebSocket-Protocol"] = t.join(","); + } + if (i.origin && (i.protocolVersion < 13 ? i.headers["Sec-WebSocket-Origin"] = i.origin : i.headers.Origin = i.origin), (n.username || n.password) && (i.auth = `${n.username}:${n.password}`), l) { + const u = i.path.split(":"); + i.socketPath = u[0], i.path = u[1]; + } + let _; + if (i.followRedirects) { + if (s._redirects === 0) { + s._originalIpc = l, s._originalSecure = o, s._originalHostOrSocketPath = l ? i.socketPath : n.host; + const u = r && r.headers; + if (r = { ...r, headers: {} }, u) + for (const [E, $] of Object.entries(u)) + r.headers[E.toLowerCase()] = $; + } else if (s.listenerCount("redirect") === 0) { + const u = l ? s._originalIpc ? i.socketPath === s._originalHostOrSocketPath : !1 : s._originalIpc ? !1 : n.host === s._originalHostOrSocketPath; + (!u || s._originalSecure && !o) && (delete i.headers.authorization, delete i.headers.cookie, u || delete i.headers.host, i.auth = void 0); + } + i.auth && !r.headers.authorization && (r.headers.authorization = "Basic " + Buffer.from(i.auth).toString("base64")), _ = s._req = h(i), s._redirects && s.emit("redirect", s.url, _); + } else + _ = s._req = h(i); + i.timeout && _.on("timeout", () => { + b(s, _, "Opening handshake has timed out"); + }), _.on("error", (u) => { + _ === null || _[lt] || (_ = s._req = null, ee(s, u)); + }), _.on("response", (u) => { + const E = u.headers.location, $ = u.statusCode; + if (E && i.followRedirects && $ >= 300 && $ < 400) { + if (++s._redirects > i.maxRedirects) { + b(s, _, "Maximum redirects exceeded"); + return; + } + _.abort(); + let q; + try { + q = new me(E, e); + } catch { + const L = new SyntaxError(`Invalid URL: ${E}`); + ee(s, L); + return; + } + ht(s, q, t, r); + } else + s.emit("unexpected-response", _, u) || b( + s, + _, + `Unexpected server response: ${u.statusCode}` + ); + }), _.on("upgrade", (u, E, $) => { + if (s.emit("upgrade", u), s.readyState !== m.CONNECTING) + return; + if (_ = s._req = null, u.headers.upgrade.toLowerCase() !== "websocket") { + b(s, E, "Invalid Upgrade header"); + return; + } + const q = fs("sha1").update(c + us).digest("base64"); + if (u.headers["sec-websocket-accept"] !== q) { + b(s, E, "Invalid Sec-WebSocket-Accept header"); + return; + } + const D = u.headers["sec-websocket-protocol"]; + let L; + if (D !== void 0 ? p.size ? p.has(D) || (L = "Server sent an invalid subprotocol") : L = "Server sent a subprotocol but none was requested" : p.size && (L = "Server sent no subprotocol"), L) { + b(s, E, L); + return; + } + D && (s._protocol = D); + const ke = u.headers["sec-websocket-extensions"]; + if (ke !== void 0) { + if (!v) { + b(s, E, "Server sent a Sec-WebSocket-Extensions header but no extension was requested"); + return; + } + let he; + try { + he = ys(ke); + } catch { + b(s, E, "Invalid Sec-WebSocket-Extensions header"); + return; + } + const we = Object.keys(he); + if (we.length !== 1 || we[0] !== T.extensionName) { + b(s, E, "Server indicated an extension that was not requested"); + return; + } + try { + v.accept(he[T.extensionName]); + } catch { + b(s, E, "Invalid Sec-WebSocket-Extensions header"); + return; + } + s._extensions[T.extensionName] = v; + } + s.setSocket(E, $, { + generateMask: i.generateMask, + maxPayload: i.maxPayload, + skipUTF8Validation: i.skipUTF8Validation + }); + }), i.finishRequest ? i.finishRequest(_, s) : _.end(); +} +function ee(s, e) { + s._readyState = m.CLOSING, s.emit("error", e), s.emitClose(); +} +function bs(s) { + return s.path = s.socketPath, ot.connect(s); +} +function xs(s) { + return s.path = void 0, !s.servername && s.servername !== "" && (s.servername = ot.isIP(s.host) ? "" : s.host), as.connect(s); +} +function b(s, e, t) { + s._readyState = m.CLOSING; + const r = new Error(t); + Error.captureStackTrace(r, b), e.setHeader ? (e[lt] = !0, e.abort(), e.socket && !e.socket.destroyed && e.socket.destroy(), process.nextTick(ee, s, r)) : (e.destroy(r), e.once("error", s.emit.bind(s, "error")), e.once("close", s.emitClose.bind(s))); +} +function ve(s, e, t) { + if (e) { + const r = vs(e).length; + s._socket ? s._sender._bufferedBytes += r : s._bufferedAmount += r; + } + if (t) { + const r = new Error( + `WebSocket is not open: readyState ${s.readyState} (${O[s.readyState]})` + ); + process.nextTick(t, r); + } +} +function ks(s, e) { + const t = this[y]; + t._closeFrameReceived = !0, t._closeMessage = e, t._closeCode = s, t._socket[y] !== void 0 && (t._socket.removeListener("data", fe), process.nextTick(ct, t._socket), s === 1005 ? t.close() : t.close(s, e)); +} +function ws() { + const s = this[y]; + s.isPaused || s._socket.resume(); +} +function Os(s) { + const e = this[y]; + e._socket[y] !== void 0 && (e._socket.removeListener("data", fe), process.nextTick(ct, e._socket), e.close(s[_s])), e.emit("error", s); +} +function Ye() { + this[y].emitClose(); +} +function Cs(s, e) { + this[y].emit("message", s, e); +} +function Ts(s) { + const e = this[y]; + e.pong(s, !e._isServer, at), e.emit("ping", s); +} +function Ls(s) { + this[y].emit("pong", s); +} +function ct(s) { + s.resume(); +} +function ut() { + const s = this[y]; + this.removeListener("close", ut), this.removeListener("data", fe), this.removeListener("end", dt), s._readyState = m.CLOSING; + let e; + !this._readableState.endEmitted && !s._closeFrameReceived && !s._receiver._writableState.errorEmitted && (e = s._socket.read()) !== null && s._receiver.write(e), s._receiver.end(), this[y] = void 0, clearTimeout(s._closeTimer), s._receiver._writableState.finished || s._receiver._writableState.errorEmitted ? s.emitClose() : (s._receiver.on("error", Ye), s._receiver.on("finish", Ye)); +} +function fe(s) { + this[y]._receiver.write(s) || this.pause(); +} +function dt() { + const s = this[y]; + s._readyState = m.CLOSING, s._receiver.end(), this.end(); +} +function _t() { + const s = this[y]; + this.removeListener("error", _t), this.on("error", at), s && (s._readyState = m.CLOSING, this.destroy()); +} +const Xs = /* @__PURE__ */ z(ft), { tokenChars: Ns } = ae; +function Ps(s) { + const e = /* @__PURE__ */ new Set(); + let t = -1, r = -1, i = 0; + for (i; i < s.length; i++) { + const o = s.charCodeAt(i); + if (r === -1 && Ns[o] === 1) + t === -1 && (t = i); + else if (i !== 0 && (o === 32 || o === 9)) + r === -1 && t !== -1 && (r = i); + else if (o === 44) { + if (t === -1) + throw new SyntaxError(`Unexpected character at index ${i}`); + r === -1 && (r = i); + const l = s.slice(t, r); + if (e.has(l)) + throw new SyntaxError(`The "${l}" subprotocol is duplicated`); + e.add(l), t = r = -1; + } else + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (t === -1 || r !== -1) + throw new SyntaxError("Unexpected end of input"); + const n = s.slice(t, i); + if (e.has(n)) + throw new SyntaxError(`The "${n}" subprotocol is duplicated`); + return e.add(n), e; +} +var Rs = { parse: Ps }; +const Us = S, ie = S, { createHash: Bs } = S, qe = nt, N = oe, $s = Rs, Ms = ft, { GUID: Is, kWebSocket: Ds } = U, Ws = /^[+/0-9A-Za-z]{22}==$/, Ke = 0, Xe = 1, pt = 2; +class As extends Us { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S + * server to use + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` + * class to use. It must be the `WebSocket` class or class that extends it + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(e, t) { + if (super(), e = { + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: !1, + perMessageDeflate: !1, + handleProtocols: null, + clientTracking: !0, + verifyClient: null, + noServer: !1, + backlog: null, + // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + WebSocket: Ms, + ...e + }, e.port == null && !e.server && !e.noServer || e.port != null && (e.server || e.noServer) || e.server && e.noServer) + throw new TypeError( + 'One and only one of the "port", "server", or "noServer" options must be specified' + ); + if (e.port != null ? (this._server = ie.createServer((r, i) => { + const n = ie.STATUS_CODES[426]; + i.writeHead(426, { + "Content-Length": n.length, + "Content-Type": "text/plain" + }), i.end(n); + }), this._server.listen( + e.port, + e.host, + e.backlog, + t + )) : e.server && (this._server = e.server), this._server) { + const r = this.emit.bind(this, "connection"); + this._removeListeners = js(this._server, { + listening: this.emit.bind(this, "listening"), + error: this.emit.bind(this, "error"), + upgrade: (i, n, o) => { + this.handleUpgrade(i, n, o, r); + } + }); + } + e.perMessageDeflate === !0 && (e.perMessageDeflate = {}), e.clientTracking && (this.clients = /* @__PURE__ */ new Set(), this._shouldEmitClose = !1), this.options = e, this._state = Ke; + } + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) + throw new Error('The server is operating in "noServer" mode'); + return this._server ? this._server.address() : null; + } + /** + * Stop the server from accepting new connections and emit the `'close'` event + * when all existing connections are closed. + * + * @param {Function} [cb] A one-time listener for the `'close'` event + * @public + */ + close(e) { + if (this._state === pt) { + e && this.once("close", () => { + e(new Error("The server is not running")); + }), process.nextTick(G, this); + return; + } + if (e && this.once("close", e), this._state !== Xe) + if (this._state = Xe, this.options.noServer || this.options.server) + this._server && (this._removeListeners(), this._removeListeners = this._server = null), this.clients ? this.clients.size ? this._shouldEmitClose = !0 : process.nextTick(G, this) : process.nextTick(G, this); + else { + const t = this._server; + this._removeListeners(), this._removeListeners = this._server = null, t.close(() => { + G(this); + }); + } + } + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(e) { + if (this.options.path) { + const t = e.url.indexOf("?"); + if ((t !== -1 ? e.url.slice(0, t) : e.url) !== this.options.path) + return !1; + } + return !0; + } + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(e, t, r, i) { + t.on("error", Ze); + const n = e.headers["sec-websocket-key"], o = +e.headers["sec-websocket-version"]; + if (e.method !== "GET") { + R(this, e, t, 405, "Invalid HTTP method"); + return; + } + if (e.headers.upgrade.toLowerCase() !== "websocket") { + R(this, e, t, 400, "Invalid Upgrade header"); + return; + } + if (!n || !Ws.test(n)) { + R(this, e, t, 400, "Missing or invalid Sec-WebSocket-Key header"); + return; + } + if (o !== 8 && o !== 13) { + R(this, e, t, 400, "Missing or invalid Sec-WebSocket-Version header"); + return; + } + if (!this.shouldHandle(e)) { + H(t, 400); + return; + } + const l = e.headers["sec-websocket-protocol"]; + let f = /* @__PURE__ */ new Set(); + if (l !== void 0) + try { + f = $s.parse(l); + } catch { + R(this, e, t, 400, "Invalid Sec-WebSocket-Protocol header"); + return; + } + const a = e.headers["sec-websocket-extensions"], c = {}; + if (this.options.perMessageDeflate && a !== void 0) { + const h = new N( + this.options.perMessageDeflate, + !0, + this.options.maxPayload + ); + try { + const p = qe.parse(a); + p[N.extensionName] && (h.accept(p[N.extensionName]), c[N.extensionName] = h); + } catch { + R(this, e, t, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header"); + return; + } + } + if (this.options.verifyClient) { + const h = { + origin: e.headers[`${o === 8 ? "sec-websocket-origin" : "origin"}`], + secure: !!(e.socket.authorized || e.socket.encrypted), + req: e + }; + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(h, (p, v, _, u) => { + if (!p) + return H(t, v || 401, _, u); + this.completeUpgrade( + c, + n, + f, + e, + t, + r, + i + ); + }); + return; + } + if (!this.options.verifyClient(h)) + return H(t, 401); + } + this.completeUpgrade(c, n, f, e, t, r, i); + } + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Set} protocols The subprotocols + * @param {http.IncomingMessage} req The request object + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(e, t, r, i, n, o, l) { + if (!n.readable || !n.writable) + return n.destroy(); + if (n[Ds]) + throw new Error( + "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration" + ); + if (this._state > Ke) + return H(n, 503); + const a = [ + "HTTP/1.1 101 Switching Protocols", + "Upgrade: websocket", + "Connection: Upgrade", + `Sec-WebSocket-Accept: ${Bs("sha1").update(t + Is).digest("base64")}` + ], c = new this.options.WebSocket(null); + if (r.size) { + const h = this.options.handleProtocols ? this.options.handleProtocols(r, i) : r.values().next().value; + h && (a.push(`Sec-WebSocket-Protocol: ${h}`), c._protocol = h); + } + if (e[N.extensionName]) { + const h = e[N.extensionName].params, p = qe.format({ + [N.extensionName]: [h] + }); + a.push(`Sec-WebSocket-Extensions: ${p}`), c._extensions = e; + } + this.emit("headers", a, i), n.write(a.concat(`\r +`).join(`\r +`)), n.removeListener("error", Ze), c.setSocket(n, o, { + maxPayload: this.options.maxPayload, + skipUTF8Validation: this.options.skipUTF8Validation + }), this.clients && (this.clients.add(c), c.on("close", () => { + this.clients.delete(c), this._shouldEmitClose && !this.clients.size && process.nextTick(G, this); + })), l(c, i); + } +} +var Fs = As; +function js(s, e) { + for (const t of Object.keys(e)) + s.on(t, e[t]); + return function() { + for (const r of Object.keys(e)) + s.removeListener(r, e[r]); + }; +} +function G(s) { + s._state = pt, s.emit("close"); +} +function Ze() { + this.destroy(); +} +function H(s, e, t, r) { + t = t || ie.STATUS_CODES[e], r = { + Connection: "close", + "Content-Type": "text/html", + "Content-Length": Buffer.byteLength(t), + ...r + }, s.once("finish", s.destroy), s.end( + `HTTP/1.1 ${e} ${ie.STATUS_CODES[e]}\r +` + Object.keys(r).map((i) => `${i}: ${r[i]}`).join(`\r +`) + `\r +\r +` + t + ); +} +function R(s, e, t, r, i) { + if (s.listenerCount("wsClientError")) { + const n = new Error(i); + Error.captureStackTrace(n, R), s.emit("wsClientError", n, t, e); + } else + H(t, r, i); +} +const Zs = /* @__PURE__ */ z(Fs); +export { + qs as Receiver, + Ks as Sender, + Xs as WebSocket, + Zs as WebSocketServer, + Vs as createWebSocketStream, + Xs as default +}; diff --git a/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-f837cf34.js b/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-f837cf34.js new file mode 100644 index 0000000000000000000000000000000000000000..049455ba0aaa60574f7ec143d8ac83fdb0a0d2f1 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/component/wrapper-6f348d45-f837cf34.js @@ -0,0 +1,2455 @@ +import S from "./__vite-browser-external-2447137e.js"; +function z(s) { + return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; +} +function gt(s) { + if (s.__esModule) + return s; + var e = s.default; + if (typeof e == "function") { + var t = function r() { + if (this instanceof r) { + var i = [null]; + i.push.apply(i, arguments); + var n = Function.bind.apply(e, i); + return new n(); + } + return e.apply(this, arguments); + }; + t.prototype = e.prototype; + } else + t = {}; + return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(s).forEach(function(r) { + var i = Object.getOwnPropertyDescriptor(s, r); + Object.defineProperty(t, r, i.get ? i : { + enumerable: !0, + get: function() { + return s[r]; + } + }); + }), t; +} +const { Duplex: yt } = S; +function Oe(s) { + s.emit("close"); +} +function vt() { + !this.destroyed && this._writableState.finished && this.destroy(); +} +function Qe(s) { + this.removeListener("error", Qe), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", s); +} +function St(s, e) { + let t = !0; + const r = new yt({ + ...e, + autoDestroy: !1, + emitClose: !1, + objectMode: !1, + writableObjectMode: !1 + }); + return s.on("message", function(n, o) { + const l = !o && r._readableState.objectMode ? n.toString() : n; + r.push(l) || s.pause(); + }), s.once("error", function(n) { + r.destroyed || (t = !1, r.destroy(n)); + }), s.once("close", function() { + r.destroyed || r.push(null); + }), r._destroy = function(i, n) { + if (s.readyState === s.CLOSED) { + n(i), process.nextTick(Oe, r); + return; + } + let o = !1; + s.once("error", function(f) { + o = !0, n(f); + }), s.once("close", function() { + o || n(i), process.nextTick(Oe, r); + }), t && s.terminate(); + }, r._final = function(i) { + if (s.readyState === s.CONNECTING) { + s.once("open", function() { + r._final(i); + }); + return; + } + s._socket !== null && (s._socket._writableState.finished ? (i(), r._readableState.endEmitted && r.destroy()) : (s._socket.once("finish", function() { + i(); + }), s.close())); + }, r._read = function() { + s.isPaused && s.resume(); + }, r._write = function(i, n, o) { + if (s.readyState === s.CONNECTING) { + s.once("open", function() { + r._write(i, n, o); + }); + return; + } + s.send(i, o); + }, r.on("end", vt), r.on("error", Qe), r; +} +var Et = St; +const Vs = /* @__PURE__ */ z(Et); +var te = { exports: {} }, U = { + BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"], + EMPTY_BUFFER: Buffer.alloc(0), + GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", + kForOnEventAttribute: Symbol("kIsForOnEventAttribute"), + kListener: Symbol("kListener"), + kStatusCode: Symbol("status-code"), + kWebSocket: Symbol("websocket"), + NOOP: () => { + } +}, bt, xt; +const { EMPTY_BUFFER: kt } = U, Se = Buffer[Symbol.species]; +function wt(s, e) { + if (s.length === 0) + return kt; + if (s.length === 1) + return s[0]; + const t = Buffer.allocUnsafe(e); + let r = 0; + for (let i = 0; i < s.length; i++) { + const n = s[i]; + t.set(n, r), r += n.length; + } + return r < e ? new Se(t.buffer, t.byteOffset, r) : t; +} +function Je(s, e, t, r, i) { + for (let n = 0; n < i; n++) + t[r + n] = s[n] ^ e[n & 3]; +} +function et(s, e) { + for (let t = 0; t < s.length; t++) + s[t] ^= e[t & 3]; +} +function Ot(s) { + return s.length === s.buffer.byteLength ? s.buffer : s.buffer.slice(s.byteOffset, s.byteOffset + s.length); +} +function Ee(s) { + if (Ee.readOnly = !0, Buffer.isBuffer(s)) + return s; + let e; + return s instanceof ArrayBuffer ? e = new Se(s) : ArrayBuffer.isView(s) ? e = new Se(s.buffer, s.byteOffset, s.byteLength) : (e = Buffer.from(s), Ee.readOnly = !1), e; +} +te.exports = { + concat: wt, + mask: Je, + toArrayBuffer: Ot, + toBuffer: Ee, + unmask: et +}; +if (!process.env.WS_NO_BUFFER_UTIL) + try { + const s = require("bufferutil"); + xt = te.exports.mask = function(e, t, r, i, n) { + n < 48 ? Je(e, t, r, i, n) : s.mask(e, t, r, i, n); + }, bt = te.exports.unmask = function(e, t) { + e.length < 32 ? et(e, t) : s.unmask(e, t); + }; + } catch { + } +var ne = te.exports; +const Ce = Symbol("kDone"), ue = Symbol("kRun"); +let Ct = class { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(e) { + this[Ce] = () => { + this.pending--, this[ue](); + }, this.concurrency = e || 1 / 0, this.jobs = [], this.pending = 0; + } + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(e) { + this.jobs.push(e), this[ue](); + } + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [ue]() { + if (this.pending !== this.concurrency && this.jobs.length) { + const e = this.jobs.shift(); + this.pending++, e(this[Ce]); + } + } +}; +var Tt = Ct; +const W = S, Te = ne, Lt = Tt, { kStatusCode: tt } = U, Nt = Buffer[Symbol.species], Pt = Buffer.from([0, 0, 255, 255]), se = Symbol("permessage-deflate"), w = Symbol("total-length"), V = Symbol("callback"), C = Symbol("buffers"), J = Symbol("error"); +let K, Rt = class { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed if context takeover is disabled + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(e, t, r) { + if (this._maxPayload = r | 0, this._options = e || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._isServer = !!t, this._deflate = null, this._inflate = null, this.params = null, !K) { + const i = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10; + K = new Lt(i); + } + } + /** + * @type {String} + */ + static get extensionName() { + return "permessage-deflate"; + } + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const e = {}; + return this._options.serverNoContextTakeover && (e.server_no_context_takeover = !0), this._options.clientNoContextTakeover && (e.client_no_context_takeover = !0), this._options.serverMaxWindowBits && (e.server_max_window_bits = this._options.serverMaxWindowBits), this._options.clientMaxWindowBits ? e.client_max_window_bits = this._options.clientMaxWindowBits : this._options.clientMaxWindowBits == null && (e.client_max_window_bits = !0), e; + } + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(e) { + return e = this.normalizeParams(e), this.params = this._isServer ? this.acceptAsServer(e) : this.acceptAsClient(e), this.params; + } + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate && (this._inflate.close(), this._inflate = null), this._deflate) { + const e = this._deflate[V]; + this._deflate.close(), this._deflate = null, e && e( + new Error( + "The deflate stream was closed while data was being processed" + ) + ); + } + } + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(e) { + const t = this._options, r = e.find((i) => !(t.serverNoContextTakeover === !1 && i.server_no_context_takeover || i.server_max_window_bits && (t.serverMaxWindowBits === !1 || typeof t.serverMaxWindowBits == "number" && t.serverMaxWindowBits > i.server_max_window_bits) || typeof t.clientMaxWindowBits == "number" && !i.client_max_window_bits)); + if (!r) + throw new Error("None of the extension offers can be accepted"); + return t.serverNoContextTakeover && (r.server_no_context_takeover = !0), t.clientNoContextTakeover && (r.client_no_context_takeover = !0), typeof t.serverMaxWindowBits == "number" && (r.server_max_window_bits = t.serverMaxWindowBits), typeof t.clientMaxWindowBits == "number" ? r.client_max_window_bits = t.clientMaxWindowBits : (r.client_max_window_bits === !0 || t.clientMaxWindowBits === !1) && delete r.client_max_window_bits, r; + } + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(e) { + const t = e[0]; + if (this._options.clientNoContextTakeover === !1 && t.client_no_context_takeover) + throw new Error('Unexpected parameter "client_no_context_takeover"'); + if (!t.client_max_window_bits) + typeof this._options.clientMaxWindowBits == "number" && (t.client_max_window_bits = this._options.clientMaxWindowBits); + else if (this._options.clientMaxWindowBits === !1 || typeof this._options.clientMaxWindowBits == "number" && t.client_max_window_bits > this._options.clientMaxWindowBits) + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + return t; + } + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(e) { + return e.forEach((t) => { + Object.keys(t).forEach((r) => { + let i = t[r]; + if (i.length > 1) + throw new Error(`Parameter "${r}" must have only a single value`); + if (i = i[0], r === "client_max_window_bits") { + if (i !== !0) { + const n = +i; + if (!Number.isInteger(n) || n < 8 || n > 15) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + i = n; + } else if (!this._isServer) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + } else if (r === "server_max_window_bits") { + const n = +i; + if (!Number.isInteger(n) || n < 8 || n > 15) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + i = n; + } else if (r === "client_no_context_takeover" || r === "server_no_context_takeover") { + if (i !== !0) + throw new TypeError( + `Invalid value for parameter "${r}": ${i}` + ); + } else + throw new Error(`Unknown parameter "${r}"`); + t[r] = i; + }); + }), e; + } + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(e, t, r) { + K.add((i) => { + this._decompress(e, t, (n, o) => { + i(), r(n, o); + }); + }); + } + /** + * Compress data. Concurrency limited. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(e, t, r) { + K.add((i) => { + this._compress(e, t, (n, o) => { + i(), r(n, o); + }); + }); + } + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(e, t, r) { + const i = this._isServer ? "client" : "server"; + if (!this._inflate) { + const n = `${i}_max_window_bits`, o = typeof this.params[n] != "number" ? W.Z_DEFAULT_WINDOWBITS : this.params[n]; + this._inflate = W.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits: o + }), this._inflate[se] = this, this._inflate[w] = 0, this._inflate[C] = [], this._inflate.on("error", Bt), this._inflate.on("data", st); + } + this._inflate[V] = r, this._inflate.write(e), t && this._inflate.write(Pt), this._inflate.flush(() => { + const n = this._inflate[J]; + if (n) { + this._inflate.close(), this._inflate = null, r(n); + return; + } + const o = Te.concat( + this._inflate[C], + this._inflate[w] + ); + this._inflate._readableState.endEmitted ? (this._inflate.close(), this._inflate = null) : (this._inflate[w] = 0, this._inflate[C] = [], t && this.params[`${i}_no_context_takeover`] && this._inflate.reset()), r(null, o); + }); + } + /** + * Compress data. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(e, t, r) { + const i = this._isServer ? "server" : "client"; + if (!this._deflate) { + const n = `${i}_max_window_bits`, o = typeof this.params[n] != "number" ? W.Z_DEFAULT_WINDOWBITS : this.params[n]; + this._deflate = W.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits: o + }), this._deflate[w] = 0, this._deflate[C] = [], this._deflate.on("data", Ut); + } + this._deflate[V] = r, this._deflate.write(e), this._deflate.flush(W.Z_SYNC_FLUSH, () => { + if (!this._deflate) + return; + let n = Te.concat( + this._deflate[C], + this._deflate[w] + ); + t && (n = new Nt(n.buffer, n.byteOffset, n.length - 4)), this._deflate[V] = null, this._deflate[w] = 0, this._deflate[C] = [], t && this.params[`${i}_no_context_takeover`] && this._deflate.reset(), r(null, n); + }); + } +}; +var oe = Rt; +function Ut(s) { + this[C].push(s), this[w] += s.length; +} +function st(s) { + if (this[w] += s.length, this[se]._maxPayload < 1 || this[w] <= this[se]._maxPayload) { + this[C].push(s); + return; + } + this[J] = new RangeError("Max payload size exceeded"), this[J].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[J][tt] = 1009, this.removeListener("data", st), this.reset(); +} +function Bt(s) { + this[se]._inflate = null, s[tt] = 1007, this[V](s); +} +var re = { exports: {} }; +const $t = {}, Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: $t +}, Symbol.toStringTag, { value: "Module" })), It = /* @__PURE__ */ gt(Mt); +var Le; +const { isUtf8: Ne } = S, Dt = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 0 - 15 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 16 - 31 + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + // 32 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + // 48 - 63 + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 64 - 79 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + // 80 - 95 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 96 - 111 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0 + // 112 - 127 +]; +function Wt(s) { + return s >= 1e3 && s <= 1014 && s !== 1004 && s !== 1005 && s !== 1006 || s >= 3e3 && s <= 4999; +} +function be(s) { + const e = s.length; + let t = 0; + for (; t < e; ) + if (!(s[t] & 128)) + t++; + else if ((s[t] & 224) === 192) { + if (t + 1 === e || (s[t + 1] & 192) !== 128 || (s[t] & 254) === 192) + return !1; + t += 2; + } else if ((s[t] & 240) === 224) { + if (t + 2 >= e || (s[t + 1] & 192) !== 128 || (s[t + 2] & 192) !== 128 || s[t] === 224 && (s[t + 1] & 224) === 128 || // Overlong + s[t] === 237 && (s[t + 1] & 224) === 160) + return !1; + t += 3; + } else if ((s[t] & 248) === 240) { + if (t + 3 >= e || (s[t + 1] & 192) !== 128 || (s[t + 2] & 192) !== 128 || (s[t + 3] & 192) !== 128 || s[t] === 240 && (s[t + 1] & 240) === 128 || // Overlong + s[t] === 244 && s[t + 1] > 143 || s[t] > 244) + return !1; + t += 4; + } else + return !1; + return !0; +} +re.exports = { + isValidStatusCode: Wt, + isValidUTF8: be, + tokenChars: Dt +}; +if (Ne) + Le = re.exports.isValidUTF8 = function(s) { + return s.length < 24 ? be(s) : Ne(s); + }; +else if (!process.env.WS_NO_UTF_8_VALIDATE) + try { + const s = It; + Le = re.exports.isValidUTF8 = function(e) { + return e.length < 32 ? be(e) : s(e); + }; + } catch { + } +var ae = re.exports; +const { Writable: At } = S, Pe = oe, { + BINARY_TYPES: Ft, + EMPTY_BUFFER: Re, + kStatusCode: jt, + kWebSocket: Gt +} = U, { concat: de, toArrayBuffer: Vt, unmask: Ht } = ne, { isValidStatusCode: zt, isValidUTF8: Ue } = ae, X = Buffer[Symbol.species], A = 0, Be = 1, $e = 2, Me = 3, _e = 4, Yt = 5; +let qt = class extends At { + /** + * Creates a Receiver instance. + * + * @param {Object} [options] Options object + * @param {String} [options.binaryType=nodebuffer] The type for binary data + * @param {Object} [options.extensions] An object containing the negotiated + * extensions + * @param {Boolean} [options.isServer=false] Specifies whether to operate in + * client or server mode + * @param {Number} [options.maxPayload=0] The maximum allowed message length + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + */ + constructor(e = {}) { + super(), this._binaryType = e.binaryType || Ft[0], this._extensions = e.extensions || {}, this._isServer = !!e.isServer, this._maxPayload = e.maxPayload | 0, this._skipUTF8Validation = !!e.skipUTF8Validation, this[Gt] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._state = A, this._loop = !1; + } + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(e, t, r) { + if (this._opcode === 8 && this._state == A) + return r(); + this._bufferedBytes += e.length, this._buffers.push(e), this.startLoop(r); + } + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(e) { + if (this._bufferedBytes -= e, e === this._buffers[0].length) + return this._buffers.shift(); + if (e < this._buffers[0].length) { + const r = this._buffers[0]; + return this._buffers[0] = new X( + r.buffer, + r.byteOffset + e, + r.length - e + ), new X(r.buffer, r.byteOffset, e); + } + const t = Buffer.allocUnsafe(e); + do { + const r = this._buffers[0], i = t.length - e; + e >= r.length ? t.set(this._buffers.shift(), i) : (t.set(new Uint8Array(r.buffer, r.byteOffset, e), i), this._buffers[0] = new X( + r.buffer, + r.byteOffset + e, + r.length - e + )), e -= r.length; + } while (e > 0); + return t; + } + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(e) { + let t; + this._loop = !0; + do + switch (this._state) { + case A: + t = this.getInfo(); + break; + case Be: + t = this.getPayloadLength16(); + break; + case $e: + t = this.getPayloadLength64(); + break; + case Me: + this.getMask(); + break; + case _e: + t = this.getData(e); + break; + default: + this._loop = !1; + return; + } + while (this._loop); + e(t); + } + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = !1; + return; + } + const e = this.consume(2); + if (e[0] & 48) + return this._loop = !1, g( + RangeError, + "RSV2 and RSV3 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_2_3" + ); + const t = (e[0] & 64) === 64; + if (t && !this._extensions[Pe.extensionName]) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (this._fin = (e[0] & 128) === 128, this._opcode = e[0] & 15, this._payloadLength = e[1] & 127, this._opcode === 0) { + if (t) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (!this._fragmented) + return this._loop = !1, g( + RangeError, + "invalid opcode 0", + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + this._opcode = this._fragmented; + } else if (this._opcode === 1 || this._opcode === 2) { + if (this._fragmented) + return this._loop = !1, g( + RangeError, + `invalid opcode ${this._opcode}`, + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + this._compressed = t; + } else if (this._opcode > 7 && this._opcode < 11) { + if (!this._fin) + return this._loop = !1, g( + RangeError, + "FIN must be set", + !0, + 1002, + "WS_ERR_EXPECTED_FIN" + ); + if (t) + return this._loop = !1, g( + RangeError, + "RSV1 must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_RSV_1" + ); + if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) + return this._loop = !1, g( + RangeError, + `invalid payload length ${this._payloadLength}`, + !0, + 1002, + "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH" + ); + } else + return this._loop = !1, g( + RangeError, + `invalid opcode ${this._opcode}`, + !0, + 1002, + "WS_ERR_INVALID_OPCODE" + ); + if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (e[1] & 128) === 128, this._isServer) { + if (!this._masked) + return this._loop = !1, g( + RangeError, + "MASK must be set", + !0, + 1002, + "WS_ERR_EXPECTED_MASK" + ); + } else if (this._masked) + return this._loop = !1, g( + RangeError, + "MASK must be clear", + !0, + 1002, + "WS_ERR_UNEXPECTED_MASK" + ); + if (this._payloadLength === 126) + this._state = Be; + else if (this._payloadLength === 127) + this._state = $e; + else + return this.haveLength(); + } + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = !1; + return; + } + return this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(); + } + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = !1; + return; + } + const e = this.consume(8), t = e.readUInt32BE(0); + return t > Math.pow(2, 53 - 32) - 1 ? (this._loop = !1, g( + RangeError, + "Unsupported WebSocket frame: payload length > 2^53 - 1", + !1, + 1009, + "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH" + )) : (this._payloadLength = t * Math.pow(2, 32) + e.readUInt32BE(4), this.haveLength()); + } + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0)) + return this._loop = !1, g( + RangeError, + "Max payload size exceeded", + !1, + 1009, + "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" + ); + this._masked ? this._state = Me : this._state = _e; + } + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = !1; + return; + } + this._mask = this.consume(4), this._state = _e; + } + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(e) { + let t = Re; + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = !1; + return; + } + t = this.consume(this._payloadLength), this._masked && this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3] && Ht(t, this._mask); + } + if (this._opcode > 7) + return this.controlMessage(t); + if (this._compressed) { + this._state = Yt, this.decompress(t, e); + return; + } + return t.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(t)), this.dataMessage(); + } + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(e, t) { + this._extensions[Pe.extensionName].decompress(e, this._fin, (i, n) => { + if (i) + return t(i); + if (n.length) { + if (this._messageLength += n.length, this._messageLength > this._maxPayload && this._maxPayload > 0) + return t( + g( + RangeError, + "Max payload size exceeded", + !1, + 1009, + "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" + ) + ); + this._fragments.push(n); + } + const o = this.dataMessage(); + if (o) + return t(o); + this.startLoop(t); + }); + } + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const e = this._messageLength, t = this._fragments; + if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], this._opcode === 2) { + let r; + this._binaryType === "nodebuffer" ? r = de(t, e) : this._binaryType === "arraybuffer" ? r = Vt(de(t, e)) : r = t, this.emit("message", r, !0); + } else { + const r = de(t, e); + if (!this._skipUTF8Validation && !Ue(r)) + return this._loop = !1, g( + Error, + "invalid UTF-8 sequence", + !0, + 1007, + "WS_ERR_INVALID_UTF8" + ); + this.emit("message", r, !1); + } + } + this._state = A; + } + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(e) { + if (this._opcode === 8) + if (this._loop = !1, e.length === 0) + this.emit("conclude", 1005, Re), this.end(); + else { + const t = e.readUInt16BE(0); + if (!zt(t)) + return g( + RangeError, + `invalid status code ${t}`, + !0, + 1002, + "WS_ERR_INVALID_CLOSE_CODE" + ); + const r = new X( + e.buffer, + e.byteOffset + 2, + e.length - 2 + ); + if (!this._skipUTF8Validation && !Ue(r)) + return g( + Error, + "invalid UTF-8 sequence", + !0, + 1007, + "WS_ERR_INVALID_UTF8" + ); + this.emit("conclude", t, r), this.end(); + } + else + this._opcode === 9 ? this.emit("ping", e) : this.emit("pong", e); + this._state = A; + } +}; +var rt = qt; +function g(s, e, t, r, i) { + const n = new s( + t ? `Invalid WebSocket frame: ${e}` : e + ); + return Error.captureStackTrace(n, g), n.code = i, n[jt] = r, n; +} +const qs = /* @__PURE__ */ z(rt), { randomFillSync: Kt } = S, Ie = oe, { EMPTY_BUFFER: Xt } = U, { isValidStatusCode: Zt } = ae, { mask: De, toBuffer: M } = ne, x = Symbol("kByteLength"), Qt = Buffer.alloc(4); +let Jt = class P { + /** + * Creates a Sender instance. + * + * @param {(net.Socket|tls.Socket)} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Function} [generateMask] The function used to generate the masking + * key + */ + constructor(e, t, r) { + this._extensions = t || {}, r && (this._generateMask = r, this._maskBuffer = Buffer.alloc(4)), this._socket = e, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this._deflating = !1, this._queue = []; + } + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {(Buffer|String)} data The data to frame + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {(Buffer|String)[]} The framed data + * @public + */ + static frame(e, t) { + let r, i = !1, n = 2, o = !1; + t.mask && (r = t.maskBuffer || Qt, t.generateMask ? t.generateMask(r) : Kt(r, 0, 4), o = (r[0] | r[1] | r[2] | r[3]) === 0, n = 6); + let l; + typeof e == "string" ? (!t.mask || o) && t[x] !== void 0 ? l = t[x] : (e = Buffer.from(e), l = e.length) : (l = e.length, i = t.mask && t.readOnly && !o); + let f = l; + l >= 65536 ? (n += 8, f = 127) : l > 125 && (n += 2, f = 126); + const a = Buffer.allocUnsafe(i ? l + n : n); + return a[0] = t.fin ? t.opcode | 128 : t.opcode, t.rsv1 && (a[0] |= 64), a[1] = f, f === 126 ? a.writeUInt16BE(l, 2) : f === 127 && (a[2] = a[3] = 0, a.writeUIntBE(l, 4, 6)), t.mask ? (a[1] |= 128, a[n - 4] = r[0], a[n - 3] = r[1], a[n - 2] = r[2], a[n - 1] = r[3], o ? [a, e] : i ? (De(e, r, a, n, l), [a]) : (De(e, r, e, 0, l), [a, e])) : [a, e]; + } + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {(String|Buffer)} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(e, t, r, i) { + let n; + if (e === void 0) + n = Xt; + else { + if (typeof e != "number" || !Zt(e)) + throw new TypeError("First argument must be a valid error code number"); + if (t === void 0 || !t.length) + n = Buffer.allocUnsafe(2), n.writeUInt16BE(e, 0); + else { + const l = Buffer.byteLength(t); + if (l > 123) + throw new RangeError("The message must not be greater than 123 bytes"); + n = Buffer.allocUnsafe(2 + l), n.writeUInt16BE(e, 0), typeof t == "string" ? n.write(t, 2) : n.set(t, 2); + } + } + const o = { + [x]: n.length, + fin: !0, + generateMask: this._generateMask, + mask: r, + maskBuffer: this._maskBuffer, + opcode: 8, + readOnly: !1, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, n, !1, o, i]) : this.sendFrame(P.frame(n, o), i); + } + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(e, t, r) { + let i, n; + if (typeof e == "string" ? (i = Buffer.byteLength(e), n = !1) : (e = M(e), i = e.length, n = M.readOnly), i > 125) + throw new RangeError("The data size must not be greater than 125 bytes"); + const o = { + [x]: i, + fin: !0, + generateMask: this._generateMask, + mask: t, + maskBuffer: this._maskBuffer, + opcode: 9, + readOnly: n, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, e, !1, o, r]) : this.sendFrame(P.frame(e, o), r); + } + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(e, t, r) { + let i, n; + if (typeof e == "string" ? (i = Buffer.byteLength(e), n = !1) : (e = M(e), i = e.length, n = M.readOnly), i > 125) + throw new RangeError("The data size must not be greater than 125 bytes"); + const o = { + [x]: i, + fin: !0, + generateMask: this._generateMask, + mask: t, + maskBuffer: this._maskBuffer, + opcode: 10, + readOnly: n, + rsv1: !1 + }; + this._deflating ? this.enqueue([this.dispatch, e, !1, o, r]) : this.sendFrame(P.frame(e, o), r); + } + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(e, t, r) { + const i = this._extensions[Ie.extensionName]; + let n = t.binary ? 2 : 1, o = t.compress, l, f; + if (typeof e == "string" ? (l = Buffer.byteLength(e), f = !1) : (e = M(e), l = e.length, f = M.readOnly), this._firstFragment ? (this._firstFragment = !1, o && i && i.params[i._isServer ? "server_no_context_takeover" : "client_no_context_takeover"] && (o = l >= i._threshold), this._compress = o) : (o = !1, n = 0), t.fin && (this._firstFragment = !0), i) { + const a = { + [x]: l, + fin: t.fin, + generateMask: this._generateMask, + mask: t.mask, + maskBuffer: this._maskBuffer, + opcode: n, + readOnly: f, + rsv1: o + }; + this._deflating ? this.enqueue([this.dispatch, e, this._compress, a, r]) : this.dispatch(e, this._compress, a, r); + } else + this.sendFrame( + P.frame(e, { + [x]: l, + fin: t.fin, + generateMask: this._generateMask, + mask: t.mask, + maskBuffer: this._maskBuffer, + opcode: n, + readOnly: f, + rsv1: !1 + }), + r + ); + } + /** + * Dispatches a message. + * + * @param {(Buffer|String)} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(e, t, r, i) { + if (!t) { + this.sendFrame(P.frame(e, r), i); + return; + } + const n = this._extensions[Ie.extensionName]; + this._bufferedBytes += r[x], this._deflating = !0, n.compress(e, r.fin, (o, l) => { + if (this._socket.destroyed) { + const f = new Error( + "The socket was closed while data was being compressed" + ); + typeof i == "function" && i(f); + for (let a = 0; a < this._queue.length; a++) { + const c = this._queue[a], h = c[c.length - 1]; + typeof h == "function" && h(f); + } + return; + } + this._bufferedBytes -= r[x], this._deflating = !1, r.readOnly = !1, this.sendFrame(P.frame(l, r), i), this.dequeue(); + }); + } + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + for (; !this._deflating && this._queue.length; ) { + const e = this._queue.shift(); + this._bufferedBytes -= e[3][x], Reflect.apply(e[0], this, e.slice(1)); + } + } + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(e) { + this._bufferedBytes += e[3][x], this._queue.push(e); + } + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(e, t) { + e.length === 2 ? (this._socket.cork(), this._socket.write(e[0]), this._socket.write(e[1], t), this._socket.uncork()) : this._socket.write(e[0], t); + } +}; +var it = Jt; +const Ks = /* @__PURE__ */ z(it), { kForOnEventAttribute: F, kListener: pe } = U, We = Symbol("kCode"), Ae = Symbol("kData"), Fe = Symbol("kError"), je = Symbol("kMessage"), Ge = Symbol("kReason"), I = Symbol("kTarget"), Ve = Symbol("kType"), He = Symbol("kWasClean"); +class B { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @throws {TypeError} If the `type` argument is not specified + */ + constructor(e) { + this[I] = null, this[Ve] = e; + } + /** + * @type {*} + */ + get target() { + return this[I]; + } + /** + * @type {String} + */ + get type() { + return this[Ve]; + } +} +Object.defineProperty(B.prototype, "target", { enumerable: !0 }); +Object.defineProperty(B.prototype, "type", { enumerable: !0 }); +class Y extends B { + /** + * Create a new `CloseEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {Number} [options.code=0] The status code explaining why the + * connection was closed + * @param {String} [options.reason=''] A human-readable string explaining why + * the connection was closed + * @param {Boolean} [options.wasClean=false] Indicates whether or not the + * connection was cleanly closed + */ + constructor(e, t = {}) { + super(e), this[We] = t.code === void 0 ? 0 : t.code, this[Ge] = t.reason === void 0 ? "" : t.reason, this[He] = t.wasClean === void 0 ? !1 : t.wasClean; + } + /** + * @type {Number} + */ + get code() { + return this[We]; + } + /** + * @type {String} + */ + get reason() { + return this[Ge]; + } + /** + * @type {Boolean} + */ + get wasClean() { + return this[He]; + } +} +Object.defineProperty(Y.prototype, "code", { enumerable: !0 }); +Object.defineProperty(Y.prototype, "reason", { enumerable: !0 }); +Object.defineProperty(Y.prototype, "wasClean", { enumerable: !0 }); +class le extends B { + /** + * Create a new `ErrorEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.error=null] The error that generated this event + * @param {String} [options.message=''] The error message + */ + constructor(e, t = {}) { + super(e), this[Fe] = t.error === void 0 ? null : t.error, this[je] = t.message === void 0 ? "" : t.message; + } + /** + * @type {*} + */ + get error() { + return this[Fe]; + } + /** + * @type {String} + */ + get message() { + return this[je]; + } +} +Object.defineProperty(le.prototype, "error", { enumerable: !0 }); +Object.defineProperty(le.prototype, "message", { enumerable: !0 }); +class xe extends B { + /** + * Create a new `MessageEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.data=null] The message content + */ + constructor(e, t = {}) { + super(e), this[Ae] = t.data === void 0 ? null : t.data; + } + /** + * @type {*} + */ + get data() { + return this[Ae]; + } +} +Object.defineProperty(xe.prototype, "data", { enumerable: !0 }); +const es = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {(Function|Object)} handler The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(s, e, t = {}) { + for (const i of this.listeners(s)) + if (!t[F] && i[pe] === e && !i[F]) + return; + let r; + if (s === "message") + r = function(n, o) { + const l = new xe("message", { + data: o ? n : n.toString() + }); + l[I] = this, Z(e, this, l); + }; + else if (s === "close") + r = function(n, o) { + const l = new Y("close", { + code: n, + reason: o.toString(), + wasClean: this._closeFrameReceived && this._closeFrameSent + }); + l[I] = this, Z(e, this, l); + }; + else if (s === "error") + r = function(n) { + const o = new le("error", { + error: n, + message: n.message + }); + o[I] = this, Z(e, this, o); + }; + else if (s === "open") + r = function() { + const n = new B("open"); + n[I] = this, Z(e, this, n); + }; + else + return; + r[F] = !!t[F], r[pe] = e, t.once ? this.once(s, r) : this.on(s, r); + }, + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {(Function|Object)} handler The listener to remove + * @public + */ + removeEventListener(s, e) { + for (const t of this.listeners(s)) + if (t[pe] === e && !t[F]) { + this.removeListener(s, t); + break; + } + } +}; +var ts = { + CloseEvent: Y, + ErrorEvent: le, + Event: B, + EventTarget: es, + MessageEvent: xe +}; +function Z(s, e, t) { + typeof s == "object" && s.handleEvent ? s.handleEvent.call(s, t) : s.call(e, t); +} +const { tokenChars: j } = ae; +function k(s, e, t) { + s[e] === void 0 ? s[e] = [t] : s[e].push(t); +} +function ss(s) { + const e = /* @__PURE__ */ Object.create(null); + let t = /* @__PURE__ */ Object.create(null), r = !1, i = !1, n = !1, o, l, f = -1, a = -1, c = -1, h = 0; + for (; h < s.length; h++) + if (a = s.charCodeAt(h), o === void 0) + if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (h !== 0 && (a === 32 || a === 9)) + c === -1 && f !== -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h); + const v = s.slice(f, c); + a === 44 ? (k(e, v, t), t = /* @__PURE__ */ Object.create(null)) : o = v, f = c = -1; + } else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (l === void 0) + if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (a === 32 || a === 9) + c === -1 && f !== -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h), k(t, s.slice(f, c), !0), a === 44 && (k(e, o, t), t = /* @__PURE__ */ Object.create(null), o = void 0), f = c = -1; + } else if (a === 61 && f !== -1 && c === -1) + l = s.slice(f, h), f = c = -1; + else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (i) { + if (j[a] !== 1) + throw new SyntaxError(`Unexpected character at index ${h}`); + f === -1 ? f = h : r || (r = !0), i = !1; + } else if (n) + if (j[a] === 1) + f === -1 && (f = h); + else if (a === 34 && f !== -1) + n = !1, c = h; + else if (a === 92) + i = !0; + else + throw new SyntaxError(`Unexpected character at index ${h}`); + else if (a === 34 && s.charCodeAt(h - 1) === 61) + n = !0; + else if (c === -1 && j[a] === 1) + f === -1 && (f = h); + else if (f !== -1 && (a === 32 || a === 9)) + c === -1 && (c = h); + else if (a === 59 || a === 44) { + if (f === -1) + throw new SyntaxError(`Unexpected character at index ${h}`); + c === -1 && (c = h); + let v = s.slice(f, c); + r && (v = v.replace(/\\/g, ""), r = !1), k(t, l, v), a === 44 && (k(e, o, t), t = /* @__PURE__ */ Object.create(null), o = void 0), l = void 0, f = c = -1; + } else + throw new SyntaxError(`Unexpected character at index ${h}`); + if (f === -1 || n || a === 32 || a === 9) + throw new SyntaxError("Unexpected end of input"); + c === -1 && (c = h); + const p = s.slice(f, c); + return o === void 0 ? k(e, p, t) : (l === void 0 ? k(t, p, !0) : r ? k(t, l, p.replace(/\\/g, "")) : k(t, l, p), k(e, o, t)), e; +} +function rs(s) { + return Object.keys(s).map((e) => { + let t = s[e]; + return Array.isArray(t) || (t = [t]), t.map((r) => [e].concat( + Object.keys(r).map((i) => { + let n = r[i]; + return Array.isArray(n) || (n = [n]), n.map((o) => o === !0 ? i : `${i}=${o}`).join("; "); + }) + ).join("; ")).join(", "); + }).join(", "); +} +var nt = { format: rs, parse: ss }; +const is = S, ns = S, os = S, ot = S, as = S, { randomBytes: ls, createHash: fs } = S, { URL: me } = S, T = oe, hs = rt, cs = it, { + BINARY_TYPES: ze, + EMPTY_BUFFER: Q, + GUID: us, + kForOnEventAttribute: ge, + kListener: ds, + kStatusCode: _s, + kWebSocket: y, + NOOP: at +} = U, { + EventTarget: { addEventListener: ps, removeEventListener: ms } +} = ts, { format: gs, parse: ys } = nt, { toBuffer: vs } = ne, Ss = 30 * 1e3, lt = Symbol("kAborted"), ye = [8, 13], O = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"], Es = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; +let m = class d extends is { + /** + * Create a new `WebSocket`. + * + * @param {(String|URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(e, t, r) { + super(), this._binaryType = ze[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = Q, this._closeTimer = null, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = d.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, e !== null ? (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, t === void 0 ? t = [] : Array.isArray(t) || (typeof t == "object" && t !== null ? (r = t, t = []) : t = [t]), ht(this, e, t, r)) : this._isServer = !0; + } + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + set binaryType(e) { + ze.includes(e) && (this._binaryType = e, this._receiver && (this._receiver._binaryType = e)); + } + /** + * @type {Number} + */ + get bufferedAmount() { + return this._socket ? this._socket._writableState.length + this._sender._bufferedBytes : this._bufferedAmount; + } + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + /** + * @type {Boolean} + */ + get isPaused() { + return this._paused; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onclose() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onerror() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onopen() { + return null; + } + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onmessage() { + return null; + } + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + /** + * @type {String} + */ + get url() { + return this._url; + } + /** + * Set up the socket and the internal resources. + * + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Object} options Options object + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.maxPayload=0] The maximum allowed message size + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ + setSocket(e, t, r) { + const i = new hs({ + binaryType: this.binaryType, + extensions: this._extensions, + isServer: this._isServer, + maxPayload: r.maxPayload, + skipUTF8Validation: r.skipUTF8Validation + }); + this._sender = new cs(e, this._extensions, r.generateMask), this._receiver = i, this._socket = e, i[y] = this, e[y] = this, i.on("conclude", ks), i.on("drain", ws), i.on("error", Os), i.on("message", Cs), i.on("ping", Ts), i.on("pong", Ls), e.setTimeout(0), e.setNoDelay(), t.length > 0 && e.unshift(t), e.on("close", ut), e.on("data", fe), e.on("end", dt), e.on("error", _t), this._readyState = d.OPEN, this.emit("open"); + } + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = d.CLOSED, this.emit("close", this._closeCode, this._closeMessage); + return; + } + this._extensions[T.extensionName] && this._extensions[T.extensionName].cleanup(), this._receiver.removeAllListeners(), this._readyState = d.CLOSED, this.emit("close", this._closeCode, this._closeMessage); + } + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {(String|Buffer)} [data] The reason why the connection is + * closing + * @public + */ + close(e, t) { + if (this.readyState !== d.CLOSED) { + if (this.readyState === d.CONNECTING) { + const r = "WebSocket was closed before the connection was established"; + b(this, this._req, r); + return; + } + if (this.readyState === d.CLOSING) { + this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end(); + return; + } + this._readyState = d.CLOSING, this._sender.close(e, t, !this._isServer, (r) => { + r || (this._closeFrameSent = !0, (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end()); + }), this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + Ss + ); + } + } + /** + * Pause the socket. + * + * @public + */ + pause() { + this.readyState === d.CONNECTING || this.readyState === d.CLOSED || (this._paused = !0, this._socket.pause()); + } + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof e == "function" ? (r = e, e = t = void 0) : typeof t == "function" && (r = t, t = void 0), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + t === void 0 && (t = !this._isServer), this._sender.ping(e || Q, t, r); + } + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof e == "function" ? (r = e, e = t = void 0) : typeof t == "function" && (r = t, t = void 0), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + t === void 0 && (t = !this._isServer), this._sender.pong(e || Q, t, r); + } + /** + * Resume the socket. + * + * @public + */ + resume() { + this.readyState === d.CONNECTING || this.readyState === d.CLOSED || (this._paused = !1, this._receiver._writableState.needDrain || this._socket.resume()); + } + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(e, t, r) { + if (this.readyState === d.CONNECTING) + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + if (typeof t == "function" && (r = t, t = {}), typeof e == "number" && (e = e.toString()), this.readyState !== d.OPEN) { + ve(this, e, r); + return; + } + const i = { + binary: typeof e != "string", + mask: !this._isServer, + compress: !0, + fin: !0, + ...t + }; + this._extensions[T.extensionName] || (i.compress = !1), this._sender.send(e || Q, i, r); + } + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState !== d.CLOSED) { + if (this.readyState === d.CONNECTING) { + const e = "WebSocket was closed before the connection was established"; + b(this, this._req, e); + return; + } + this._socket && (this._readyState = d.CLOSING, this._socket.destroy()); + } + } +}; +Object.defineProperty(m, "CONNECTING", { + enumerable: !0, + value: O.indexOf("CONNECTING") +}); +Object.defineProperty(m.prototype, "CONNECTING", { + enumerable: !0, + value: O.indexOf("CONNECTING") +}); +Object.defineProperty(m, "OPEN", { + enumerable: !0, + value: O.indexOf("OPEN") +}); +Object.defineProperty(m.prototype, "OPEN", { + enumerable: !0, + value: O.indexOf("OPEN") +}); +Object.defineProperty(m, "CLOSING", { + enumerable: !0, + value: O.indexOf("CLOSING") +}); +Object.defineProperty(m.prototype, "CLOSING", { + enumerable: !0, + value: O.indexOf("CLOSING") +}); +Object.defineProperty(m, "CLOSED", { + enumerable: !0, + value: O.indexOf("CLOSED") +}); +Object.defineProperty(m.prototype, "CLOSED", { + enumerable: !0, + value: O.indexOf("CLOSED") +}); +[ + "binaryType", + "bufferedAmount", + "extensions", + "isPaused", + "protocol", + "readyState", + "url" +].forEach((s) => { + Object.defineProperty(m.prototype, s, { enumerable: !0 }); +}); +["open", "error", "close", "message"].forEach((s) => { + Object.defineProperty(m.prototype, `on${s}`, { + enumerable: !0, + get() { + for (const e of this.listeners(s)) + if (e[ge]) + return e[ds]; + return null; + }, + set(e) { + for (const t of this.listeners(s)) + if (t[ge]) { + this.removeListener(s, t); + break; + } + typeof e == "function" && this.addEventListener(s, e, { + [ge]: !0 + }); + } + }); +}); +m.prototype.addEventListener = ps; +m.prototype.removeEventListener = ms; +var ft = m; +function ht(s, e, t, r) { + const i = { + protocolVersion: ye[1], + maxPayload: 104857600, + skipUTF8Validation: !1, + perMessageDeflate: !0, + followRedirects: !1, + maxRedirects: 10, + ...r, + createConnection: void 0, + socketPath: void 0, + hostname: void 0, + protocol: void 0, + timeout: void 0, + method: "GET", + host: void 0, + path: void 0, + port: void 0 + }; + if (!ye.includes(i.protocolVersion)) + throw new RangeError( + `Unsupported protocol version: ${i.protocolVersion} (supported versions: ${ye.join(", ")})` + ); + let n; + if (e instanceof me) + n = e, s._url = e.href; + else { + try { + n = new me(e); + } catch { + throw new SyntaxError(`Invalid URL: ${e}`); + } + s._url = e; + } + const o = n.protocol === "wss:", l = n.protocol === "ws+unix:"; + let f; + if (n.protocol !== "ws:" && !o && !l ? f = `The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"` : l && !n.pathname ? f = "The URL's pathname is empty" : n.hash && (f = "The URL contains a fragment identifier"), f) { + const u = new SyntaxError(f); + if (s._redirects === 0) + throw u; + ee(s, u); + return; + } + const a = o ? 443 : 80, c = ls(16).toString("base64"), h = o ? ns.request : os.request, p = /* @__PURE__ */ new Set(); + let v; + if (i.createConnection = o ? xs : bs, i.defaultPort = i.defaultPort || a, i.port = n.port || a, i.host = n.hostname.startsWith("[") ? n.hostname.slice(1, -1) : n.hostname, i.headers = { + ...i.headers, + "Sec-WebSocket-Version": i.protocolVersion, + "Sec-WebSocket-Key": c, + Connection: "Upgrade", + Upgrade: "websocket" + }, i.path = n.pathname + n.search, i.timeout = i.handshakeTimeout, i.perMessageDeflate && (v = new T( + i.perMessageDeflate !== !0 ? i.perMessageDeflate : {}, + !1, + i.maxPayload + ), i.headers["Sec-WebSocket-Extensions"] = gs({ + [T.extensionName]: v.offer() + })), t.length) { + for (const u of t) { + if (typeof u != "string" || !Es.test(u) || p.has(u)) + throw new SyntaxError( + "An invalid or duplicated subprotocol was specified" + ); + p.add(u); + } + i.headers["Sec-WebSocket-Protocol"] = t.join(","); + } + if (i.origin && (i.protocolVersion < 13 ? i.headers["Sec-WebSocket-Origin"] = i.origin : i.headers.Origin = i.origin), (n.username || n.password) && (i.auth = `${n.username}:${n.password}`), l) { + const u = i.path.split(":"); + i.socketPath = u[0], i.path = u[1]; + } + let _; + if (i.followRedirects) { + if (s._redirects === 0) { + s._originalIpc = l, s._originalSecure = o, s._originalHostOrSocketPath = l ? i.socketPath : n.host; + const u = r && r.headers; + if (r = { ...r, headers: {} }, u) + for (const [E, $] of Object.entries(u)) + r.headers[E.toLowerCase()] = $; + } else if (s.listenerCount("redirect") === 0) { + const u = l ? s._originalIpc ? i.socketPath === s._originalHostOrSocketPath : !1 : s._originalIpc ? !1 : n.host === s._originalHostOrSocketPath; + (!u || s._originalSecure && !o) && (delete i.headers.authorization, delete i.headers.cookie, u || delete i.headers.host, i.auth = void 0); + } + i.auth && !r.headers.authorization && (r.headers.authorization = "Basic " + Buffer.from(i.auth).toString("base64")), _ = s._req = h(i), s._redirects && s.emit("redirect", s.url, _); + } else + _ = s._req = h(i); + i.timeout && _.on("timeout", () => { + b(s, _, "Opening handshake has timed out"); + }), _.on("error", (u) => { + _ === null || _[lt] || (_ = s._req = null, ee(s, u)); + }), _.on("response", (u) => { + const E = u.headers.location, $ = u.statusCode; + if (E && i.followRedirects && $ >= 300 && $ < 400) { + if (++s._redirects > i.maxRedirects) { + b(s, _, "Maximum redirects exceeded"); + return; + } + _.abort(); + let q; + try { + q = new me(E, e); + } catch { + const L = new SyntaxError(`Invalid URL: ${E}`); + ee(s, L); + return; + } + ht(s, q, t, r); + } else + s.emit("unexpected-response", _, u) || b( + s, + _, + `Unexpected server response: ${u.statusCode}` + ); + }), _.on("upgrade", (u, E, $) => { + if (s.emit("upgrade", u), s.readyState !== m.CONNECTING) + return; + if (_ = s._req = null, u.headers.upgrade.toLowerCase() !== "websocket") { + b(s, E, "Invalid Upgrade header"); + return; + } + const q = fs("sha1").update(c + us).digest("base64"); + if (u.headers["sec-websocket-accept"] !== q) { + b(s, E, "Invalid Sec-WebSocket-Accept header"); + return; + } + const D = u.headers["sec-websocket-protocol"]; + let L; + if (D !== void 0 ? p.size ? p.has(D) || (L = "Server sent an invalid subprotocol") : L = "Server sent a subprotocol but none was requested" : p.size && (L = "Server sent no subprotocol"), L) { + b(s, E, L); + return; + } + D && (s._protocol = D); + const ke = u.headers["sec-websocket-extensions"]; + if (ke !== void 0) { + if (!v) { + b(s, E, "Server sent a Sec-WebSocket-Extensions header but no extension was requested"); + return; + } + let he; + try { + he = ys(ke); + } catch { + b(s, E, "Invalid Sec-WebSocket-Extensions header"); + return; + } + const we = Object.keys(he); + if (we.length !== 1 || we[0] !== T.extensionName) { + b(s, E, "Server indicated an extension that was not requested"); + return; + } + try { + v.accept(he[T.extensionName]); + } catch { + b(s, E, "Invalid Sec-WebSocket-Extensions header"); + return; + } + s._extensions[T.extensionName] = v; + } + s.setSocket(E, $, { + generateMask: i.generateMask, + maxPayload: i.maxPayload, + skipUTF8Validation: i.skipUTF8Validation + }); + }), i.finishRequest ? i.finishRequest(_, s) : _.end(); +} +function ee(s, e) { + s._readyState = m.CLOSING, s.emit("error", e), s.emitClose(); +} +function bs(s) { + return s.path = s.socketPath, ot.connect(s); +} +function xs(s) { + return s.path = void 0, !s.servername && s.servername !== "" && (s.servername = ot.isIP(s.host) ? "" : s.host), as.connect(s); +} +function b(s, e, t) { + s._readyState = m.CLOSING; + const r = new Error(t); + Error.captureStackTrace(r, b), e.setHeader ? (e[lt] = !0, e.abort(), e.socket && !e.socket.destroyed && e.socket.destroy(), process.nextTick(ee, s, r)) : (e.destroy(r), e.once("error", s.emit.bind(s, "error")), e.once("close", s.emitClose.bind(s))); +} +function ve(s, e, t) { + if (e) { + const r = vs(e).length; + s._socket ? s._sender._bufferedBytes += r : s._bufferedAmount += r; + } + if (t) { + const r = new Error( + `WebSocket is not open: readyState ${s.readyState} (${O[s.readyState]})` + ); + process.nextTick(t, r); + } +} +function ks(s, e) { + const t = this[y]; + t._closeFrameReceived = !0, t._closeMessage = e, t._closeCode = s, t._socket[y] !== void 0 && (t._socket.removeListener("data", fe), process.nextTick(ct, t._socket), s === 1005 ? t.close() : t.close(s, e)); +} +function ws() { + const s = this[y]; + s.isPaused || s._socket.resume(); +} +function Os(s) { + const e = this[y]; + e._socket[y] !== void 0 && (e._socket.removeListener("data", fe), process.nextTick(ct, e._socket), e.close(s[_s])), e.emit("error", s); +} +function Ye() { + this[y].emitClose(); +} +function Cs(s, e) { + this[y].emit("message", s, e); +} +function Ts(s) { + const e = this[y]; + e.pong(s, !e._isServer, at), e.emit("ping", s); +} +function Ls(s) { + this[y].emit("pong", s); +} +function ct(s) { + s.resume(); +} +function ut() { + const s = this[y]; + this.removeListener("close", ut), this.removeListener("data", fe), this.removeListener("end", dt), s._readyState = m.CLOSING; + let e; + !this._readableState.endEmitted && !s._closeFrameReceived && !s._receiver._writableState.errorEmitted && (e = s._socket.read()) !== null && s._receiver.write(e), s._receiver.end(), this[y] = void 0, clearTimeout(s._closeTimer), s._receiver._writableState.finished || s._receiver._writableState.errorEmitted ? s.emitClose() : (s._receiver.on("error", Ye), s._receiver.on("finish", Ye)); +} +function fe(s) { + this[y]._receiver.write(s) || this.pause(); +} +function dt() { + const s = this[y]; + s._readyState = m.CLOSING, s._receiver.end(), this.end(); +} +function _t() { + const s = this[y]; + this.removeListener("error", _t), this.on("error", at), s && (s._readyState = m.CLOSING, this.destroy()); +} +const Xs = /* @__PURE__ */ z(ft), { tokenChars: Ns } = ae; +function Ps(s) { + const e = /* @__PURE__ */ new Set(); + let t = -1, r = -1, i = 0; + for (i; i < s.length; i++) { + const o = s.charCodeAt(i); + if (r === -1 && Ns[o] === 1) + t === -1 && (t = i); + else if (i !== 0 && (o === 32 || o === 9)) + r === -1 && t !== -1 && (r = i); + else if (o === 44) { + if (t === -1) + throw new SyntaxError(`Unexpected character at index ${i}`); + r === -1 && (r = i); + const l = s.slice(t, r); + if (e.has(l)) + throw new SyntaxError(`The "${l}" subprotocol is duplicated`); + e.add(l), t = r = -1; + } else + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (t === -1 || r !== -1) + throw new SyntaxError("Unexpected end of input"); + const n = s.slice(t, i); + if (e.has(n)) + throw new SyntaxError(`The "${n}" subprotocol is duplicated`); + return e.add(n), e; +} +var Rs = { parse: Ps }; +const Us = S, ie = S, { createHash: Bs } = S, qe = nt, N = oe, $s = Rs, Ms = ft, { GUID: Is, kWebSocket: Ds } = U, Ws = /^[+/0-9A-Za-z]{22}==$/, Ke = 0, Xe = 1, pt = 2; +class As extends Us { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S + * server to use + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` + * class to use. It must be the `WebSocket` class or class that extends it + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(e, t) { + if (super(), e = { + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: !1, + perMessageDeflate: !1, + handleProtocols: null, + clientTracking: !0, + verifyClient: null, + noServer: !1, + backlog: null, + // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + WebSocket: Ms, + ...e + }, e.port == null && !e.server && !e.noServer || e.port != null && (e.server || e.noServer) || e.server && e.noServer) + throw new TypeError( + 'One and only one of the "port", "server", or "noServer" options must be specified' + ); + if (e.port != null ? (this._server = ie.createServer((r, i) => { + const n = ie.STATUS_CODES[426]; + i.writeHead(426, { + "Content-Length": n.length, + "Content-Type": "text/plain" + }), i.end(n); + }), this._server.listen( + e.port, + e.host, + e.backlog, + t + )) : e.server && (this._server = e.server), this._server) { + const r = this.emit.bind(this, "connection"); + this._removeListeners = js(this._server, { + listening: this.emit.bind(this, "listening"), + error: this.emit.bind(this, "error"), + upgrade: (i, n, o) => { + this.handleUpgrade(i, n, o, r); + } + }); + } + e.perMessageDeflate === !0 && (e.perMessageDeflate = {}), e.clientTracking && (this.clients = /* @__PURE__ */ new Set(), this._shouldEmitClose = !1), this.options = e, this._state = Ke; + } + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) + throw new Error('The server is operating in "noServer" mode'); + return this._server ? this._server.address() : null; + } + /** + * Stop the server from accepting new connections and emit the `'close'` event + * when all existing connections are closed. + * + * @param {Function} [cb] A one-time listener for the `'close'` event + * @public + */ + close(e) { + if (this._state === pt) { + e && this.once("close", () => { + e(new Error("The server is not running")); + }), process.nextTick(G, this); + return; + } + if (e && this.once("close", e), this._state !== Xe) + if (this._state = Xe, this.options.noServer || this.options.server) + this._server && (this._removeListeners(), this._removeListeners = this._server = null), this.clients ? this.clients.size ? this._shouldEmitClose = !0 : process.nextTick(G, this) : process.nextTick(G, this); + else { + const t = this._server; + this._removeListeners(), this._removeListeners = this._server = null, t.close(() => { + G(this); + }); + } + } + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(e) { + if (this.options.path) { + const t = e.url.indexOf("?"); + if ((t !== -1 ? e.url.slice(0, t) : e.url) !== this.options.path) + return !1; + } + return !0; + } + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(e, t, r, i) { + t.on("error", Ze); + const n = e.headers["sec-websocket-key"], o = +e.headers["sec-websocket-version"]; + if (e.method !== "GET") { + R(this, e, t, 405, "Invalid HTTP method"); + return; + } + if (e.headers.upgrade.toLowerCase() !== "websocket") { + R(this, e, t, 400, "Invalid Upgrade header"); + return; + } + if (!n || !Ws.test(n)) { + R(this, e, t, 400, "Missing or invalid Sec-WebSocket-Key header"); + return; + } + if (o !== 8 && o !== 13) { + R(this, e, t, 400, "Missing or invalid Sec-WebSocket-Version header"); + return; + } + if (!this.shouldHandle(e)) { + H(t, 400); + return; + } + const l = e.headers["sec-websocket-protocol"]; + let f = /* @__PURE__ */ new Set(); + if (l !== void 0) + try { + f = $s.parse(l); + } catch { + R(this, e, t, 400, "Invalid Sec-WebSocket-Protocol header"); + return; + } + const a = e.headers["sec-websocket-extensions"], c = {}; + if (this.options.perMessageDeflate && a !== void 0) { + const h = new N( + this.options.perMessageDeflate, + !0, + this.options.maxPayload + ); + try { + const p = qe.parse(a); + p[N.extensionName] && (h.accept(p[N.extensionName]), c[N.extensionName] = h); + } catch { + R(this, e, t, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header"); + return; + } + } + if (this.options.verifyClient) { + const h = { + origin: e.headers[`${o === 8 ? "sec-websocket-origin" : "origin"}`], + secure: !!(e.socket.authorized || e.socket.encrypted), + req: e + }; + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(h, (p, v, _, u) => { + if (!p) + return H(t, v || 401, _, u); + this.completeUpgrade( + c, + n, + f, + e, + t, + r, + i + ); + }); + return; + } + if (!this.options.verifyClient(h)) + return H(t, 401); + } + this.completeUpgrade(c, n, f, e, t, r, i); + } + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Set} protocols The subprotocols + * @param {http.IncomingMessage} req The request object + * @param {(net.Socket|tls.Socket)} socket The network socket between the + * server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(e, t, r, i, n, o, l) { + if (!n.readable || !n.writable) + return n.destroy(); + if (n[Ds]) + throw new Error( + "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration" + ); + if (this._state > Ke) + return H(n, 503); + const a = [ + "HTTP/1.1 101 Switching Protocols", + "Upgrade: websocket", + "Connection: Upgrade", + `Sec-WebSocket-Accept: ${Bs("sha1").update(t + Is).digest("base64")}` + ], c = new this.options.WebSocket(null); + if (r.size) { + const h = this.options.handleProtocols ? this.options.handleProtocols(r, i) : r.values().next().value; + h && (a.push(`Sec-WebSocket-Protocol: ${h}`), c._protocol = h); + } + if (e[N.extensionName]) { + const h = e[N.extensionName].params, p = qe.format({ + [N.extensionName]: [h] + }); + a.push(`Sec-WebSocket-Extensions: ${p}`), c._extensions = e; + } + this.emit("headers", a, i), n.write(a.concat(`\r +`).join(`\r +`)), n.removeListener("error", Ze), c.setSocket(n, o, { + maxPayload: this.options.maxPayload, + skipUTF8Validation: this.options.skipUTF8Validation + }), this.clients && (this.clients.add(c), c.on("close", () => { + this.clients.delete(c), this._shouldEmitClose && !this.clients.size && process.nextTick(G, this); + })), l(c, i); + } +} +var Fs = As; +function js(s, e) { + for (const t of Object.keys(e)) + s.on(t, e[t]); + return function() { + for (const r of Object.keys(e)) + s.removeListener(r, e[r]); + }; +} +function G(s) { + s._state = pt, s.emit("close"); +} +function Ze() { + this.destroy(); +} +function H(s, e, t, r) { + t = t || ie.STATUS_CODES[e], r = { + Connection: "close", + "Content-Type": "text/html", + "Content-Length": Buffer.byteLength(t), + ...r + }, s.once("finish", s.destroy), s.end( + `HTTP/1.1 ${e} ${ie.STATUS_CODES[e]}\r +` + Object.keys(r).map((i) => `${i}: ${r[i]}`).join(`\r +`) + `\r +\r +` + t + ); +} +function R(s, e, t, r, i) { + if (s.listenerCount("wsClientError")) { + const n = new Error(i); + Error.captureStackTrace(n, R), s.emit("wsClientError", n, t, e); + } else + H(t, r, i); +} +const Zs = /* @__PURE__ */ z(Fs); +export { + qs as Receiver, + Ks as Sender, + Xs as WebSocket, + Zs as WebSocketServer, + Vs as createWebSocketStream, + Xs as default +}; diff --git a/src/backend/gradio_image_annotation/templates/example/index.js b/src/backend/gradio_image_annotation/templates/example/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a7028d7391fca498039df5cf3d5643e47ef030ff --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/example/index.js @@ -0,0 +1,113 @@ +const { + SvelteComponent: m, + attr: f, + detach: o, + element: d, + init: b, + insert: g, + noop: c, + safe_not_equal: v, + src_url_equal: u, + toggle_class: a +} = window.__gradio__svelte__internal; +function _(n) { + let e, l; + return { + c() { + e = d("img"), u(e.src, l = /*value*/ + n[0].url) || f(e, "src", l), f(e, "alt", ""); + }, + m(t, i) { + g(t, e, i); + }, + p(t, i) { + i & /*value*/ + 1 && !u(e.src, l = /*value*/ + t[0].url) && f(e, "src", l); + }, + d(t) { + t && o(e); + } + }; +} +function y(n) { + let e, l = ( + /*value*/ + n[0] && _(n) + ); + return { + c() { + e = d("div"), l && l.c(), f(e, "class", "container svelte-1sgcyba"), a( + e, + "table", + /*type*/ + n[1] === "table" + ), a( + e, + "gallery", + /*type*/ + n[1] === "gallery" + ), a( + e, + "selected", + /*selected*/ + n[2] + ), a( + e, + "border", + /*value*/ + n[0] + ); + }, + m(t, i) { + g(t, e, i), l && l.m(e, null); + }, + p(t, [i]) { + /*value*/ + t[0] ? l ? l.p(t, i) : (l = _(t), l.c(), l.m(e, null)) : l && (l.d(1), l = null), i & /*type*/ + 2 && a( + e, + "table", + /*type*/ + t[1] === "table" + ), i & /*type*/ + 2 && a( + e, + "gallery", + /*type*/ + t[1] === "gallery" + ), i & /*selected*/ + 4 && a( + e, + "selected", + /*selected*/ + t[2] + ), i & /*value*/ + 1 && a( + e, + "border", + /*value*/ + t[0] + ); + }, + i: c, + o: c, + d(t) { + t && o(e), l && l.d(); + } + }; +} +function h(n, e, l) { + let { value: t } = e, { type: i } = e, { selected: r = !1 } = e; + return n.$$set = (s) => { + "value" in s && l(0, t = s.value), "type" in s && l(1, i = s.type), "selected" in s && l(2, r = s.selected); + }, [t, i, r]; +} +class k extends m { + constructor(e) { + super(), b(this, e, h, y, v, { value: 0, type: 1, selected: 2 }); + } +} +export { + k as default +}; diff --git a/src/backend/gradio_image_annotation/templates/example/style.css b/src/backend/gradio_image_annotation/templates/example/style.css new file mode 100644 index 0000000000000000000000000000000000000000..a4bcc23d7feb9ec01bd5246c2aa7a7265fa9fe62 --- /dev/null +++ b/src/backend/gradio_image_annotation/templates/example/style.css @@ -0,0 +1 @@ +.container.svelte-1sgcyba img{width:100%;height:100%}.container.selected.svelte-1sgcyba{border-color:var(--border-color-accent)}.border.table.svelte-1sgcyba{border:2px solid var(--border-color-primary)}.container.table.svelte-1sgcyba{margin:0 auto;border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-1sgcyba{width:var(--size-20);max-width:var(--size-20);object-fit:cover} diff --git a/src/demo/__init__.py b/src/demo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/demo/app.py b/src/demo/app.py new file mode 100644 index 0000000000000000000000000000000000000000..18f198039ae98118de525a4457135ca0f038f969 --- /dev/null +++ b/src/demo/app.py @@ -0,0 +1,95 @@ +import gradio as gr +from gradio_image_annotation import image_annotator + + +example_annotation = { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "label": "Vehicle", + "color": (255, 0, 0) + }, + { + "xmin": 360, + "ymin": 615, + "xmax": 386, + "ymax": 702, + "label": "Person", + "color": (0, 255, 0) + } + ] +} + +examples_crop = [ + { + "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png", + "boxes": [ + { + "xmin": 30, + "ymin": 70, + "xmax": 530, + "ymax": 500, + "color": (100, 200, 255), + } + ], + }, + { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "color": (255, 0, 0), + }, + ], + }, +] + + +def crop(annotations): + if annotations["boxes"]: + box = annotations["boxes"][0] + return annotations["image"][ + box["ymin"]:box["ymax"], + box["xmin"]:box["xmax"] + ] + return None + + +def get_boxes_json(annotations): + return annotations["boxes"] + + +with gr.Blocks() as demo: + with gr.Tab("Object annotation", id="tab_object_annotation"): + annotator = image_annotator( + example_annotation, + label_list=["Person", "Vehicle"], + label_colors=[(0, 255, 0), (255, 0, 0)], + ) + button_get = gr.Button("Get bounding boxes") + json_boxes = gr.JSON() + button_get.click(get_boxes_json, annotator, json_boxes) + + with gr.Tab("Crop", id="tab_crop"): + with gr.Row(): + annotator_crop = image_annotator( + examples_crop[0], + image_type="numpy", + disable_edit_boxes=True, + single_box=True, + ) + image_crop = gr.Image() + button_crop = gr.Button("Crop") + button_crop.click(crop, annotator_crop, image_crop) + + gr.Examples(examples_crop, annotator_crop) + +if __name__ == "__main__": + demo.launch() diff --git a/src/demo/css.css b/src/demo/css.css new file mode 100644 index 0000000000000000000000000000000000000000..f7256be42f9884d89b499b0f5a6cfcbed3d54c80 --- /dev/null +++ b/src/demo/css.css @@ -0,0 +1,157 @@ +html { + font-family: Inter; + font-size: 16px; + font-weight: 400; + line-height: 1.5; + -webkit-text-size-adjust: 100%; + background: #fff; + color: #323232; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-rendering: optimizeLegibility; +} + +:root { + --space: 1; + --vspace: calc(var(--space) * 1rem); + --vspace-0: calc(3 * var(--space) * 1rem); + --vspace-1: calc(2 * var(--space) * 1rem); + --vspace-2: calc(1.5 * var(--space) * 1rem); + --vspace-3: calc(0.5 * var(--space) * 1rem); +} + +.app { + max-width: 748px !important; +} + +.prose p { + margin: var(--vspace) 0; + line-height: var(--vspace * 2); + font-size: 1rem; +} + +code { + font-family: "Inconsolata", sans-serif; + font-size: 16px; +} + +h1, +h1 code { + font-weight: 400; + line-height: calc(2.5 / var(--space) * var(--vspace)); +} + +h1 code { + background: none; + border: none; + letter-spacing: 0.05em; + padding-bottom: 5px; + position: relative; + padding: 0; +} + +h2 { + margin: var(--vspace-1) 0 var(--vspace-2) 0; + line-height: 1em; +} + +h3, +h3 code { + margin: var(--vspace-1) 0 var(--vspace-2) 0; + line-height: 1em; +} + +h4, +h5, +h6 { + margin: var(--vspace-3) 0 var(--vspace-3) 0; + line-height: var(--vspace); +} + +.bigtitle, +h1, +h1 code { + font-size: calc(8px * 4.5); + word-break: break-word; +} + +.title, +h2, +h2 code { + font-size: calc(8px * 3.375); + font-weight: lighter; + word-break: break-word; + border: none; + background: none; +} + +.subheading1, +h3, +h3 code { + font-size: calc(8px * 1.8); + font-weight: 600; + border: none; + background: none; + letter-spacing: 0.1em; + text-transform: uppercase; +} + +h2 code { + padding: 0; + position: relative; + letter-spacing: 0.05em; +} + +blockquote { + font-size: calc(8px * 1.1667); + font-style: italic; + line-height: calc(1.1667 * var(--vspace)); + margin: var(--vspace-2) var(--vspace-2); +} + +.subheading2, +h4 { + font-size: calc(8px * 1.4292); + text-transform: uppercase; + font-weight: 600; +} + +.subheading3, +h5 { + font-size: calc(8px * 1.2917); + line-height: calc(1.2917 * var(--vspace)); + + font-weight: lighter; + text-transform: uppercase; + letter-spacing: 0.15em; +} + +h6 { + font-size: calc(8px * 1.1667); + font-size: 1.1667em; + font-weight: normal; + font-style: italic; + font-family: "le-monde-livre-classic-byol", serif !important; + letter-spacing: 0px !important; +} + +#start .md > *:first-child { + margin-top: 0; +} + +h2 + h3 { + margin-top: 0; +} + +.md hr { + border: none; + border-top: 1px solid var(--block-border-color); + margin: var(--vspace-2) 0 var(--vspace-2) 0; +} +.prose ul { + margin: var(--vspace-2) 0 var(--vspace-1) 0; +} + +.gap { + gap: 0; +} diff --git a/src/demo/space.py b/src/demo/space.py new file mode 100644 index 0000000000000000000000000000000000000000..482221e3c842d584781de83e19c1554e43ed9ef2 --- /dev/null +++ b/src/demo/space.py @@ -0,0 +1,217 @@ + +import gradio as gr +from app import demo as app +import os + +_docs = {'image_annotator': {'description': 'Creates a component to annotate images with bounding boxes. The bounding boxes can be created and edited by the user or be passed by code.\nIt is also possible to predefine a set of valid classes and colors.', 'members': {'__init__': {'value': {'type': 'dict | None', 'default': 'None', 'description': "A dict or None. The dictionary must contain a key 'image' with either an URL to an image, a numpy image or a PIL image. Optionally it may contain a key 'boxes' with a list of boxes. Each box must be a dict wit the keys: 'xmin', 'ymin', 'xmax' and 'ymax' with the absolute image coordinates of the box. Optionally can also include the keys 'label' and 'color' describing the label and color of the box. Color must be a tuple of RGB values (e.g. `(255,255,255)`)."}, 'boxes_alpha': {'type': 'float | None', 'default': 'None', 'description': 'Opacity of the bounding boxes 0 and 1.'}, 'label_list': {'type': 'list[str] | None', 'default': 'None', 'description': 'List of valid labels.'}, 'label_colors': {'type': 'list[str] | None', 'default': 'None', 'description': 'Optional list of colors for each label when `label_list` is used. Colors must be a tuple of RGB values (e.g. `(255,255,255)`).'}, 'box_min_size': {'type': 'int | None', 'default': 'None', 'description': 'Minimum valid bounding box size.'}, 'handle_size': {'type': 'int | None', 'default': 'None', 'description': 'Size of the bounding box resize handles.'}, 'box_thickness': {'type': 'int | None', 'default': 'None', 'description': 'Thickness of the bounding box outline.'}, 'box_selected_thickness': {'type': 'int | None', 'default': 'None', 'description': 'Thickness of the bounding box outline when it is selected.'}, 'disable_edit_boxes': {'type': 'bool | None', 'default': 'None', 'description': 'Disables the ability to set and edit the label and color of the boxes.'}, 'single_box': {'type': 'bool', 'default': 'False', 'description': 'If True, at most one box can be drawn.'}, 'height': {'type': 'int | str | None', 'default': 'None', 'description': 'The height of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.'}, 'width': {'type': 'int | str | None', 'default': 'None', 'description': 'The width of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.'}, 'image_mode': {'type': '"1"\n | "L"\n | "P"\n | "RGB"\n | "RGBA"\n | "CMYK"\n | "YCbCr"\n | "LAB"\n | "HSV"\n | "I"\n | "F"', 'default': '"RGB"', 'description': '"RGB" if color, or "L" if black and white. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html for other supported image modes and their meaning.'}, 'sources': {'type': 'list["upload" | "webcam" | "clipboard"] | None', 'default': '["upload", "webcam", "clipboard"]', 'description': 'List of sources for the image. "upload" creates a box where user can drop an image file, "webcam" allows user to take snapshot from their webcam, "clipboard" allows users to paste an image from the clipboard. If None, defaults to ["upload", "webcam", "clipboard"].'}, 'image_type': {'type': '"numpy" | "pil" | "filepath"', 'default': '"numpy"', 'description': 'The format the image is converted before being passed into the prediction function. "numpy" converts the image to a numpy array with shape (height, width, 3) and values from 0 to 255, "pil" converts the image to a PIL image object, "filepath" passes a str path to a temporary file containing the image. If the image is SVG, the `type` is ignored and the filepath of the SVG is returned.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': '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.'}, 'interactive': {'type': 'bool | None', 'default': 'True', 'description': 'if True, will allow users to upload and annotate an image; if False, can only be used to display annotated images.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': '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': {'type': 'list[str] | str | None', 'default': 'None', 'description': '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.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'show_download_button': {'type': 'bool', 'default': 'True', 'description': 'If True, will show a button to download the image.'}, 'show_share_button': {'type': 'bool | None', 'default': 'None', 'description': 'If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.'}, 'show_clear_button': {'type': 'bool | None', 'default': 'True', 'description': 'If True, will show a button to clear the current image.'}, 'show_remove_button': {'type': 'bool | None', 'default': 'None', 'description': 'If True, will show a button to remove the selected bounding box.'}, 'handles_cursor': {'type': 'bool | None', 'default': 'True', 'description': 'If True, the cursor will change when hovering over box handles in drag mode. Can be CPU-intensive.'}}, 'postprocess': {'value': {'type': 'dict | None', 'description': 'A dict with an image and an optional list of boxes or None.'}}, 'preprocess': {'return': {'type': 'dict | None', 'description': 'A dict with the image and boxes or None.'}, 'value': None}}, 'events': {'clear': {'type': None, 'default': None, 'description': 'This listener is triggered when the user clears the image_annotator using the clear button for the component.'}, 'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the image_annotator changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'upload': {'type': None, 'default': None, 'description': 'This listener is triggered when the user uploads a file into the image_annotator.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'image_annotator': []}}} + +abs_path = os.path.join(os.path.dirname(__file__), "css.css") + +with gr.Blocks( + css=abs_path, + theme=gr.themes.Default( + font_mono=[ + gr.themes.GoogleFont("Inconsolata"), + "monospace", + ], + ), +) as demo: + gr.Markdown( +""" +# `gradio_image_annotation` + +
+PyPI - Version +
+ +A Gradio component that can be used to annotate images with bounding boxes. +""", elem_classes=["md-custom"], header_links=True) + app.render() + gr.Markdown( +""" +## Installation + +```bash +pip install gradio_image_annotation +``` + +## Usage + +```python +import gradio as gr +from gradio_image_annotation import image_annotator + + +example_annotation = { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "label": "Vehicle", + "color": (255, 0, 0) + }, + { + "xmin": 360, + "ymin": 615, + "xmax": 386, + "ymax": 702, + "label": "Person", + "color": (0, 255, 0) + } + ] +} + +examples_crop = [ + { + "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png", + "boxes": [ + { + "xmin": 30, + "ymin": 70, + "xmax": 530, + "ymax": 500, + "color": (100, 200, 255), + } + ], + }, + { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "color": (255, 0, 0), + }, + ], + }, +] + + +def crop(annotations): + if annotations["boxes"]: + box = annotations["boxes"][0] + return annotations["image"][ + box["ymin"]:box["ymax"], + box["xmin"]:box["xmax"] + ] + return None + + +def get_boxes_json(annotations): + return annotations["boxes"] + + +with gr.Blocks() as demo: + with gr.Tab("Object annotation", id="tab_object_annotation"): + annotator = image_annotator( + example_annotation, + label_list=["Person", "Vehicle"], + label_colors=[(0, 255, 0), (255, 0, 0)], + ) + button_get = gr.Button("Get bounding boxes") + json_boxes = gr.JSON() + button_get.click(get_boxes_json, annotator, json_boxes) + + with gr.Tab("Crop", id="tab_crop"): + with gr.Row(): + annotator_crop = image_annotator( + examples_crop[0], + image_type="numpy", + disable_edit_boxes=True, + single_box=True, + ) + image_crop = gr.Image() + button_crop = gr.Button("Crop") + button_crop.click(crop, annotator_crop, image_crop) + + gr.Examples(examples_crop, annotator_crop) + +if __name__ == "__main__": + demo.launch() + +``` +""", elem_classes=["md-custom"], header_links=True) + + + gr.Markdown(""" +## `image_annotator` + +### Initialization +""", elem_classes=["md-custom"], header_links=True) + + gr.ParamViewer(value=_docs["image_annotator"]["members"]["__init__"], linkify=[]) + + + gr.Markdown("### Events") + gr.ParamViewer(value=_docs["image_annotator"]["events"], linkify=['Event']) + + + + + gr.Markdown(""" + +### User function + +The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both). + +- When used as an Input, the component only impacts the input signature of the user function. +- When used as an output, the component only impacts the return signature of the user function. + +The code snippet below is accurate in cases where the component is used as both an input and an output. + +- **As input:** Is passed, a dict with the image and boxes or None. +- **As output:** Should return, a dict with an image and an optional list of boxes or None. + + ```python +def predict( + value: dict | None +) -> dict | None: + return value +``` +""", elem_classes=["md-custom", "image_annotator-user-fn"], header_links=True) + + + + + demo.load(None, js=r"""function() { + const refs = {}; + const user_fn_refs = { + image_annotator: [], }; + requestAnimationFrame(() => { + + Object.entries(user_fn_refs).forEach(([key, refs]) => { + if (refs.length > 0) { + const el = document.querySelector(`.${key}-user-fn`); + if (!el) return; + refs.forEach(ref => { + el.innerHTML = el.innerHTML.replace( + new RegExp("\\b"+ref+"\\b", "g"), + `${ref}` + ); + }) + } + }) + + Object.entries(refs).forEach(([key, refs]) => { + if (refs.length > 0) { + const el = document.querySelector(`.${key}`); + if (!el) return; + refs.forEach(ref => { + el.innerHTML = el.innerHTML.replace( + new RegExp("\\b"+ref+"\\b", "g"), + `${ref}` + ); + }) + } + }) + }) +} + +""") + +demo.launch() diff --git a/src/frontend/Example.svelte b/src/frontend/Example.svelte new file mode 100644 index 0000000000000000000000000000000000000000..603c1b0752437a045f25fa541c642c4404ae6644 --- /dev/null +++ b/src/frontend/Example.svelte @@ -0,0 +1,48 @@ + + +
+ {#if value} + + {/if} +
+ + diff --git a/src/frontend/Index.svelte b/src/frontend/Index.svelte new file mode 100644 index 0000000000000000000000000000000000000000..7b01cc539b242d1362f0db2b8c6153a10d7bef8d --- /dev/null +++ b/src/frontend/Index.svelte @@ -0,0 +1,139 @@ + + + + + + + + + + gradio.dispatch("change")} + selectable={_selectable} + {root} + {sources} + {interactive} + showDownloadButton={show_download_button} + showShareButton={show_share_button} + showClearButton={show_clear_button} + i18n={gradio.i18n} + boxesAlpha={boxes_alpha} + height={height} + width={width} + labelList={label_list} + labelColors={label_colors} + boxMinSize={box_min_size} + on:edit={() => gradio.dispatch("edit")} + on:clear={() => { + gradio.dispatch("clear"); + }} + on:drag={({ detail }) => (dragging = detail)} + on:upload={() => gradio.dispatch("upload")} + on:select={({ detail }) => gradio.dispatch("select", detail)} + on:share={({ detail }) => gradio.dispatch("share", detail)} + on:error={({ detail }) => { + loading_status = loading_status || {}; + loading_status.status = "error"; + gradio.dispatch("error", detail); + }} + {label} + {show_label} + max_file_size={gradio.max_file_size} + cli_upload={gradio.client.upload} + stream_handler={gradio.client.stream} + handleSize={handle_size} + boxThickness={box_thickness} + boxSelectedThickness={box_selected_thickness} + disableEditBoxes={disable_edit_boxes} + singleBox={single_box} + showRemoveButton={show_remove_button} + handlesCursor={handles_cursor} + > + {#if active_source === "upload"} + + {:else if active_source === "clipboard"} + + {:else} + + {/if} + + diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..9a8027d9c33e9bb4aa0129e1d0faa86fee5ac0d4 --- /dev/null +++ b/src/frontend/package-lock.json @@ -0,0 +1,5450 @@ +{ + "name": "gradio_image_annotator", + "version": "0.11.9", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "gradio_image_annotator", + "version": "0.11.9", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "0.7.4", + "@gradio/button": "^0.2.24", + "@gradio/client": "1.1.0", + "@gradio/colorpicker": "^0.2.11", + "@gradio/icons": "0.4.1", + "@gradio/image": "0.11.9", + "@gradio/statustracker": "0.6.0", + "@gradio/upload": "0.11.1", + "@gradio/utils": "0.4.2", + "@gradio/wasm": "0.10.1", + "cropperjs": "^1.5.12", + "lazy-brush": "^1.0.1", + "resize-observer-polyfill": "^1.5.1" + }, + "devDependencies": { + "@gradio/preview": "0.9.1" + } + }, + "node_modules/@adobe/css-tools": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.3.tgz", + "integrity": "sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", + "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "dev": true, + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bundled-es-modules/cookie": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.0.tgz", + "integrity": "sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==", + "license": "ISC", + "dependencies": { + "cookie": "^0.5.0" + } + }, + "node_modules/@bundled-es-modules/statuses": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz", + "integrity": "sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==", + "license": "ISC", + "dependencies": { + "statuses": "^2.0.1" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", + "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", + "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", + "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", + "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", + "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", + "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", + "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", + "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", + "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", + "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", + "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", + "integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", + "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", + "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", + "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", + "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", + "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", + "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", + "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", + "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", + "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", + "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", + "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@formatjs/ecma402-abstract": { + "version": "1.11.4", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.4.tgz", + "integrity": "sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==", + "license": "MIT", + "dependencies": { + "@formatjs/intl-localematcher": "0.2.25", + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/fast-memoize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-1.2.1.tgz", + "integrity": "sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.0.tgz", + "integrity": "sha512-Qxv/lmCN6hKpBSss2uQ8IROVnta2r9jd3ymUEIjm2UyIkUCHVcbUVRGL/KS/wv7876edvsPe+hjHVJ4z8YuVaw==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/icu-skeleton-parser": "1.3.6", + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.6.tgz", + "integrity": "sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "tslib": "^2.1.0" + } + }, + "node_modules/@formatjs/intl-localematcher": { + "version": "0.2.25", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.25.tgz", + "integrity": "sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@gradio/atoms": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@gradio/atoms/-/atoms-0.7.4.tgz", + "integrity": "sha512-tBla0kYmNjh+h1Azbi+sL5RteQ2mMl2GUWToMfbUirQY9P8CrAWBLVvSWMa8dkZ8AlJUZ11tfOzTHH3dSeaWIw==", + "license": "ISC", + "dependencies": { + "@gradio/icons": "^0.4.1", + "@gradio/utils": "^0.4.2" + } + }, + "node_modules/@gradio/button": { + "version": "0.2.45", + "resolved": "https://registry.npmjs.org/@gradio/button/-/button-0.2.45.tgz", + "integrity": "sha512-zjVqI/bkbR+iRhoAtCLyFRh0WF/OOqmm2mp0FoUiA+q/Hwsig2UUdke9WpdSeYGIFI6hFf3a6/1XgJu/HCUNwg==", + "license": "ISC", + "dependencies": { + "@gradio/client": "^1.2.1", + "@gradio/upload": "^0.11.4", + "@gradio/utils": "^0.5.0" + } + }, + "node_modules/@gradio/button/node_modules/@gradio/atoms": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@gradio/atoms/-/atoms-0.7.5.tgz", + "integrity": "sha512-/0USkMS8aQb77f0N1VA71v//LdRrPfkG8N8MoYo8RUb8BeWrF+CM/g1yMk3hh/4rRX5oUmhSDGjhnCjJgyc5sw==", + "license": "ISC", + "dependencies": { + "@gradio/icons": "^0.5.0", + "@gradio/utils": "^0.5.0" + } + }, + "node_modules/@gradio/button/node_modules/@gradio/client": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@gradio/client/-/client-1.2.1.tgz", + "integrity": "sha512-awR47yM0xRHtsMGftEajjyDYyzU3ONbKix6FQh8C7xIvkoGy8I3Vi8u0ZkOa9p+7Xjft5rXyrHa4WxNESPMbqQ==", + "license": "ISC", + "dependencies": { + "@types/eventsource": "^1.1.15", + "bufferutil": "^4.0.7", + "eventsource": "^2.0.2", + "fetch-event-stream": "^0.1.5", + "msw": "^2.2.1", + "semiver": "^1.1.0", + "textlinestream": "^1.1.1", + "typescript": "^5.0.0", + "ws": "^8.13.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@gradio/button/node_modules/@gradio/icons": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@gradio/icons/-/icons-0.5.0.tgz", + "integrity": "sha512-EPyRfuHuZPDPszbyjbyDqptCV8wL9dSoVRLImXa+KwOMweUhhsa+kjNsQ03pG7mHTq4au+VKIn618kU3aPS1Fg==", + "license": "ISC" + }, + "node_modules/@gradio/button/node_modules/@gradio/upload": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/@gradio/upload/-/upload-0.11.4.tgz", + "integrity": "sha512-YRy430D0fK7liLl6oHWEOi6wrs9PL9+Nfo3egRrWctvYWkh6VcAlXLbkNcexnOYLEaokj1JhN0T8pUsVmcV9tw==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.7.5", + "@gradio/client": "^1.2.1", + "@gradio/icons": "^0.5.0", + "@gradio/utils": "^0.5.0", + "@gradio/wasm": "^0.11.0" + } + }, + "node_modules/@gradio/button/node_modules/@gradio/utils": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.5.0.tgz", + "integrity": "sha512-zsMkrkR98G1CvCXL6S5CcusEsxumXhY9lcsGd8GpyRT0n847uqfVfp1O2LChvWUmCbMd7SVILw1RZAk2zMlnrg==", + "license": "ISC", + "dependencies": { + "@gradio/theme": "^0.2.3", + "svelte-i18n": "^3.6.0" + } + }, + "node_modules/@gradio/button/node_modules/@gradio/wasm": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@gradio/wasm/-/wasm-0.11.0.tgz", + "integrity": "sha512-t6DNq0JEIHZHYNC/Nwrf/hsvpIloxPb/ZaQWKZ3LNrmwOOHAWkQ0vMDyJdyAk2bF1cNcZOEVpXhhqFQQTeqmoQ==", + "license": "ISC", + "dependencies": { + "@types/path-browserify": "^1.0.0", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@gradio/client": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@gradio/client/-/client-1.1.0.tgz", + "integrity": "sha512-OOulNvRqip9gDCmvNiMlZw8ucwYno55MsxaOpwdiK7crc3nTQC1nFQ4wm5KdbjLrk3RrsCO3RkseAXad5Y4GkQ==", + "license": "ISC", + "dependencies": { + "@types/eventsource": "^1.1.15", + "bufferutil": "^4.0.7", + "eventsource": "^2.0.2", + "fetch-event-stream": "^0.1.5", + "msw": "^2.2.1", + "semiver": "^1.1.0", + "textlinestream": "^1.1.1", + "typescript": "^5.0.0", + "ws": "^8.13.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@gradio/colorpicker": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/@gradio/colorpicker/-/colorpicker-0.2.15.tgz", + "integrity": "sha512-FaTfdhpcErazvXb31fFhvhoYxY/JfUJZnFqWQ6yDxTxVN8TiF4HWNN/lqBIL6eDm2A1ub2s29PV7M8f1pBcJqg==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.7.0", + "@gradio/statustracker": "^0.4.12", + "@gradio/utils": "^0.3.2" + } + }, + "node_modules/@gradio/colorpicker/node_modules/@gradio/statustracker": { + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/@gradio/statustracker/-/statustracker-0.4.12.tgz", + "integrity": "sha512-wQxbJANz314H0VUGlW71KApqI/iBF4znIBbj2XFyPICB43LZXyO2X9wKSN1JcbIm3ArSQ3qC1PNkbDtSutIhFA==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.7.0", + "@gradio/column": "^0.1.0", + "@gradio/icons": "^0.4.0", + "@gradio/utils": "^0.3.2" + } + }, + "node_modules/@gradio/colorpicker/node_modules/@gradio/utils": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.3.2.tgz", + "integrity": "sha512-jhBOMbNprctFEo+h394cfaE5M/EuF/0puJaXuH5P8dGXSoRmxwBmhrPYwG3MoMOwCNMB52zZlWrEGZ7VfPmBLw==", + "license": "ISC", + "dependencies": { + "@gradio/theme": "^0.2.2", + "svelte-i18n": "^3.6.0" + } + }, + "node_modules/@gradio/column": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@gradio/column/-/column-0.1.2.tgz", + "integrity": "sha512-WW+5tpwokuAxjS1Gt8/nLJmgRvBdYAUWq7ECXxU0WshA8+9mglTCj+eyyRK43bZQZcQrDBSCE7kh5bujfj7kKw==", + "license": "ISC" + }, + "node_modules/@gradio/icons": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@gradio/icons/-/icons-0.4.1.tgz", + "integrity": "sha512-gC6f6UENPsvoN189eqmzDpJzWBrJe4K6vmL6Tdzifq/iPRFh/zIwovXjdudpnJkTWwTci7EP/C9QtdEkTMlMvA==", + "license": "ISC" + }, + "node_modules/@gradio/image": { + "version": "0.11.9", + "resolved": "https://registry.npmjs.org/@gradio/image/-/image-0.11.9.tgz", + "integrity": "sha512-J04COMcHHQfYA4YGUV8M+VBC9Uqwjlci1ykj33gv1RftMqV3inx67FDg130C7+fPXUcc9e98bgATSb0vFVi0Mg==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.7.4", + "@gradio/client": "^1.1.0", + "@gradio/icons": "^0.4.1", + "@gradio/statustracker": "^0.6.0", + "@gradio/upload": "^0.11.1", + "@gradio/utils": "^0.4.2", + "@gradio/wasm": "^0.10.1", + "cropperjs": "^1.5.12", + "lazy-brush": "^1.0.1", + "resize-observer-polyfill": "^1.5.1" + } + }, + "node_modules/@gradio/preview": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@gradio/preview/-/preview-0.9.1.tgz", + "integrity": "sha512-XTtuYNkCmYE8B3t3K1WeUxQreg0EYUzeMIO1ZoXxaEdY6ZZOd7TPQ5rGHMH4daGo0yNCfCByAmmWWJ076oifzg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@originjs/vite-plugin-commonjs": "^1.0.3", + "@rollup/plugin-sucrase": "^5.0.1", + "@sveltejs/vite-plugin-svelte": "^3.1.0", + "@types/which": "^3.0.0", + "coffeescript": "^2.7.0", + "lightningcss": "^1.21.7", + "pug": "^3.0.2", + "sass": "^1.66.1", + "stylus": "^0.63.0", + "sucrase": "^3.34.0", + "sugarss": "^4.0.1", + "svelte-hmr": "^0.16.0", + "svelte-preprocess": "^5.0.4", + "typescript": "^5.0.0", + "vite": "^5.2.9", + "which": "4.0.0", + "yootils": "^0.3.1" + } + }, + "node_modules/@gradio/preview/node_modules/sax": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==", + "dev": true, + "license": "ISC" + }, + "node_modules/@gradio/preview/node_modules/stylus": { + "version": "0.63.0", + "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.63.0.tgz", + "integrity": "sha512-OMlgrTCPzE/ibtRMoeLVhOY0RcNuNWh0rhAVqeKnk/QwcuUKQbnqhZ1kg2vzD8VU/6h3FoPTq4RJPHgLBvX6Bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@adobe/css-tools": "~4.3.3", + "debug": "^4.3.2", + "glob": "^7.1.6", + "sax": "~1.3.0", + "source-map": "^0.7.3" + }, + "bin": { + "stylus": "bin/stylus" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://opencollective.com/stylus" + } + }, + "node_modules/@gradio/statustracker": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@gradio/statustracker/-/statustracker-0.6.0.tgz", + "integrity": "sha512-Y89/ieo2CqhRgJM9U0Fisi1qMb86ul3BC4C2SvGAQ7d7BXN9KQqb9GsbhaqmAz9sO9xDv7zhnG63OH59MXXPMw==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.7.4", + "@gradio/icons": "^0.4.1", + "@gradio/utils": "^0.4.2" + } + }, + "node_modules/@gradio/theme": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@gradio/theme/-/theme-0.2.3.tgz", + "integrity": "sha512-JUgKTscUD0R8qktHNUzRIbfvB6HWzbRYP1vct1FmWWaXHJkyc/Ib+gp1ccKRIKutlLpF7J4gbo8gfOhSw43nHg==", + "license": "ISC" + }, + "node_modules/@gradio/upload": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@gradio/upload/-/upload-0.11.1.tgz", + "integrity": "sha512-5vPmMbN9/mnd+qymd1gvnlSC+U7vSsvS8iQlDdGCxx9925DpRKBCOI/npdnbam9NNE/yUTIWn0vAy2kpjVOJ2A==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.7.4", + "@gradio/client": "^1.1.0", + "@gradio/icons": "^0.4.1", + "@gradio/upload": "^0.11.1", + "@gradio/utils": "^0.4.2", + "@gradio/wasm": "^0.10.1" + } + }, + "node_modules/@gradio/utils": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.4.2.tgz", + "integrity": "sha512-n2aQWhZb4azPzx/yknm8SLDsAiXdeMrYQIFbHGe5aR34jnGcUkDCVheO8i+XliBEKRipbXgcDC4J0wbW93fKCQ==", + "license": "ISC", + "dependencies": { + "@gradio/theme": "^0.2.3", + "svelte-i18n": "^3.6.0" + } + }, + "node_modules/@gradio/wasm": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@gradio/wasm/-/wasm-0.10.1.tgz", + "integrity": "sha512-FC+apnc9zMSVS2NUouwS7imoS+o7Vhe+P3mJrTSgWksNsFDauWYkSyp2ZajqGPgexg8wRNCUKe7yteTz8gypbg==", + "license": "ISC", + "dependencies": { + "@types/path-browserify": "^1.0.0", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@inquirer/confirm": { + "version": "3.1.12", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-3.1.12.tgz", + "integrity": "sha512-s5Sod79QsBBi5Qm7zxCq9DcAD0i7WRcjd/LzsiIAWqWZKW4+OJTGrCgVSLGIHTulwbZgdxM4AAxpCXe86hv4/Q==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^9.0.0", + "@inquirer/type": "^1.4.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/core": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-9.0.0.tgz", + "integrity": "sha512-y3q+fkCTGmvwk9Wf6yZlI3QGlLXbEm5M7Y7Eh8abaUbv+ffvmw2aB4FxSUrWaoaozwvEJSG60raHbCaUorXEzA==", + "license": "MIT", + "dependencies": { + "@inquirer/figures": "^1.0.3", + "@inquirer/type": "^1.4.0", + "@types/mute-stream": "^0.0.4", + "@types/node": "^20.14.9", + "@types/wrap-ansi": "^3.0.0", + "ansi-escapes": "^4.3.2", + "cli-spinners": "^2.9.2", + "cli-width": "^4.1.0", + "mute-stream": "^1.0.0", + "signal-exit": "^4.1.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0", + "yoctocolors-cjs": "^2.1.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/figures": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.3.tgz", + "integrity": "sha512-ErXXzENMH5pJt5/ssXV0DfWUZqly8nGzf0UcBV9xTnP+KyffE2mqyxIMBrZ8ijQck2nU0TQm40EQB53YreyWHw==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.4.0.tgz", + "integrity": "sha512-AjOqykVyjdJQvtfkNDGUyMYGF8xN50VUxftCQWsOyIo4DFRLr6VQhW0VItGI1JIyQGCGgIpKa7hMMwNhZb4OIw==", + "license": "MIT", + "dependencies": { + "mute-stream": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@mswjs/cookies": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-1.1.1.tgz", + "integrity": "sha512-W68qOHEjx1iD+4VjQudlx26CPIoxmIAtK4ZCexU0/UJBG6jYhcuyzKJx+Iw8uhBIGd9eba64XgWVgo20it1qwA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@mswjs/interceptors": { + "version": "0.29.1", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.29.1.tgz", + "integrity": "sha512-3rDakgJZ77+RiQUuSK69t1F0m8BQKA8Vh5DCS5V0DWvNY67zob2JhhQrhCO0AKLGINTRSFd1tBaHcJTkhefoSw==", + "license": "MIT", + "dependencies": { + "@open-draft/deferred-promise": "^2.2.0", + "@open-draft/logger": "^0.3.0", + "@open-draft/until": "^2.0.0", + "is-node-process": "^1.2.0", + "outvariant": "^1.2.1", + "strict-event-emitter": "^0.5.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@open-draft/deferred-promise": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", + "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==", + "license": "MIT" + }, + "node_modules/@open-draft/logger": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@open-draft/logger/-/logger-0.3.0.tgz", + "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==", + "license": "MIT", + "dependencies": { + "is-node-process": "^1.2.0", + "outvariant": "^1.4.0" + } + }, + "node_modules/@open-draft/until": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-2.1.0.tgz", + "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==", + "license": "MIT" + }, + "node_modules/@originjs/vite-plugin-commonjs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@originjs/vite-plugin-commonjs/-/vite-plugin-commonjs-1.0.3.tgz", + "integrity": "sha512-KuEXeGPptM2lyxdIEJ4R11+5ztipHoE7hy8ClZt3PYaOVQ/pyngd2alaSrPnwyFeOW1UagRBaQ752aA1dTMdOQ==", + "dev": true, + "license": "MulanPSL2", + "dependencies": { + "esbuild": "^0.14.14" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@rollup/plugin-sucrase": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-sucrase/-/plugin-sucrase-5.0.2.tgz", + "integrity": "sha512-4MhIVH9Dy2Hwose1/x5QMs0XF7yn9jDd/yozHqzdIrMWIolgFpGnrnVhQkqTaK1RALY/fpyrEKmwH/04vr1THA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "sucrase": "^3.27.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.53.1||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", + "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", + "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", + "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", + "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", + "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", + "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", + "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", + "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", + "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", + "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", + "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", + "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", + "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", + "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", + "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", + "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sveltejs/vite-plugin-svelte": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-3.1.1.tgz", + "integrity": "sha512-rimpFEAboBBHIlzISibg94iP09k/KYdHgVhJlcsTfn7KMBhc70jFX/GRWkRdFCc2fdnk+4+Bdfej23cMDnJS6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sveltejs/vite-plugin-svelte-inspector": "^2.1.0", + "debug": "^4.3.4", + "deepmerge": "^4.3.1", + "kleur": "^4.1.5", + "magic-string": "^0.30.10", + "svelte-hmr": "^0.16.0", + "vitefu": "^0.2.5" + }, + "engines": { + "node": "^18.0.0 || >=20" + }, + "peerDependencies": { + "svelte": "^4.0.0 || ^5.0.0-next.0", + "vite": "^5.0.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte-inspector": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-2.1.0.tgz", + "integrity": "sha512-9QX28IymvBlSCqsCll5t0kQVxipsfhFFL+L2t3nTWfXnddYwxBuAEtTtlaVQpRz9c37BhJjltSeY4AJSC03SSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.0.0 || >=20" + }, + "peerDependencies": { + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "svelte": "^4.0.0 || ^5.0.0-next.0", + "vite": "^5.0.0" + } + }, + "node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "license": "MIT" + }, + "node_modules/@types/eventsource": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@types/eventsource/-/eventsource-1.1.15.tgz", + "integrity": "sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==", + "license": "MIT" + }, + "node_modules/@types/mute-stream": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz", + "integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/path-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/path-browserify/-/path-browserify-1.0.2.tgz", + "integrity": "sha512-ZkC5IUqqIFPXx3ASTTybTzmQdwHwe2C0u3eL75ldQ6T9E9IWFJodn6hIfbZGab73DfyiHN4Xw15gNxUq2FbvBA==", + "license": "MIT" + }, + "node_modules/@types/pug": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.10.tgz", + "integrity": "sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/statuses": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.5.tgz", + "integrity": "sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==", + "license": "MIT" + }, + "node_modules/@types/which": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/which/-/which-3.0.4.tgz", + "integrity": "sha512-liyfuo/106JdlgSchJzXEQCVArk0CvevqPote8F8HgWgJ3dRCcTHgJIsLDuee0kxk/mhbInzIZk3QWSZJ8R+2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/wrap-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz", + "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==", + "license": "MIT" + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/assert-never": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/assert-never/-/assert-never-1.2.1.tgz", + "integrity": "sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw==", + "dev": true, + "license": "MIT" + }, + "node_modules/atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "optional": true, + "peer": true, + "bin": { + "atob": "bin/atob.js" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/axobject-query": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz", + "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/babel-walk": { + "version": "3.0.0-canary-5", + "resolved": "https://registry.npmjs.org/babel-walk/-/babel-walk-3.0.0-canary-5.tgz", + "integrity": "sha512-GAwkz0AihzY5bkwIY5QDR+LvsRQgB/B+1foMPvi0FZPMl5fjD7ICiznUiBdLYMH1QYe6vqu4gWYytZOccLouFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.9.6" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer-crc32": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", + "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/bufferutil": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", + "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz", + "integrity": "sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-regex": "^1.0.3" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cli-color": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.4.tgz", + "integrity": "sha512-zlnpg0jNcibNrO7GG9IeHH7maWFeCz+Ja1wx/7tZNU5ASSSSZ+/qZciM0/LHCYxSdqv5h2sdbQ/PXYdOuetXvA==", + "license": "ISC", + "dependencies": { + "d": "^1.0.1", + "es5-ext": "^0.10.64", + "es6-iterator": "^2.0.3", + "memoizee": "^0.4.15", + "timers-ext": "^0.1.7" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/code-red": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz", + "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15", + "@types/estree": "^1.0.1", + "acorn": "^8.10.0", + "estree-walker": "^3.0.3", + "periscopic": "^3.1.0" + } + }, + "node_modules/code-red/node_modules/acorn": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/code-red/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/coffeescript": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.7.0.tgz", + "integrity": "sha512-hzWp6TUE2d/jCcN67LrW1eh5b/rSDKQK6oD6VMLlggYVUUFexgTH9z3dNYihzX4RMhze5FTUsUmOXViJKFQR/A==", + "dev": true, + "license": "MIT", + "bin": { + "cake": "bin/cake", + "coffee": "bin/coffee" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/constantinople": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-4.0.1.tgz", + "integrity": "sha512-vCrqcSIq4//Gx74TXXCGnHpulY1dskqLTFGDmhrGxzeXL8lF8kvXv6mpNWlJj1uD4DW23D4ljAqbY4RRaaUZIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.6.0", + "@babel/types": "^7.6.1" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cropperjs": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.6.2.tgz", + "integrity": "sha512-nhymn9GdnV3CqiEHJVai54TULFAE3VshJTXSqSJKa8yXAKyBKDWdhHarnlIPrshJ0WMFTGuFvG02YjLXfPiuOA==", + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/css/-/css-3.0.0.tgz", + "integrity": "sha512-DG9pFfwOrzc+hawpmqX/dHYHJG+Bsdb0klhyi1sDneOgGOXy9wQIC8hzyVp1e4NRYDBdxcylvywPkkXCHAzTyQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "inherits": "^2.0.4", + "source-map": "^0.6.1", + "source-map-resolve": "^0.6.0" + } + }, + "node_modules/css-tree": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", + "license": "MIT", + "peer": true, + "dependencies": { + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/css/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/d": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.2.tgz", + "integrity": "sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==", + "license": "ISC", + "dependencies": { + "es5-ext": "^0.10.64", + "type": "^2.7.2" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-indent": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz", + "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/doctypes": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz", + "integrity": "sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es5-ext": { + "version": "0.10.64", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz", + "integrity": "sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "esniff": "^2.0.1", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "license": "MIT", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==", + "dev": true, + "license": "MIT" + }, + "node_modules/es6-symbol": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.4.tgz", + "integrity": "sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==", + "license": "ISC", + "dependencies": { + "d": "^1.0.2", + "ext": "^1.7.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/es6-weak-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", + "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "license": "ISC", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/esbuild": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz", + "integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/linux-loong64": "0.14.54", + "esbuild-android-64": "0.14.54", + "esbuild-android-arm64": "0.14.54", + "esbuild-darwin-64": "0.14.54", + "esbuild-darwin-arm64": "0.14.54", + "esbuild-freebsd-64": "0.14.54", + "esbuild-freebsd-arm64": "0.14.54", + "esbuild-linux-32": "0.14.54", + "esbuild-linux-64": "0.14.54", + "esbuild-linux-arm": "0.14.54", + "esbuild-linux-arm64": "0.14.54", + "esbuild-linux-mips64le": "0.14.54", + "esbuild-linux-ppc64le": "0.14.54", + "esbuild-linux-riscv64": "0.14.54", + "esbuild-linux-s390x": "0.14.54", + "esbuild-netbsd-64": "0.14.54", + "esbuild-openbsd-64": "0.14.54", + "esbuild-sunos-64": "0.14.54", + "esbuild-windows-32": "0.14.54", + "esbuild-windows-64": "0.14.54", + "esbuild-windows-arm64": "0.14.54" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz", + "integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz", + "integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz", + "integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz", + "integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz", + "integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz", + "integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz", + "integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz", + "integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz", + "integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz", + "integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz", + "integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz", + "integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz", + "integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz", + "integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz", + "integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz", + "integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz", + "integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz", + "integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz", + "integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz", + "integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/esniff": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz", + "integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==", + "license": "ISC", + "dependencies": { + "d": "^1.0.1", + "es5-ext": "^0.10.62", + "event-emitter": "^0.3.5", + "type": "^2.7.2" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" + }, + "node_modules/event-emitter": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", + "license": "MIT", + "dependencies": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "license": "ISC", + "dependencies": { + "type": "^2.7.2" + } + }, + "node_modules/fetch-event-stream": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/fetch-event-stream/-/fetch-event-stream-0.1.5.tgz", + "integrity": "sha512-V1PWovkspxQfssq/NnxoEyQo1DV+MRK/laPuPblIZmSjMN8P5u46OhlFQznSr9p/t0Sp8Uc6SbM3yCMfr0KU8g==", + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/foreground-child": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globalyzer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "license": "MIT" + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "license": "MIT" + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/graphql": { + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", + "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/headers-polyfill": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.3.tgz", + "integrity": "sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==", + "license": "MIT" + }, + "node_modules/immutable": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz", + "integrity": "sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/intl-messageformat": { + "version": "9.13.0", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-9.13.0.tgz", + "integrity": "sha512-7sGC7QnSQGa5LZP7bXLDhVDtQOeKGeBFGHF2Y8LVBwYZoQZCgWeKoPGTa5GMG8g/TzDgeXuYJQis7Ggiw2xTOw==", + "license": "BSD-3-Clause", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/fast-memoize": "1.2.1", + "@formatjs/icu-messageformat-parser": "2.1.0", + "tslib": "^2.1.0" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", + "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-expression": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-expression/-/is-expression-4.0.0.tgz", + "integrity": "sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^7.1.1", + "object-assign": "^4.1.1" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-node-process": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz", + "integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==", + "license": "MIT" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-promise": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", + "license": "MIT" + }, + "node_modules/is-reference": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", + "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/jackspeak": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/js-stringify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", + "integrity": "sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g==", + "dev": true, + "license": "MIT" + }, + "node_modules/jstransformer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", + "integrity": "sha512-C9YK3Rf8q6VAPDCCU9fnqo3mAfOH6vUGnMcP4AQAYIEpWtfGLpwOTmZ+igtdK5y+VvI2n3CyYSzy4Qh34eq24A==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-promise": "^2.0.0", + "promise": "^7.0.1" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lazy-brush": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazy-brush/-/lazy-brush-1.0.1.tgz", + "integrity": "sha512-xT/iSClTVi7vLoF8dCWTBhCuOWqsLXCMPa6ucVmVAk6hyNCM5JeS1NLhXqIrJktUg+caEYKlqSOUU4u3cpXzKg==", + "license": "MIT" + }, + "node_modules/lightningcss": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.25.1.tgz", + "integrity": "sha512-V0RMVZzK1+rCHpymRv4URK2lNhIRyO8g7U7zOFwVAhJuat74HtkjIQpQRKNCwFEYkRGpafOpmXXLoaoBcyVtBg==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^1.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-darwin-arm64": "1.25.1", + "lightningcss-darwin-x64": "1.25.1", + "lightningcss-freebsd-x64": "1.25.1", + "lightningcss-linux-arm-gnueabihf": "1.25.1", + "lightningcss-linux-arm64-gnu": "1.25.1", + "lightningcss-linux-arm64-musl": "1.25.1", + "lightningcss-linux-x64-gnu": "1.25.1", + "lightningcss-linux-x64-musl": "1.25.1", + "lightningcss-win32-x64-msvc": "1.25.1" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.25.1.tgz", + "integrity": "sha512-G4Dcvv85bs5NLENcu/s1f7ehzE3D5ThnlWSDwE190tWXRQCQaqwcuHe+MGSVI/slm0XrxnaayXY+cNl3cSricw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.25.1.tgz", + "integrity": "sha512-dYWuCzzfqRueDSmto6YU5SoGHvZTMU1Em9xvhcdROpmtOQLorurUZz8+xFxZ51lCO2LnYbfdjZ/gCqWEkwixNg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.25.1.tgz", + "integrity": "sha512-hXoy2s9A3KVNAIoKz+Fp6bNeY+h9c3tkcx1J3+pS48CqAt+5bI/R/YY4hxGL57fWAIquRjGKW50arltD6iRt/w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.25.1.tgz", + "integrity": "sha512-tWyMgHFlHlp1e5iW3EpqvH5MvsgoN7ZkylBbG2R2LWxnvH3FuWCJOhtGcYx9Ks0Kv0eZOBud789odkYLhyf1ng==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.25.1.tgz", + "integrity": "sha512-Xjxsx286OT9/XSnVLIsFEDyDipqe4BcLeB4pXQ/FEA5+2uWCCuAEarUNQumRucnj7k6ftkAHUEph5r821KBccQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.25.1.tgz", + "integrity": "sha512-IhxVFJoTW8wq6yLvxdPvyHv4NjzcpN1B7gjxrY3uaykQNXPHNIpChLB52+wfH+yS58zm1PL4LemUp8u9Cfp6Bw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.25.1.tgz", + "integrity": "sha512-RXIaru79KrREPEd6WLXfKfIp4QzoppZvD3x7vuTKkDA64PwTzKJ2jaC43RZHRt8BmyIkRRlmywNhTRMbmkPYpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.25.1.tgz", + "integrity": "sha512-TdcNqFsAENEEFr8fJWg0Y4fZ/nwuqTRsIr7W7t2wmDUlA8eSXVepeeONYcb+gtTj1RaXn/WgNLB45SFkz+XBZA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.25.1.tgz", + "integrity": "sha512-9KZZkmmy9oGDSrnyHuxP6iMhbsgChUiu/NSgOx+U1I/wTngBStDf2i2aGRCHvFqj19HqqBEI4WuGVQBa2V6e0A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-character": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", + "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", + "license": "MIT", + "peer": true + }, + "node_modules/lru-cache": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.0.tgz", + "integrity": "sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/lru-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", + "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==", + "license": "MIT", + "dependencies": { + "es5-ext": "~0.10.2" + } + }, + "node_modules/magic-string": { + "version": "0.30.10", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", + "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + } + }, + "node_modules/mdn-data": { + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", + "license": "CC0-1.0", + "peer": true + }, + "node_modules/memoizee": { + "version": "0.4.17", + "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.17.tgz", + "integrity": "sha512-DGqD7Hjpi/1or4F/aYAspXKNm5Yili0QDAFAY4QYvpqpgiY6+1jOfqpmByzjxbWd/T9mChbCArXAbDAsTm5oXA==", + "license": "ISC", + "dependencies": { + "d": "^1.0.2", + "es5-ext": "^0.10.64", + "es6-weak-map": "^2.0.3", + "event-emitter": "^0.3.5", + "is-promise": "^2.2.2", + "lru-queue": "^0.1.0", + "next-tick": "^1.1.0", + "timers-ext": "^0.1.7" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/msw": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.3.1.tgz", + "integrity": "sha512-ocgvBCLn/5l3jpl1lssIb3cniuACJLoOfZu01e3n5dbJrpA5PeeWn28jCLgQDNt6d7QT8tF2fYRzm9JoEHtiig==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@bundled-es-modules/cookie": "^2.0.0", + "@bundled-es-modules/statuses": "^1.0.1", + "@inquirer/confirm": "^3.0.0", + "@mswjs/cookies": "^1.1.0", + "@mswjs/interceptors": "^0.29.0", + "@open-draft/until": "^2.1.0", + "@types/cookie": "^0.6.0", + "@types/statuses": "^2.0.4", + "chalk": "^4.1.2", + "graphql": "^16.8.1", + "headers-polyfill": "^4.0.2", + "is-node-process": "^1.2.0", + "outvariant": "^1.4.2", + "path-to-regexp": "^6.2.0", + "strict-event-emitter": "^0.5.1", + "type-fest": "^4.9.0", + "yargs": "^17.7.2" + }, + "bin": { + "msw": "cli/index.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/mswjs" + }, + "peerDependencies": { + "typescript": ">= 4.7.x" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", + "license": "ISC" + }, + "node_modules/node-gyp-build": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", + "integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/outvariant": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.2.tgz", + "integrity": "sha512-Ou3dJ6bA/UJ5GVHxah4LnqDwZRwAmWxrG3wtrHrbGnP4RnLCtA64A4F+ae7Y8ww660JaddSoArUR5HjipWSHAQ==", + "license": "MIT" + }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "license": "MIT" + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-to-regexp": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", + "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", + "license": "MIT" + }, + "node_modules/periscopic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz", + "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^3.0.0", + "is-reference": "^3.0.0" + } + }, + "node_modules/periscopic/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.4.39", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz", + "integrity": "sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.1", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "asap": "~2.0.3" + } + }, + "node_modules/pug": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pug/-/pug-3.0.3.tgz", + "integrity": "sha512-uBi6kmc9f3SZ3PXxqcHiUZLmIXgfgWooKWXcwSGwQd2Zi5Rb0bT14+8CJjJgI8AB+nndLaNgHGrcc6bPIB665g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pug-code-gen": "^3.0.3", + "pug-filters": "^4.0.0", + "pug-lexer": "^5.0.1", + "pug-linker": "^4.0.0", + "pug-load": "^3.0.0", + "pug-parser": "^6.0.0", + "pug-runtime": "^3.0.1", + "pug-strip-comments": "^2.0.0" + } + }, + "node_modules/pug-attrs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pug-attrs/-/pug-attrs-3.0.0.tgz", + "integrity": "sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA==", + "dev": true, + "license": "MIT", + "dependencies": { + "constantinople": "^4.0.1", + "js-stringify": "^1.0.2", + "pug-runtime": "^3.0.0" + } + }, + "node_modules/pug-code-gen": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-3.0.3.tgz", + "integrity": "sha512-cYQg0JW0w32Ux+XTeZnBEeuWrAY7/HNE6TWnhiHGnnRYlCgyAUPoyh9KzCMa9WhcJlJ1AtQqpEYHc+vbCzA+Aw==", + "dev": true, + "license": "MIT", + "dependencies": { + "constantinople": "^4.0.1", + "doctypes": "^1.1.0", + "js-stringify": "^1.0.2", + "pug-attrs": "^3.0.0", + "pug-error": "^2.1.0", + "pug-runtime": "^3.0.1", + "void-elements": "^3.1.0", + "with": "^7.0.0" + } + }, + "node_modules/pug-error": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-2.1.0.tgz", + "integrity": "sha512-lv7sU9e5Jk8IeUheHata6/UThZ7RK2jnaaNztxfPYUY+VxZyk/ePVaNZ/vwmH8WqGvDz3LrNYt/+gA55NDg6Pg==", + "dev": true, + "license": "MIT" + }, + "node_modules/pug-filters": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pug-filters/-/pug-filters-4.0.0.tgz", + "integrity": "sha512-yeNFtq5Yxmfz0f9z2rMXGw/8/4i1cCFecw/Q7+D0V2DdtII5UvqE12VaZ2AY7ri6o5RNXiweGH79OCq+2RQU4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "constantinople": "^4.0.1", + "jstransformer": "1.0.0", + "pug-error": "^2.0.0", + "pug-walk": "^2.0.0", + "resolve": "^1.15.1" + } + }, + "node_modules/pug-lexer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pug-lexer/-/pug-lexer-5.0.1.tgz", + "integrity": "sha512-0I6C62+keXlZPZkOJeVam9aBLVP2EnbeDw3An+k0/QlqdwH6rv8284nko14Na7c0TtqtogfWXcRoFE4O4Ff20w==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-parser": "^2.2.0", + "is-expression": "^4.0.0", + "pug-error": "^2.0.0" + } + }, + "node_modules/pug-linker": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pug-linker/-/pug-linker-4.0.0.tgz", + "integrity": "sha512-gjD1yzp0yxbQqnzBAdlhbgoJL5qIFJw78juN1NpTLt/mfPJ5VgC4BvkoD3G23qKzJtIIXBbcCt6FioLSFLOHdw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pug-error": "^2.0.0", + "pug-walk": "^2.0.0" + } + }, + "node_modules/pug-load": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pug-load/-/pug-load-3.0.0.tgz", + "integrity": "sha512-OCjTEnhLWZBvS4zni/WUMjH2YSUosnsmjGBB1An7CsKQarYSWQ0GCVyd4eQPMFJqZ8w9xgs01QdiZXKVjk92EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "object-assign": "^4.1.1", + "pug-walk": "^2.0.0" + } + }, + "node_modules/pug-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pug-parser/-/pug-parser-6.0.0.tgz", + "integrity": "sha512-ukiYM/9cH6Cml+AOl5kETtM9NR3WulyVP2y4HOU45DyMim1IeP/OOiyEWRr6qk5I5klpsBnbuHpwKmTx6WURnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pug-error": "^2.0.0", + "token-stream": "1.0.0" + } + }, + "node_modules/pug-runtime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/pug-runtime/-/pug-runtime-3.0.1.tgz", + "integrity": "sha512-L50zbvrQ35TkpHwv0G6aLSuueDRwc/97XdY8kL3tOT0FmhgG7UypU3VztfV/LATAvmUfYi4wNxSajhSAeNN+Kg==", + "dev": true, + "license": "MIT" + }, + "node_modules/pug-strip-comments": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-2.0.0.tgz", + "integrity": "sha512-zo8DsDpH7eTkPHCXFeAk1xZXJbyoTfdPlNR0bK7rpOMuhBYb0f5qUVCO1xlsitYd3w5FQTK7zpNVKb3rZoUrrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "pug-error": "^2.0.0" + } + }, + "node_modules/pug-walk": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pug-walk/-/pug-walk-2.0.0.tgz", + "integrity": "sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resize-observer-polyfill": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==", + "license": "MIT" + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/rollup": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", + "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.18.0", + "@rollup/rollup-android-arm64": "4.18.0", + "@rollup/rollup-darwin-arm64": "4.18.0", + "@rollup/rollup-darwin-x64": "4.18.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", + "@rollup/rollup-linux-arm-musleabihf": "4.18.0", + "@rollup/rollup-linux-arm64-gnu": "4.18.0", + "@rollup/rollup-linux-arm64-musl": "4.18.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", + "@rollup/rollup-linux-riscv64-gnu": "4.18.0", + "@rollup/rollup-linux-s390x-gnu": "4.18.0", + "@rollup/rollup-linux-x64-gnu": "4.18.0", + "@rollup/rollup-linux-x64-musl": "4.18.0", + "@rollup/rollup-win32-arm64-msvc": "4.18.0", + "@rollup/rollup-win32-ia32-msvc": "4.18.0", + "@rollup/rollup-win32-x64-msvc": "4.18.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "license": "MIT", + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/sander": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/sander/-/sander-0.5.1.tgz", + "integrity": "sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es6-promise": "^3.1.2", + "graceful-fs": "^4.1.3", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.2" + } + }, + "node_modules/sass": { + "version": "1.77.6", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.6.tgz", + "integrity": "sha512-ByXE1oLD79GVq9Ht1PeHWCPMPB8XHpBuz1r85oByKHjZY6qV6rWnQovQzXJXuQ/XyE1Oj3iPk3lo28uzaRA2/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true + }, + "node_modules/semiver": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz", + "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sorcery": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.1.tgz", + "integrity": "sha512-o7npfeJE6wi6J9l0/5LKshFzZ2rMatRiCDwYeDQaOzqdzRJwALhX7mk/A/ecg6wjMu7wdZbmXfD2S/vpOg0bdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.14", + "buffer-crc32": "^1.0.0", + "minimist": "^1.2.0", + "sander": "^0.5.0" + }, + "bin": { + "sorcery": "bin/sorcery" + } + }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/source-map-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-resolve": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz", + "integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==", + "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/strict-event-emitter": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz", + "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==", + "license": "MIT" + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/stylus": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.55.0.tgz", + "integrity": "sha512-MuzIIVRSbc8XxHH7FjkvWqkIcr1BvoMZoR/oFuAJDlh7VSaNJzrB4uJ38GRQa+mWjLXODAMzeDe0xi9GYbGwnw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "css": "^3.0.0", + "debug": "~3.1.0", + "glob": "^7.1.6", + "mkdirp": "~1.0.4", + "safer-buffer": "^2.1.2", + "sax": "~1.2.4", + "semver": "^6.3.0", + "source-map": "^0.7.3" + }, + "bin": { + "stylus": "bin/stylus" + }, + "engines": { + "node": "*" + } + }, + "node_modules/stylus/node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/stylus/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stylus/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/sucrase": { + "version": "3.35.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", + "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "^10.3.10", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/sucrase/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/sucrase/node_modules/glob": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", + "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sucrase/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sugarss": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/sugarss/-/sugarss-4.0.1.tgz", + "integrity": "sha512-WCjS5NfuVJjkQzK10s8WOBY+hhDxxNt/N6ZaGwxFZ+wN3/lKKFSaaKUNecULcTTvE4urLcKaZFQD8vO0mOZujw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.3.3" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/svelte": { + "version": "4.2.18", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.18.tgz", + "integrity": "sha512-d0FdzYIiAePqRJEb90WlJDkjUEx42xhivxN8muUBmfZnP+tzUgz12DJ2hRJi8sIHCME7jeK1PTMgKPSfTd8JrA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@ampproject/remapping": "^2.2.1", + "@jridgewell/sourcemap-codec": "^1.4.15", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/estree": "^1.0.1", + "acorn": "^8.9.0", + "aria-query": "^5.3.0", + "axobject-query": "^4.0.0", + "code-red": "^1.0.3", + "css-tree": "^2.3.1", + "estree-walker": "^3.0.3", + "is-reference": "^3.0.1", + "locate-character": "^3.0.0", + "magic-string": "^0.30.4", + "periscopic": "^3.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/svelte-hmr": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz", + "integrity": "sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^12.20 || ^14.13.1 || >= 16" + }, + "peerDependencies": { + "svelte": "^3.19.0 || ^4.0.0" + } + }, + "node_modules/svelte-i18n": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/svelte-i18n/-/svelte-i18n-3.7.4.tgz", + "integrity": "sha512-yGRCNo+eBT4cPuU7IVsYTYjxB7I2V8qgUZPlHnNctJj5IgbJgV78flsRzpjZ/8iUYZrS49oCt7uxlU3AZv/N5Q==", + "license": "MIT", + "dependencies": { + "cli-color": "^2.0.3", + "deepmerge": "^4.2.2", + "esbuild": "^0.19.2", + "estree-walker": "^2", + "intl-messageformat": "^9.13.0", + "sade": "^1.8.1", + "tiny-glob": "^0.2.9" + }, + "bin": { + "svelte-i18n": "dist/cli.js" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "svelte": "^3 || ^4" + } + }, + "node_modules/svelte-i18n/node_modules/@esbuild/linux-loong64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", + "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/svelte-i18n/node_modules/esbuild": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", + "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" + } + }, + "node_modules/svelte-preprocess": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.1.4.tgz", + "integrity": "sha512-IvnbQ6D6Ao3Gg6ftiM5tdbR6aAETwjhHV+UKGf5bHGYR69RQvF1ho0JKPcbUON4vy4R7zom13jPjgdOWCQ5hDA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@types/pug": "^2.0.6", + "detect-indent": "^6.1.0", + "magic-string": "^0.30.5", + "sorcery": "^0.11.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">= 16.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.10.2", + "coffeescript": "^2.5.1", + "less": "^3.11.3 || ^4.0.0", + "postcss": "^7 || ^8", + "postcss-load-config": "^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", + "pug": "^3.0.0", + "sass": "^1.26.8", + "stylus": "^0.55.0", + "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0", + "svelte": "^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0", + "typescript": ">=3.9.5 || ^4.0.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "coffeescript": { + "optional": true + }, + "less": { + "optional": true + }, + "postcss": { + "optional": true + }, + "postcss-load-config": { + "optional": true + }, + "pug": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/svelte/node_modules/acorn": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/svelte/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/textlinestream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/textlinestream/-/textlinestream-1.1.1.tgz", + "integrity": "sha512-iBHbi7BQxrFmwZUQJsT0SjNzlLLsXhvW/kg7EyOMVMBIrlnj/qYofwo1LVLZi+3GbUEo96Iu2eqToI2+lZoAEQ==", + "license": "MIT" + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/timers-ext": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.8.tgz", + "integrity": "sha512-wFH7+SEAcKfJpfLPkrgMPvvwnEtj8W4IurvEyrKsDleXnKLCDw71w8jltvfLa8Rm4qQxxT4jmDBYbJG/z7qoww==", + "license": "ISC", + "dependencies": { + "es5-ext": "^0.10.64", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/tiny-glob": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "license": "MIT", + "dependencies": { + "globalyzer": "0.1.0", + "globrex": "^0.1.2" + } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/token-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz", + "integrity": "sha512-VSsyNPPW74RpHwR8Fc21uubwHY7wMDeJLys2IX5zJNih+OnAnaifKHo+1LHT7DAdloQ7apeaaWg8l7qnf/TnEg==", + "dev": true, + "license": "MIT" + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "license": "0BSD" + }, + "node_modules/type": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.3.tgz", + "integrity": "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==", + "license": "ISC" + }, + "node_modules/type-fest": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.21.0.tgz", + "integrity": "sha512-ADn2w7hVPcK6w1I0uWnM//y1rLXZhzB9mr0a3OirzclKF1Wp6VzevUmzz/NRAWunOT6E8HrnpGY7xOfc6K57fA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "license": "MIT" + }, + "node_modules/vite": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.2.tgz", + "integrity": "sha512-6lA7OBHBlXUxiJxbO5aAY2fsHHzDr1q7DvXYnyZycRs2Dz+dXBWuhpWHvmljTRTpQC2uvGmUFFkSHF2vGo90MA==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.38", + "rollup": "^4.13.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/vitefu": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", + "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/with": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz", + "integrity": "sha512-RNGKj82nUPg3g5ygxkQl0R937xLyho1J24ItRCBTr/m1YnZkzJy1hUiHUJrc/VlsDQzsCnInEGSg3bci0Lmd4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.9.6", + "@babel/types": "^7.9.6", + "assert-never": "^1.2.1", + "babel-walk": "3.0.0-canary-5" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yoctocolors-cjs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.1.tgz", + "integrity": "sha512-c6T13b6qYcJZvck7QbEFXrFX/Mu2KOjvAGiKHmYMUg96jxNpfP6i+psGW72BOPxOIDUJrORG+Kyu7quMX9CQBQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yootils": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/yootils/-/yootils-0.3.1.tgz", + "integrity": "sha512-A7AMeJfGefk317I/3tBoUYRcDcNavKEkpiPN/nQsBz/viI2GvT7BtrqdPD6rGqBFN8Ax7v4obf+Cl32JF9DDVw==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/src/frontend/package.json b/src/frontend/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d26108c5451ce6194ce98d89ca33a2214ffc4161 --- /dev/null +++ b/src/frontend/package.json @@ -0,0 +1,35 @@ +{ + "name": "gradio_image_annotator", + "version": "0.11.9", + "description": "Gradio UI packages", + "type": "module", + "author": "", + "license": "ISC", + "private": false, + "dependencies": { + "@gradio/atoms": "0.7.4", + "@gradio/client": "1.1.0", + "@gradio/icons": "0.4.1", + "@gradio/statustracker": "0.6.0", + "@gradio/upload": "0.11.1", + "@gradio/image": "0.11.9", + "@gradio/utils": "0.4.2", + "@gradio/wasm": "0.10.1", + "cropperjs": "^1.5.12", + "lazy-brush": "^1.0.1", + "resize-observer-polyfill": "^1.5.1", + "@gradio/colorpicker": "^0.2.11", + "@gradio/button": "^0.2.24" + }, + "devDependencies": { + "@gradio/preview": "0.9.1" + }, + "main_changeset": true, + "main": "./Index.svelte", + "exports": { + ".": "./Index.svelte", + "./shared": "./shared/index.ts", + "./example": "./Example.svelte", + "./package.json": "./package.json" + } +} diff --git a/src/frontend/shared/AnnotatedImageData.ts b/src/frontend/shared/AnnotatedImageData.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6b0718f32e6860c99b9ca892bbaa6826c1288b9 --- /dev/null +++ b/src/frontend/shared/AnnotatedImageData.ts @@ -0,0 +1,7 @@ +import type { FileData } from "@gradio/client"; +import Box from "./Box"; + +export default class AnnotatedImageData { + image: FileData; + boxes: Box[] = []; +} diff --git a/src/frontend/shared/Box.ts b/src/frontend/shared/Box.ts new file mode 100644 index 0000000000000000000000000000000000000000..7975bcf266da84c12f4dcd67102bb2c45b905386 --- /dev/null +++ b/src/frontend/shared/Box.ts @@ -0,0 +1,510 @@ +const clamp = (num: number, min: number, max: number) => Math.min(Math.max(num, min), max) + + +function setAlpha(rgbColor: string, alpha: number) { + if (rgbColor.startsWith('rgba')) { + return rgbColor.replace(/[\d.]+$/, alpha.toString()); + } + const matches = rgbColor.match(/\d+/g); + if (!matches || matches.length !== 3) { + return `rgba(50, 50, 50, ${alpha})`; + } + const [r, g, b] = matches; + return `rgba(${r}, ${g}, ${b}, ${alpha})`; +} + + +export default class Box { + label: string; + xmin: number; + ymin: number; + xmax: number; + ymax: number; + color: string; + alpha: number; + isDragging: boolean; + isResizing: boolean; + isSelected: boolean; + isCreating: boolean; + offsetMouseX: number; + offsetMouseY: number; + resizeHandleSize: number; + resizingHandleIndex: number; + minSize: number; + renderCallBack: () => void; + onFinishCreation: () => void; + canvasXmin: number; + canvasYmin: number; + canvasXmax: number; + canvasYmax: number; + scaleFactor: number; + thickness: number; + selectedThickness: number; + creatingAnchorX: string; + creatingAnchorY: string; + resizeHandles: { + xmin: number; + ymin: number; + xmax: number; + ymax: number; + cursor: string; + }[]; + + constructor( + renderCallBack: () => void, + onFinishCreation: () => void, + canvasXmin: number, + canvasYmin: number, + canvasXmax: number, + canvasYmax: number, + label: string, + xmin: number, + ymin: number, + xmax: number, + ymax: number, + color: string = "rgb(255, 255, 255)", + alpha: number = 0.5, + minSize: number = 25, + handleSize: number = 8, + thickness: number = 2, + selectedThickness: number = 4, + scaleFactor: number = 1, + ) { + this.renderCallBack = renderCallBack; + this.onFinishCreation = onFinishCreation; + this.canvasXmin = canvasXmin; + this.canvasYmin = canvasYmin; + this.canvasXmax = canvasXmax; + this.canvasYmax = canvasYmax; + this.scaleFactor = scaleFactor; + this.label = label; + this.isDragging = false; + this.isCreating = false; + this.xmin = xmin; + this.ymin = ymin; + this.xmax = xmax; + this.ymax = ymax; + this.isResizing = false; + this.isSelected = false; + this.offsetMouseX = 0; + this.offsetMouseY = 0; + this.resizeHandleSize = handleSize; + this.thickness = thickness; + this.selectedThickness = selectedThickness; + this.updateHandles(); + this.resizingHandleIndex = -1; + this.minSize = minSize; + this.color = color; + this.alpha = alpha; + this.creatingAnchorX = "xmin"; + this.creatingAnchorY = "ymin"; + } + + toJSON() { + return { + label: this.label, + xmin: this.xmin, + ymin: this.ymin, + xmax: this.xmax, + ymax: this.ymax, + color: this.color, + scaleFactor: this.scaleFactor, + }; + } + + setSelected(selected: boolean): void{ + this.isSelected = selected; + } + + setScaleFactor(scaleFactor: number) { + let scale = scaleFactor / this.scaleFactor; + this.xmin = Math.round(this.xmin * scale); + this.ymin = Math.round(this.ymin * scale); + this.xmax = Math.round(this.xmax * scale); + this.ymax = Math.round(this.ymax * scale); + this.updateHandles(); + this.scaleFactor = scaleFactor; + } + + updateHandles(): void { + const halfSize = this.resizeHandleSize / 2; + const width = this.getWidth(); + const height = this.getHeight(); + this.resizeHandles = [ + { + // Top left + xmin: this.xmin - halfSize, + ymin: this.ymin - halfSize, + xmax: this.xmin + halfSize, + ymax: this.ymin + halfSize, + cursor: "nwse-resize", + }, + { + // Top right + xmin: this.xmax - halfSize, + ymin: this.ymin - halfSize, + xmax: this.xmax + halfSize, + ymax: this.ymin + halfSize, + cursor: "nesw-resize", + }, + { + // Bottom right + xmin: this.xmax - halfSize, + ymin: this.ymax - halfSize, + xmax: this.xmax + halfSize, + ymax: this.ymax + halfSize, + cursor: "nwse-resize", + }, + { + // Bottom left + xmin: this.xmin - halfSize, + ymin: this.ymax - halfSize, + xmax: this.xmin + halfSize, + ymax: this.ymax + halfSize, + cursor: "nesw-resize", + }, + { + // Top center + xmin: this.xmin + (width / 2) - halfSize, + ymin: this.ymin - halfSize, + xmax: this.xmin + (width / 2) + halfSize, + ymax: this.ymin + halfSize, + cursor: "ns-resize", + }, + { + // Right center + xmin: this.xmax - halfSize, + ymin: this.ymin + (height / 2) - halfSize, + xmax: this.xmax + halfSize, + ymax: this.ymin + (height / 2) + halfSize, + cursor: "ew-resize", + }, + { + // Bottom center + xmin: this.xmin + (width / 2) - halfSize, + ymin: this.ymax - halfSize, + xmax: this.xmin + (width / 2) + halfSize, + ymax: this.ymax + halfSize, + cursor: "ns-resize", + }, + { + // Left center + xmin: this.xmin - halfSize, + ymin: this.ymin + (height / 2) - halfSize, + xmax: this.xmin + halfSize, + ymax: this.ymin + (height / 2) + halfSize, + cursor: "ew-resize", + }, + ]; + } + + getWidth(): number { + return this.xmax - this.xmin; + } + + getHeight(): number { + return this.ymax - this.ymin; + } + + getArea(): number { + return this.getWidth() * this.getHeight(); + } + + toCanvasCoordinates(x: number, y: number): [number, number] { + x = x + this.canvasXmin; + y = y + this.canvasYmin; + return [x, y]; + } + + toBoxCoordinates(x: number, y: number): [number, number] { + x = x - this.canvasXmin; + y = y - this.canvasYmin; + return [x, y]; + } + + render(ctx: CanvasRenderingContext2D): void { + let xmin: number, ymin: number; + + // Render the box and border + ctx.beginPath(); + [xmin, ymin] = this.toCanvasCoordinates(this.xmin, this.ymin); + ctx.rect(xmin, ymin, this.getWidth(), this.getHeight()); + ctx.fillStyle = setAlpha(this.color, this.alpha); + ctx.fill(); + if (this.isSelected) { + ctx.lineWidth = this.selectedThickness; + } else { + ctx.lineWidth = this.thickness; + } + ctx.strokeStyle = setAlpha(this.color, 1); + + ctx.stroke(); + ctx.closePath(); + + // Render the label and background + if (this.label !== null && this.label.trim() !== ""){ + if (this.isSelected) { + ctx.font = "bold 14px Arial"; + } else { + ctx.font = "12px Arial"; + } + const labelWidth = ctx.measureText(this.label).width + 10; + const labelHeight = 20; + let labelX = this.xmin; + let labelY = this.ymin - labelHeight; + ctx.fillStyle = "white"; + [labelX, labelY] = this.toCanvasCoordinates(labelX, labelY); + ctx.fillRect(labelX, labelY, labelWidth, labelHeight); + ctx.lineWidth = 1; + ctx.strokeStyle = "black"; + ctx.strokeRect(labelX, labelY, labelWidth, labelHeight); + ctx.fillStyle = "black"; + ctx.fillText(this.label, labelX + 5, labelY + 15); + } + + // Render the handles + ctx.fillStyle = setAlpha(this.color, 1); + for (const handle of this.resizeHandles) { + [xmin, ymin] = this.toCanvasCoordinates(handle.xmin, handle.ymin); + ctx.fillRect( + xmin, + ymin, + handle.xmax - handle.xmin, + handle.ymax - handle.ymin, + ); + } + } + + startDrag(event: MouseEvent): void { + this.isDragging = true; + this.offsetMouseX = event.clientX - this.xmin; + this.offsetMouseY = event.clientY - this.ymin; + document.addEventListener("pointermove", this.handleDrag); + document.addEventListener("pointerup", this.stopDrag); + } + + stopDrag = (): void => { + this.isDragging = false; + document.removeEventListener("pointermove", this.handleDrag); + document.removeEventListener("pointerup", this.stopDrag); + }; + + handleDrag = (event: MouseEvent): void => { + if (this.isDragging) { + let deltaX = event.clientX - this.offsetMouseX - this.xmin; + let deltaY = event.clientY - this.offsetMouseY - this.ymin; + const canvasW = this.canvasXmax - this.canvasXmin; + const canvasH = this.canvasYmax - this.canvasYmin; + deltaX = clamp(deltaX, -this.xmin, canvasW-this.xmax); + deltaY = clamp(deltaY, -this.ymin, canvasH-this.ymax); + this.xmin += deltaX; + this.ymin += deltaY; + this.xmax += deltaX; + this.ymax += deltaY; + this.updateHandles(); + this.renderCallBack(); + } + }; + + isPointInsideBox(x: number, y: number): boolean { + [x, y] = this.toBoxCoordinates(x, y); + return ( + x >= this.xmin && + x <= this.xmax && + y >= this.ymin && + y <= this.ymax + ); + } + + indexOfPointInsideHandle(x: number, y: number): number { + [x, y] = this.toBoxCoordinates(x, y); + for (let i = 0; i < this.resizeHandles.length; i++) { + const handle = this.resizeHandles[i]; + if ( + x >= handle.xmin && + x <= handle.xmax && + y >= handle.ymin && + y <= handle.ymax + ) { + this.resizingHandleIndex = i; + return i; + } + } + return -1; + } + + startCreating(event: MouseEvent, canvasX: number, canvasY: number): void { + this.isCreating = true; + this.offsetMouseX = canvasX; + this.offsetMouseY = canvasY; + document.addEventListener("pointermove", this.handleCreating); + document.addEventListener("pointerup", this.stopCreating); + } + + handleCreating = (event: MouseEvent): void => { + if (this.isCreating) { + let [x, y] = this.toBoxCoordinates(event.clientX, event.clientY); + x -= this.offsetMouseX; + y -= this.offsetMouseY; + + if (x > this.xmax) { + if (this.creatingAnchorX == "xmax") { + this.xmin = this.xmax; + } + this.xmax = x; + this.creatingAnchorX = "xmin"; + } else if (x > this.xmin && x < this.xmax && this.creatingAnchorX == "xmin") { + this.xmax = x; + } else if (x > this.xmin && x < this.xmax && this.creatingAnchorX == "xmax") { + this.xmin = x; + } else if (x < this.xmin) { + if (this.creatingAnchorX == "xmin") { + this.xmax = this.xmin; + } + this.xmin = x; + this.creatingAnchorX = "xmax"; + } + + if (y > this.ymax) { + if (this.creatingAnchorY == "ymax") { + this.ymin = this.ymax; + } + this.ymax = y; + this.creatingAnchorY = "ymin"; + } else if (y > this.ymin && y < this.ymax && this.creatingAnchorY == "ymin") { + this.ymax = y; + } else if (y > this.ymin && y < this.ymax && this.creatingAnchorY == "ymax") { + this.ymin = y; + } else if (y < this.ymin) { + if (this.creatingAnchorY == "ymin") { + this.ymax = this.ymin; + } + this.ymin = y; + this.creatingAnchorY = "ymax"; + } + + this.updateHandles(); + this.renderCallBack(); + } + } + + stopCreating = (event: MouseEvent): void => { + this.isCreating = false; + document.removeEventListener("pointermove", this.handleCreating); + document.removeEventListener("pointerup", this.stopCreating); + + if (this.getArea() > 0) { + const canvasW = this.canvasXmax - this.canvasXmin; + const canvasH = this.canvasYmax - this.canvasYmin; + this.xmin = clamp(this.xmin, 0, canvasW - this.minSize); + this.ymin = clamp(this.ymin, 0, canvasH - this.minSize); + this.xmax = clamp(this.xmax, this.minSize, canvasW); + this.ymax = clamp(this.ymax, this.minSize, canvasH); + + if (this.minSize > 0) { + if (this.getWidth() < this.minSize) { + if (this.creatingAnchorX == "xmin") { + this.xmax = this.xmin + this.minSize; + } else { + this.xmin = this.xmax - this.minSize; + } + } + if (this.getHeight() < this.minSize) { + if (this.creatingAnchorY == "ymin") { + this.ymax = this.ymin + this.minSize; + } else { + this.ymin = this.ymax - this.minSize; + } + } + if (this.xmax > canvasW) { + this.xmin -= this.xmax - canvasW; + this.xmax = canvasW; + } else if (this.xmin < 0) { + this.xmax -= this.xmin; + this.xmin = 0; + } + if (this.ymax > canvasH) { + this.ymin -= this.ymax - canvasH; + this.ymax = canvasH; + } else if (this.ymin < 0) { + this.ymax -= this.ymin; + this.ymin = 0; + } + } + this.updateHandles(); + this.renderCallBack(); + } + this.onFinishCreation(); + } + + startResize(handleIndex: number, event: MouseEvent): void { + this.resizingHandleIndex = handleIndex; + this.isResizing = true; + this.offsetMouseX = event.clientX - this.resizeHandles[handleIndex].xmin; + this.offsetMouseY = event.clientY - this.resizeHandles[handleIndex].ymin; + document.addEventListener("pointermove", this.handleResize); + document.addEventListener("pointerup", this.stopResize); + } + + handleResize = (event: MouseEvent): void => { + if (this.isResizing) { + const mouseX = event.clientX; + const mouseY = event.clientY; + const deltaX = mouseX - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX; + const deltaY = mouseY - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY; + const canvasW = this.canvasXmax - this.canvasXmin; + const canvasH = this.canvasYmax - this.canvasYmin; + switch (this.resizingHandleIndex) { + case 0: // Top-left handle + this.xmin += deltaX; + this.ymin += deltaY; + this.xmin = clamp(this.xmin, 0, this.xmax - this.minSize); + this.ymin = clamp(this.ymin, 0, this.ymax - this.minSize); + break; + case 1: // Top-right handle + this.xmax += deltaX; + this.ymin += deltaY; + this.xmax = clamp(this.xmax, this.xmin + this.minSize, canvasW); + this.ymin = clamp(this.ymin, 0, this.ymax - this.minSize); + break; + case 2: // Bottom-right handle + this.xmax += deltaX; + this.ymax += deltaY; + this.xmax = clamp(this.xmax, this.xmin + this.minSize, canvasW); + this.ymax = clamp(this.ymax, this.ymin + this.minSize, canvasH); + break; + case 3: // Bottom-left handle + this.xmin += deltaX; + this.ymax += deltaY; + this.xmin = clamp(this.xmin, 0, this.xmax - this.minSize); + this.ymax = clamp(this.ymax, this.ymin + this.minSize, canvasH); + break; + case 4: // Top center handle + this.ymin += deltaY; + this.ymin = clamp(this.ymin, 0, this.ymax - this.minSize); + break; + case 5: // Right center handle + this.xmax += deltaX; + this.xmax = clamp(this.xmax, this.xmin + this.minSize, canvasW); + break; + case 6: // Bottom center handle + this.ymax += deltaY; + this.ymax = clamp(this.ymax, this.ymin + this.minSize, canvasH); + break; + case 7: // Left center handle + this.xmin += deltaX; + this.xmin = clamp(this.xmin, 0, this.xmax - this.minSize); + break; + } + // Update the resize handles + this.updateHandles(); + this.renderCallBack(); + } + }; + + stopResize = (): void => { + this.isResizing = false; + document.removeEventListener("pointermove", this.handleResize); + document.removeEventListener("pointerup", this.stopResize); + }; +} diff --git a/src/frontend/shared/Canvas.svelte b/src/frontend/shared/Canvas.svelte new file mode 100644 index 0000000000000000000000000000000000000000..a1256e6a2bbd70232d8d5feab5d627295a9c42df --- /dev/null +++ b/src/frontend/shared/Canvas.svelte @@ -0,0 +1,575 @@ + + +
+ +
+ +{#if interactive} + + + + {#if showRemoveButton} + + {/if} + +{/if} + +{#if editModalVisible} + = 0 && selectedBox < value.boxes.length ? value.boxes[selectedBox].label : ""} + color={selectedBox >= 0 && selectedBox < value.boxes.length ? colorRGBAToHex(value.boxes[selectedBox].color) : ""} + /> +{/if} + +{#if newModalVisible} + = 0 && selectedBox < value.boxes.length ? value.boxes[selectedBox].label : ""} + color={selectedBox >= 0 && selectedBox < value.boxes.length ? colorRGBAToHex(value.boxes[selectedBox].color) : ""} + /> +{/if} + + diff --git a/src/frontend/shared/ClearImage.svelte b/src/frontend/shared/ClearImage.svelte new file mode 100644 index 0000000000000000000000000000000000000000..87a2ea653568c054f3de129f2b3e5823cba4a6fa --- /dev/null +++ b/src/frontend/shared/ClearImage.svelte @@ -0,0 +1,30 @@ + + +
+ { + dispatch("remove_image"); + event.stopPropagation(); + }} + /> +
+ + diff --git a/src/frontend/shared/Colors.js b/src/frontend/shared/Colors.js new file mode 100644 index 0000000000000000000000000000000000000000..9ccaa2b2ceb0b582f40caf57bde631a7b538ff33 --- /dev/null +++ b/src/frontend/shared/Colors.js @@ -0,0 +1,15 @@ +export const Colors = [ + "rgb(255, 168, 77)", + "rgb(92, 172, 238)", + "rgb(255, 99, 71)", + "rgb(118, 238, 118)", + "rgb(255, 145, 164)", + "rgb(0, 191, 255)", + "rgb(255, 218, 185)", + "rgb(255, 69, 0)", + "rgb(34, 139, 34)", + "rgb(255, 240, 245)", + "rgb(255, 193, 37)", + "rgb(255, 193, 7)", + "rgb(255, 250, 138)", +]; diff --git a/src/frontend/shared/ImageAnnotator.svelte b/src/frontend/shared/ImageAnnotator.svelte new file mode 100644 index 0000000000000000000000000000000000000000..2497907e3f45f73c427baf818ecac460fb3c3d00 --- /dev/null +++ b/src/frontend/shared/ImageAnnotator.svelte @@ -0,0 +1,244 @@ + + + + +
+ {#if showDownloadButton && value !== null} + + + + {/if} + {#if showShareButton && value !== null} + { + if (value === null) return ""; + let url = await uploadToHuggingFace(value.image, "base64"); + return ``; + }} + {value} + /> + {/if} + {#if showClearButton && value !== null && interactive} +
+ +
+ {/if} +
+ +
+
+ + {#if value === null && active_source === "webcam"} + handle_save(e.detail)} + on:stream={(e) => handle_save(e.detail)} + on:error + on:drag + on:upload={(e) => handle_save(e.detail)} + mode="image" + include_audio={false} + {i18n} + {upload} + /> + {/if} + {#if value !== null} +
+ dispatch("change")} + {height} + {width} + {boxesAlpha} + {labelList} + {labelColors} + {boxMinSize} + {interactive} + {handleSize} + {boxThickness} + {singleBox} + {disableEditBoxes} + {showRemoveButton} + {handlesCursor} + {boxSelectedThickness} + src={value.image.url} + /> +
+ {/if} +
+ {#if (sources.length > 1 || sources.includes("clipboard")) && value === null && interactive} + + {/if} +
+ + diff --git a/src/frontend/shared/ImageCanvas.svelte b/src/frontend/shared/ImageCanvas.svelte new file mode 100644 index 0000000000000000000000000000000000000000..2aec18ce2cdad16ac32d0746cb2e6328748a2014 --- /dev/null +++ b/src/frontend/shared/ImageCanvas.svelte @@ -0,0 +1,76 @@ + + + dispatch("change")} + {interactive} + boxAlpha={boxesAlpha} + choices={labelList} + choicesColors={labelColors} + {height} + {width} + {boxMinSize} + {handleSize} + {boxThickness} + {boxSelectedThickness} + {disableEditBoxes} + {singleBox} + {showRemoveButton} + {handlesCursor} + imageUrl={resolved_src} +/> diff --git a/src/frontend/shared/ModalBox.svelte b/src/frontend/shared/ModalBox.svelte new file mode 100644 index 0000000000000000000000000000000000000000..37f008af1c51fe1783149d4949e83d0d5f380243 --- /dev/null +++ b/src/frontend/shared/ModalBox.svelte @@ -0,0 +1,151 @@ + + + + + diff --git a/src/frontend/shared/icons/Add.svelte b/src/frontend/shared/icons/Add.svelte new file mode 100644 index 0000000000000000000000000000000000000000..17b4a690ee6d61a0cb0bf6a036f52560fe4a5af0 --- /dev/null +++ b/src/frontend/shared/icons/Add.svelte @@ -0,0 +1,14 @@ + + + + diff --git a/src/frontend/shared/icons/BoundingBox.svelte b/src/frontend/shared/icons/BoundingBox.svelte new file mode 100644 index 0000000000000000000000000000000000000000..7b8720cf2f42d187964a454eb548cbf2a77547a2 --- /dev/null +++ b/src/frontend/shared/icons/BoundingBox.svelte @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/frontend/shared/icons/Hand.svelte b/src/frontend/shared/icons/Hand.svelte new file mode 100644 index 0000000000000000000000000000000000000000..ec97cf8e71202ffca36737b1c81595d82deece8f --- /dev/null +++ b/src/frontend/shared/icons/Hand.svelte @@ -0,0 +1,17 @@ + + + diff --git a/src/frontend/shared/icons/Trash.svelte b/src/frontend/shared/icons/Trash.svelte new file mode 100644 index 0000000000000000000000000000000000000000..ab16d341a4581c2bffc725e1b2d8e41855394528 --- /dev/null +++ b/src/frontend/shared/icons/Trash.svelte @@ -0,0 +1,18 @@ + + + + diff --git a/src/frontend/shared/icons/index.ts b/src/frontend/shared/icons/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a3ca5f6ba4b9901dfd263c74946f126cbcbd0e6 --- /dev/null +++ b/src/frontend/shared/icons/index.ts @@ -0,0 +1,4 @@ +export { default as Add } from "./Add.svelte"; +export { default as BoundingBox } from "./BoundingBox.svelte"; +export { default as Hand } from "./Hand.svelte"; +export { default as Trash } from "./Trash.svelte"; \ No newline at end of file diff --git a/src/frontend/shared/index.ts b/src/frontend/shared/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8829ff3b15974f15ea25fb40e3565187ae65158 --- /dev/null +++ b/src/frontend/shared/index.ts @@ -0,0 +1 @@ +export { default as Image } from "./Image.svelte"; diff --git a/src/frontend/shared/patched_dropdown/CHANGELOG.md b/src/frontend/shared/patched_dropdown/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..f5b5165d7809f670895c1243bc4e5a8ce5085daf --- /dev/null +++ b/src/frontend/shared/patched_dropdown/CHANGELOG.md @@ -0,0 +1,246 @@ +# @gradio/dropdown + +## 0.6.3 + +### Fixes + +- [#7567](https://github.com/gradio-app/gradio/pull/7567) [`e340894`](https://github.com/gradio-app/gradio/commit/e340894b1cf2f44dd45e597fd8d9e547f408fbb3) - Quick fix: custom dropdown value. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)! + +## 0.6.2 + +### Patch Changes + +- Updated dependencies [[`98a2719`](https://github.com/gradio-app/gradio/commit/98a2719bfb9c64338caf9009891b6c6b0b33ea89)]: + - @gradio/statustracker@0.4.8 + +## 0.6.1 + +### Features + +- [#7425](https://github.com/gradio-app/gradio/pull/7425) [`3e4e680`](https://github.com/gradio-app/gradio/commit/3e4e680a52ba5a73c108ef1b328dacd7b6e4b566) - Fixes to the `.key_up()` method to make it usable for a dynamic dropdown autocomplete. Thanks [@abidlabs](https://github.com/abidlabs)! + +### Fixes + +- [#7431](https://github.com/gradio-app/gradio/pull/7431) [`6b8a7e5`](https://github.com/gradio-app/gradio/commit/6b8a7e5d36887cdfcfbfec1536a915128df0d6b2) - Ensure `gr.Dropdown` can have an empty initial value. Thanks [@hannahblair](https://github.com/hannahblair)! + +## 0.6.0 + +### Fixes + +- [#7404](https://github.com/gradio-app/gradio/pull/7404) [`065c5b1`](https://github.com/gradio-app/gradio/commit/065c5b163c4badb9d9cbd06d627fb4ba086003e7) - Add `.key_up` event listener to `gr.Dropdown()`. Thanks [@abidlabs](https://github.com/abidlabs)! +- [#7401](https://github.com/gradio-app/gradio/pull/7401) [`dff4109`](https://github.com/gradio-app/gradio/commit/dff410955e41145848376784c03fe28ba1c4fd85) - Retain dropdown value if choices have been changed. Thanks [@abidlabs](https://github.com/abidlabs)! + +## 0.5.2 + +### Fixes + +- [#7192](https://github.com/gradio-app/gradio/pull/7192) [`8dd6f4b`](https://github.com/gradio-app/gradio/commit/8dd6f4bc1901792f05cd59e86df7b1dbab692739) - Handle the case where examples is `null` for all components. Thanks [@abidlabs](https://github.com/abidlabs)! + +## 0.5.1 + +### Fixes + +- [#7081](https://github.com/gradio-app/gradio/pull/7081) [`44c53d9`](https://github.com/gradio-app/gradio/commit/44c53d9bde7cab605b7dbd16331683d13cae029e) - Fix dropdown refocusing due to `